From a16f7e7cca73075a40a0ffd710c70782e319fbd6 Mon Sep 17 00:00:00 2001 From: Felix Geyer Date: Mon, 23 Jul 2012 18:11:10 +0200 Subject: [PATCH] Use WildcardMatcher for simple Auto-Type window patterns. --- src/autotype/AutoType.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/autotype/AutoType.cpp b/src/autotype/AutoType.cpp index a33487449..14714294d 100644 --- a/src/autotype/AutoType.cpp +++ b/src/autotype/AutoType.cpp @@ -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)); + QRegExp regExp(windowPattern.mid(2, windowPattern.size() - 4), Qt::CaseInsensitive, QRegExp::RegExp2); + return regExp.exactMatch(windowTitle); } else { - regExp.setPatternSyntax(QRegExp::Wildcard); - regExp.setPattern(windowPattern); + return WildcardMatcher(windowTitle).match(windowPattern); } - - return regExp.exactMatch(windowTitle); }