Add method to remove all subitems of a result item, and optionally also the

item itself.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27376 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2008-09-08 11:25:57 +00:00
parent e74f2e8388
commit f0d8b55fe6
2 changed files with 31 additions and 0 deletions

View File

@ -58,3 +58,31 @@ GrepListView::FindItem(const entry_ref& ref, int32* _index) const
*_index = -1;
return NULL;
}
ResultItem*
GrepListView::RemoveResults(const entry_ref& ref, bool completeItem)
{
int32 index;
ResultItem* item = FindItem(ref, &index);
if (item == NULL)
return NULL;
// remove all the sub items
while (true) {
BListItem* subItem = FullListItemAt(index + 1);
if (subItem && subItem->OutlineLevel() > 0)
delete RemoveItem(index + 1);
else
break;
}
if (completeItem) {
// remove file item itself
delete RemoveItem(index);
item = NULL;
}
return item;
}

View File

@ -41,6 +41,9 @@ public:
ResultItem* FindItem(const entry_ref& ref,
int32* _index) const;
ResultItem* RemoveResults(const entry_ref& ref,
bool completeItem);
};
#endif // GREP_LIST_VIEW_H