Use WildcardMatcher for simple Auto-Type window patterns.

This commit is contained in:
Felix Geyer 2012-07-23 18:11:10 +02:00
parent 92efb3d20b
commit a16f7e7cca

View File

@ -22,6 +22,7 @@
#include "autotype/AutoTypePlatformPlugin.h"
#include "autotype/AutoTypeSelectDialog.h"
#include "autotype/WildcardMatcher.h"
#include "core/Database.h"
#include "core/Entry.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)
{
QRegExp regExp;
regExp.setCaseSensitivity(Qt::CaseInsensitive);
if (windowPattern.startsWith("//") && windowPattern.endsWith("//") && windowPattern.size() >= 4) {
regExp.setPatternSyntax(QRegExp::RegExp2);
regExp.setPattern(windowPattern.mid(2, windowPattern.size() - 4));
}
else {
regExp.setPatternSyntax(QRegExp::Wildcard);
regExp.setPattern(windowPattern);
}
QRegExp regExp(windowPattern.mid(2, windowPattern.size() - 4), Qt::CaseInsensitive, QRegExp::RegExp2);
return regExp.exactMatch(windowTitle);
}
else {
return WildcardMatcher(windowTitle).match(windowPattern);
}
}