Match applications in krunner using subsequences instead of substrings.
This allows matching applications using parts of its name, instead of
having to type its full name.
This is also an attempt to implement bug #262837 (Applications runner -
match subsequence instead of substring)
Differential Revision: https://phabricator.kde.org/D5870
wilder-5.14
Ronnie Thomas9 years agocommitted byAlbert Astals Cid
// If the term length is < 3, no real point searching the Keywords and GenericName
// If the term length is < 3, no real point searching the Keywords and GenericName
if(term.length()<3){
if(term.length()<3){
query=QStringLiteral("exist Exec and ( (exist Name and '%1' ~~ Name) or ('%1' ~~ Exec) )").arg(term);
query=QStringLiteral("exist Exec and ( (exist Name and '%1' ~~ Name) or ('%1' ~~ Exec) )").arg(term);
}else{
}else{
// Search for applications which are executable and the term case-insensitive matches any of
//Match using subsequences (Bug: 262837)
// * a substring of one of the keywords
query=generateQuery(queryList);
// * a substring of the GenericName field
// * a substring of the Name field
// Note that before asking for the content of e.g. Keywords and GenericName we need to ask if
// they exist to prevent a tree evaluation error if they are not defined.
query=QStringLiteral("exist Exec and ( (exist Keywords and '%1' ~subin Keywords) or (exist GenericName and '%1' ~~ GenericName) or (exist Name and '%1' ~~ Name) or ('%1' ~~ Exec) or (exist Comment and '%1' ~~ Comment) )").arg(term);