Skip to content

Commit

Permalink
Search term '*' shows all apps
Browse files Browse the repository at this point in the history
  • Loading branch information
Humdinger committed Nov 2, 2018
1 parent bcb19dc commit 41c49d3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion MainListView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ MainListView::Draw(BRect rect)

if (settings.Lock()) {
if (letters == 0)
string = B_TRANSLATE("No favorites yet.");
string = B_TRANSLATE("No favorites yet. Use '*' for all apps.");
else
string = B_TRANSLATE("Found no matches.");

Expand Down
11 changes: 10 additions & 1 deletion MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ MainWindow::FilterList()
QLSettings& settings = my_app->Settings();
BString term = GetSearchString();

//Search string empty -> show favourites
if (term.CountChars() == 0) {
fListView->MakeEmpty();
ShowFavorites();
Expand All @@ -330,11 +331,19 @@ MainWindow::FilterList()
MainListItem* sItem = dynamic_cast<MainListItem *>
(fAllList->ItemAt(i));

// Search string is "*" -> Show all apps
if (term.Compare("*", 1) == 0) {
fListView->AddItem(sItem);
continue;
}

if (settings.GetSearchStart()) {
// Match from start of app name
if (term.ICompare(sItem->GetName(), term.Length()) == 0)
fListView->AddItem(sItem);
} else {
if (strstr(sItem->GetName(), term.String()) != NULL)
// Match anywhere in app name
if (strcasestr(sItem->GetName(), term.String()) != NULL)
fListView->AddItem(sItem);
}
}
Expand Down

0 comments on commit 41c49d3

Please sign in to comment.