diff --git a/rtdata/languages/default b/rtdata/languages/default index 5df352152..bae093a47 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -148,7 +148,7 @@ FILEBROWSER_POPUPTRASH;Move to trash FILEBROWSER_POPUPUNRANK;Unrank FILEBROWSER_POPUPUNTRASH;Remove from trash FILEBROWSER_QUERYBUTTONHINT;Clear the Find query -FILEBROWSER_QUERYHINT;Type filenames to search for. Supports partial filenames. Separate search terms using commas, e.g.\n1001,1004,1199\n\nShortcuts:\nCtrl-f - focus the Find box,\nEnter - search,\nEsc - clear the Find box,\nShift-Esc - defocus the Find box. +FILEBROWSER_QUERYHINT;Type filenames to search for. Supports partial filenames. Separate the search terms using commas, e.g.\n1001,1004,1199\n\nExclude search terms by prefixing them with !=\ne.g.\n!=1001,1004,1199\n\nShortcuts:\nCtrl-f - focus the Find box,\nEnter - search,\nEsc - clear the Find box,\nShift-Esc - defocus the Find box. FILEBROWSER_QUERYLABEL; Find: FILEBROWSER_RANK1_TOOLTIP;Rank 1 *\nShortcut: Shift-1 FILEBROWSER_RANK2_TOOLTIP;Rank 2 *\nShortcut: Shift-2 diff --git a/rtgui/filebrowser.cc b/rtgui/filebrowser.cc index 91828af61..5a0ff73be 100755 --- a/rtgui/filebrowser.cc +++ b/rtgui/filebrowser.cc @@ -1210,11 +1210,24 @@ bool FileBrowser::checkFilter (ThumbBrowserEntryBase* entryb) { // true -> entry FileName = FileName.uppercase(); //printf("FileBrowser::checkFilter FileName = '%s'; find() result= %i \n",FileName.c_str(), FileName.find(filter.queryFileName.uppercase())); + Glib::ustring decodedQueryFileName; + bool MatchEqual; + + // Determine the match mode - check if the first 2 characters are equal to "!=" + if (filter.queryFileName.find("!=")==0){ + decodedQueryFileName = filter.queryFileName.substr (2,filter.queryFileName.length()-2); + MatchEqual = false; + } + else { + decodedQueryFileName = filter.queryFileName; + MatchEqual = true; + } + // Consider that queryFileName consist of comma separated values (FilterString) // Evaluate if ANY of these FilterString are contained in the filename // This will construct OR filter within the filter.queryFileName int iFilenameMatch=0; - std::vector vFilterStrings = Glib::Regex::split_simple(",", filter.queryFileName.uppercase()); + std::vector vFilterStrings = Glib::Regex::split_simple(",", decodedQueryFileName.uppercase()); for(int i=0; i entry if (FileName.find(vFilterStrings.at(i))!=-1) iFilenameMatch++; } } - if (iFilenameMatch==0) //none of the vFilterStrings found in FileName - return false; + + if (MatchEqual==true){ + if (iFilenameMatch==0) //none of the vFilterStrings found in FileName + return false; + } + else{ + if (iFilenameMatch>0) // match is found for at least one of vFilterStrings in FileName + return false; + } /*experimental Regex support, this is unlikely to be useful to photographers*/ //bool matchfound=Glib::Regex::match_simple(filter.queryFileName.uppercase(),FileName);