Skip to content

Commit

Permalink
Filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
jacereda committed Feb 27, 2024
1 parent fbe6bac commit 85f1431
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions nfd/nfd_haiku.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,22 @@ static nfdresult_t dialog(BFilePanel &p, nfdnchar_t **outPath,
}

class NFDFilter : public BRefFilter {
const nfdnfilteritem_t * _filter;
nfdfiltersize_t _count;
public:
NFDFilter(const nfdnfilteritem_t *filterList, nfdfiltersize_t filterCount) {}
NFDFilter(const nfdnfilteritem_t *filterList, nfdfiltersize_t filterCount)
: _filter(filterList)
, _count(filterCount) {}

bool Filter(const entry_ref *ref, BNode *node, struct stat_beos *stat,
const char *mimeType) override {
return true;
BString name(ref->name);
if (node->IsDirectory())
return true;
for (auto i = 0; i < _count; i++)
if (name.EndsWith(_filter[0].spec))
return true;
return false;
}
};

Expand Down

0 comments on commit 85f1431

Please sign in to comment.