diff --git a/src/apps/text_search/GrepListView.cpp b/src/apps/text_search/GrepListView.cpp index 6e139bdb89..787e4763ee 100644 --- a/src/apps/text_search/GrepListView.cpp +++ b/src/apps/text_search/GrepListView.cpp @@ -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; +} + diff --git a/src/apps/text_search/GrepListView.h b/src/apps/text_search/GrepListView.h index a7f9c647fa..f0355a0dd3 100644 --- a/src/apps/text_search/GrepListView.h +++ b/src/apps/text_search/GrepListView.h @@ -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