From ceeeee3d76a5736772150fa1adb00e30f3c6459b Mon Sep 17 00:00:00 2001 From: Toni Spets Date: Wed, 28 Jun 2017 19:22:59 +0300 Subject: [PATCH] Split auto-type title and URL matching into separate options --- src/autotype/AutoType.cpp | 9 +++++++-- src/core/Config.cpp | 1 + src/gui/SettingsWidget.cpp | 3 +++ src/gui/SettingsWidgetGeneral.ui | 9 ++++++++- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/autotype/AutoType.cpp b/src/autotype/AutoType.cpp index 927d6822b..47efeb1ca 100644 --- a/src/autotype/AutoType.cpp +++ b/src/autotype/AutoType.cpp @@ -576,8 +576,13 @@ QString AutoType::autoTypeSequence(const Entry* entry, const QString& windowTitl } if (!match && config()->get("AutoTypeEntryTitleMatch").toBool() - && (windowMatchesTitle(windowTitle, entry->resolvePlaceholder(entry->title())) - || windowMatchesUrl(windowTitle, entry->resolvePlaceholder(entry->url())))) { + && windowMatchesTitle(windowTitle, entry->resolvePlaceholder(entry->title()))) { + sequence = entry->defaultAutoTypeSequence(); + match = true; + } + + if (!match && config()->get("AutoTypeEntryURLMatch").toBool() + && windowMatchesUrl(windowTitle, entry->resolvePlaceholder(entry->url()))) { sequence = entry->defaultAutoTypeSequence(); match = true; } diff --git a/src/core/Config.cpp b/src/core/Config.cpp index 8b266a845..675896d22 100644 --- a/src/core/Config.cpp +++ b/src/core/Config.cpp @@ -118,6 +118,7 @@ void Config::init(const QString& fileName) m_defaults.insert("MinimizeOnCopy", false); m_defaults.insert("UseGroupIconOnEntryCreation", false); m_defaults.insert("AutoTypeEntryTitleMatch", true); + m_defaults.insert("AutoTypeEntryURLMatch", true); m_defaults.insert("UseGroupIconOnEntryCreation", true); m_defaults.insert("IgnoreGroupExpansion", false); m_defaults.insert("security/clearclipboard", true); diff --git a/src/gui/SettingsWidget.cpp b/src/gui/SettingsWidget.cpp index 24d00b7d9..864a6365c 100644 --- a/src/gui/SettingsWidget.cpp +++ b/src/gui/SettingsWidget.cpp @@ -117,6 +117,7 @@ void SettingsWidget::loadSettings() m_generalUi->minimizeOnCopyCheckBox->setChecked(config()->get("MinimizeOnCopy").toBool()); m_generalUi->useGroupIconOnEntryCreationCheckBox->setChecked(config()->get("UseGroupIconOnEntryCreation").toBool()); m_generalUi->autoTypeEntryTitleMatchCheckBox->setChecked(config()->get("AutoTypeEntryTitleMatch").toBool()); + m_generalUi->autoTypeEntryURLMatchCheckBox->setChecked(config()->get("AutoTypeEntryURLMatch").toBool()); m_generalUi->ignoreGroupExpansionCheckBox->setChecked(config()->get("IgnoreGroupExpansion").toBool()); m_generalUi->languageComboBox->clear(); @@ -190,6 +191,8 @@ void SettingsWidget::saveSettings() m_generalUi->ignoreGroupExpansionCheckBox->isChecked()); config()->set("AutoTypeEntryTitleMatch", m_generalUi->autoTypeEntryTitleMatchCheckBox->isChecked()); + config()->set("AutoTypeEntryURLMatch", + m_generalUi->autoTypeEntryURLMatchCheckBox->isChecked()); int currentLangIndex = m_generalUi->languageComboBox->currentIndex(); config()->set("GUI/Language", m_generalUi->languageComboBox->itemData(currentLangIndex).toString()); diff --git a/src/gui/SettingsWidgetGeneral.ui b/src/gui/SettingsWidgetGeneral.ui index 2fe0f4089..e75631995 100644 --- a/src/gui/SettingsWidgetGeneral.ui +++ b/src/gui/SettingsWidgetGeneral.ui @@ -303,7 +303,14 @@ - Use entry title and URL to match windows for global Auto-Type + Use entry title to match windows for global Auto-Type + + + + + + + Use entry URL to match windows for global Auto-Type