mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-04-06 05:57:37 +03:00
Whitespace separated search terms are AND concatenated.
This commit is contained in:
parent
4d263a09db
commit
92bf7c94d0
4 changed files with 48 additions and 4 deletions
|
@ -536,10 +536,21 @@ const Database* Entry::database() const
|
|||
|
||||
bool Entry::match(const QString& searchTerm, Qt::CaseSensitivity caseSensitivity)
|
||||
{
|
||||
return title().contains(searchTerm, caseSensitivity) ||
|
||||
username().contains(searchTerm, caseSensitivity) ||
|
||||
url().contains(searchTerm, caseSensitivity) ||
|
||||
notes().contains(searchTerm, caseSensitivity);
|
||||
QStringList wordList = searchTerm.split(QRegExp("\\s"), QString::SkipEmptyParts);
|
||||
Q_FOREACH (const QString& word, wordList) {
|
||||
if (!wordMatch(word, caseSensitivity)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Entry::wordMatch(const QString& word, Qt::CaseSensitivity caseSensitivity)
|
||||
{
|
||||
return title().contains(word, caseSensitivity) ||
|
||||
username().contains(word, caseSensitivity) ||
|
||||
url().contains(word, caseSensitivity) ||
|
||||
notes().contains(word, caseSensitivity);
|
||||
}
|
||||
|
||||
QString Entry::resolvePlaceholders(const QString& str) const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue