mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Use WildcardMatcher for simple Auto-Type window patterns.
This commit is contained in:
parent
92efb3d20b
commit
a16f7e7cca
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include "autotype/AutoTypePlatformPlugin.h"
|
#include "autotype/AutoTypePlatformPlugin.h"
|
||||||
#include "autotype/AutoTypeSelectDialog.h"
|
#include "autotype/AutoTypeSelectDialog.h"
|
||||||
|
#include "autotype/WildcardMatcher.h"
|
||||||
#include "core/Database.h"
|
#include "core/Database.h"
|
||||||
#include "core/Entry.h"
|
#include "core/Entry.h"
|
||||||
#include "core/FilePath.h"
|
#include "core/FilePath.h"
|
||||||
@ -503,17 +504,13 @@ QString AutoType::autoTypeSequence(const Entry* entry, const QString& windowTitl
|
|||||||
|
|
||||||
bool AutoType::windowMatches(const QString& windowTitle, const QString& windowPattern)
|
bool AutoType::windowMatches(const QString& windowTitle, const QString& windowPattern)
|
||||||
{
|
{
|
||||||
QRegExp regExp;
|
|
||||||
regExp.setCaseSensitivity(Qt::CaseInsensitive);
|
|
||||||
|
|
||||||
if (windowPattern.startsWith("//") && windowPattern.endsWith("//") && windowPattern.size() >= 4) {
|
if (windowPattern.startsWith("//") && windowPattern.endsWith("//") && windowPattern.size() >= 4) {
|
||||||
regExp.setPatternSyntax(QRegExp::RegExp2);
|
QRegExp regExp(windowPattern.mid(2, windowPattern.size() - 4), Qt::CaseInsensitive, QRegExp::RegExp2);
|
||||||
regExp.setPattern(windowPattern.mid(2, windowPattern.size() - 4));
|
return regExp.exactMatch(windowTitle);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
regExp.setPatternSyntax(QRegExp::Wildcard);
|
return WildcardMatcher(windowTitle).match(windowPattern);
|
||||||
regExp.setPattern(windowPattern);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return regExp.exactMatch(windowTitle);
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user