From 0b9167c78bd59856f6834e213c32850e6dd4e7e6 Mon Sep 17 00:00:00 2001 From: Felix Geyer Date: Mon, 7 Apr 2014 08:45:11 +0200 Subject: [PATCH] Add an option to always ask before performing auto-type. Closes #120 --- src/autotype/AutoType.cpp | 3 ++- src/core/Config.cpp | 1 + src/gui/SettingsWidget.cpp | 4 ++++ src/gui/SettingsWidgetSecurity.ui | 7 +++++++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/autotype/AutoType.cpp b/src/autotype/AutoType.cpp index 5c28b4d66..1455e971c 100644 --- a/src/autotype/AutoType.cpp +++ b/src/autotype/AutoType.cpp @@ -23,6 +23,7 @@ #include "autotype/AutoTypePlatformPlugin.h" #include "autotype/AutoTypeSelectDialog.h" #include "autotype/WildcardMatcher.h" +#include "core/Config.h" #include "core/Database.h" #include "core/Entry.h" #include "core/FilePath.h" @@ -189,7 +190,7 @@ void AutoType::performGlobalAutoType(const QList& dbList) if (entryList.isEmpty()) { m_inAutoType = false; } - else if (entryList.size() == 1) { + else if ((entryList.size() == 1) && !config()->get("security/autotypeask").toBool()) { m_inAutoType = false; performAutoType(entryList.first(), Q_NULLPTR, sequenceHash[entryList.first()]); } diff --git a/src/core/Config.cpp b/src/core/Config.cpp index 3cb763408..5bd7ab674 100644 --- a/src/core/Config.cpp +++ b/src/core/Config.cpp @@ -99,6 +99,7 @@ void Config::init(const QString& fileName) m_defaults.insert("security/lockdatabaseidle", false); m_defaults.insert("security/lockdatabaseidlesec", 10); m_defaults.insert("security/passwordscleartext", false); + m_defaults.insert("security/autotypeask", false); } Config* Config::instance() diff --git a/src/gui/SettingsWidget.cpp b/src/gui/SettingsWidget.cpp index d8516c6d5..05ffdf151 100644 --- a/src/gui/SettingsWidget.cpp +++ b/src/gui/SettingsWidget.cpp @@ -83,6 +83,8 @@ void SettingsWidget::loadSettings() m_secUi->passwordCleartextCheckBox->setChecked(config()->get("security/passwordscleartext").toBool()); + m_secUi->autoTypeAskCheckBox->setChecked(config()->get("security/autotypeask").toBool()); + setCurrentRow(0); } @@ -110,6 +112,8 @@ void SettingsWidget::saveSettings() config()->set("security/passwordscleartext", m_secUi->passwordCleartextCheckBox->isChecked()); + config()->set("security/autotypeask", m_secUi->autoTypeAskCheckBox->isChecked()); + Q_EMIT editFinished(true); } diff --git a/src/gui/SettingsWidgetSecurity.ui b/src/gui/SettingsWidgetSecurity.ui index c2a6cccc6..b52e86238 100644 --- a/src/gui/SettingsWidgetSecurity.ui +++ b/src/gui/SettingsWidgetSecurity.ui @@ -64,6 +64,13 @@ + + + + Always ask before performing auto-type + + +