From b194c2916664eed5f54030269f9d391819c953ff Mon Sep 17 00:00:00 2001 From: Felix Geyer Date: Mon, 7 Apr 2014 08:54:32 +0200 Subject: [PATCH] Show a dialog when no window matches for auto-type. --- src/autotype/AutoType.cpp | 3 +++ tests/TestAutoType.cpp | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/autotype/AutoType.cpp b/src/autotype/AutoType.cpp index 1455e971c..80b810821 100644 --- a/src/autotype/AutoType.cpp +++ b/src/autotype/AutoType.cpp @@ -30,6 +30,7 @@ #include "core/Group.h" #include "core/ListDeleter.h" #include "core/Tools.h" +#include "gui/MessageBox.h" AutoType* AutoType::m_instance = Q_NULLPTR; @@ -189,6 +190,8 @@ void AutoType::performGlobalAutoType(const QList& dbList) if (entryList.isEmpty()) { m_inAutoType = false; + MessageBox::information(Q_NULLPTR, tr("Auto-Type - KeePassX"), + tr("Couldn't find an entry that matches the window title.")); } else if ((entryList.size() == 1) && !config()->get("security/autotypeask").toBool()) { m_inAutoType = false; diff --git a/tests/TestAutoType.cpp b/tests/TestAutoType.cpp index 2fb533595..47ac0909b 100644 --- a/tests/TestAutoType.cpp +++ b/tests/TestAutoType.cpp @@ -28,6 +28,7 @@ #include "autotype/AutoType.h" #include "autotype/AutoTypePlatformPlugin.h" #include "autotype/test/AutoTypeTestInterface.h" +#include "gui/MessageBox.h" void TestAutoType::initTestCase() { @@ -101,6 +102,7 @@ void TestAutoType::testGlobalAutoTypeWithNoMatch() QList dbList; dbList.append(m_db); + MessageBox::setNextAnswer(QMessageBox::Ok); m_autoType->performGlobalAutoType(dbList); QCOMPARE(m_test->actionChars(), QString());