From 6e2581c2b085403a392cced300015666b464abd9 Mon Sep 17 00:00:00 2001 From: Patrick Sean Klein Date: Tue, 8 Oct 2024 23:02:30 +0100 Subject: [PATCH 1/2] Add option to disable opening a browser window when double-clicking the "URL" column in EntryView.cpp --- src/core/Config.cpp | 1 + src/core/Config.h | 1 + src/gui/ApplicationSettingsWidget.cpp | 2 ++ src/gui/ApplicationSettingsWidgetGeneral.ui | 13 ++++++++++--- src/gui/DatabaseWidget.cpp | 12 +++++++----- 5 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/core/Config.cpp b/src/core/Config.cpp index a38b307be7..108bbe88c0 100644 --- a/src/core/Config.cpp +++ b/src/core/Config.cpp @@ -66,6 +66,7 @@ static const QHash configStrings = { {Config::UseDirectWriteSaves,{QS("UseDirectWriteSaves"), Local, false}}, {Config::SearchLimitGroup,{QS("SearchLimitGroup"), Roaming, false}}, {Config::MinimizeOnOpenUrl,{QS("MinimizeOnOpenUrl"), Roaming, false}}, + {Config::OpenURLOnDoubleClick, {QS("OpenURLOnDoubleClick"), Roaming, true}}, {Config::HideWindowOnCopy,{QS("HideWindowOnCopy"), Roaming, false}}, {Config::MinimizeOnCopy,{QS("MinimizeOnCopy"), Roaming, true}}, {Config::MinimizeAfterUnlock,{QS("MinimizeAfterUnlock"), Roaming, false}}, diff --git a/src/core/Config.h b/src/core/Config.h index 0f39beafb8..5179b49d7b 100644 --- a/src/core/Config.h +++ b/src/core/Config.h @@ -49,6 +49,7 @@ class Config : public QObject UseDirectWriteSaves, SearchLimitGroup, MinimizeOnOpenUrl, + OpenURLOnDoubleClick, HideWindowOnCopy, MinimizeOnCopy, MinimizeAfterUnlock, diff --git a/src/gui/ApplicationSettingsWidget.cpp b/src/gui/ApplicationSettingsWidget.cpp index 27f27eb6d3..ca7c5fd665 100644 --- a/src/gui/ApplicationSettingsWidget.cpp +++ b/src/gui/ApplicationSettingsWidget.cpp @@ -225,6 +225,7 @@ void ApplicationSettingsWidget::loadSettings() m_generalUi->autoReloadOnChangeCheckBox->setChecked(config()->get(Config::AutoReloadOnChange).toBool()); m_generalUi->minimizeAfterUnlockCheckBox->setChecked(config()->get(Config::MinimizeAfterUnlock).toBool()); m_generalUi->minimizeOnOpenUrlCheckBox->setChecked(config()->get(Config::MinimizeOnOpenUrl).toBool()); + m_generalUi->openUrlOnDoubleClick->setChecked(config()->get(Config::OpenURLOnDoubleClick).toBool()); m_generalUi->hideWindowOnCopyCheckBox->setChecked(config()->get(Config::HideWindowOnCopy).toBool()); hideWindowOnCopyCheckBoxToggled(m_generalUi->hideWindowOnCopyCheckBox->isChecked()); m_generalUi->minimizeOnCopyRadioButton->setChecked(config()->get(Config::MinimizeOnCopy).toBool()); @@ -382,6 +383,7 @@ void ApplicationSettingsWidget::saveSettings() config()->set(Config::AutoReloadOnChange, m_generalUi->autoReloadOnChangeCheckBox->isChecked()); config()->set(Config::MinimizeAfterUnlock, m_generalUi->minimizeAfterUnlockCheckBox->isChecked()); config()->set(Config::MinimizeOnOpenUrl, m_generalUi->minimizeOnOpenUrlCheckBox->isChecked()); + config()->set(Config::OpenURLOnDoubleClick, m_generalUi->openUrlOnDoubleClick->isChecked()); config()->set(Config::HideWindowOnCopy, m_generalUi->hideWindowOnCopyCheckBox->isChecked()); config()->set(Config::MinimizeOnCopy, m_generalUi->minimizeOnCopyRadioButton->isChecked()); config()->set(Config::DropToBackgroundOnCopy, m_generalUi->dropToBackgroundOnCopyRadioButton->isChecked()); diff --git a/src/gui/ApplicationSettingsWidgetGeneral.ui b/src/gui/ApplicationSettingsWidgetGeneral.ui index 6e74205ff3..01000ef4f3 100644 --- a/src/gui/ApplicationSettingsWidgetGeneral.ui +++ b/src/gui/ApplicationSettingsWidgetGeneral.ui @@ -57,9 +57,9 @@ 0 - 0 - 568 - 1153 + -419 + 573 + 1397 @@ -560,6 +560,13 @@ + + + + Double clicking "URL" column opens a browser window + + + diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp index 8ec29b9513..c106362897 100644 --- a/src/gui/DatabaseWidget.cpp +++ b/src/gui/DatabaseWidget.cpp @@ -1495,11 +1495,6 @@ void DatabaseWidget::entryActivationSignalReceived(Entry* entry, EntryModel::Mod switchToEntryEdit(entry); } break; - case EntryModel::Url: - if (!entry->url().isEmpty()) { - openUrlForEntry(entry); - } - break; case EntryModel::Totp: if (entry->hasTotp()) { setClipboardTextAndMinimize(entry->totp()); @@ -1520,6 +1515,13 @@ void DatabaseWidget::entryActivationSignalReceived(Entry* entry, EntryModel::Mod // TODO: switch to 'Attachments' tab in details view/pane // case EntryModel::Attachments: // break; + case EntryModel::Url: + if (!entry->url().isEmpty() && config()->get(Config::OpenURLOnDoubleClick).toBool()) { + openUrlForEntry(entry); + break; + } + // Note, order matters here. We want to fall into the default case. + [[fallthrough]]; default: switchToEntryEdit(entry); } From 9642ea2cf91de548d3328a7b5bc147ffd49429be Mon Sep 17 00:00:00 2001 From: Patrick Sean Klein Date: Tue, 8 Oct 2024 23:22:13 +0100 Subject: [PATCH 2/2] Move and rename option in ApplicationSettings. --- share/translations/keepassxc_en.ts | 4 ++++ src/gui/ApplicationSettingsWidgetGeneral.ui | 16 ++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/share/translations/keepassxc_en.ts b/share/translations/keepassxc_en.ts index daaa67606e..0ee054f6ef 100644 --- a/share/translations/keepassxc_en.ts +++ b/share/translations/keepassxc_en.ts @@ -541,6 +541,10 @@ Export settingsā€¦ + + Open browser on double clicking URL field in entry view + + ApplicationSettingsWidgetSecurity diff --git a/src/gui/ApplicationSettingsWidgetGeneral.ui b/src/gui/ApplicationSettingsWidgetGeneral.ui index 01000ef4f3..25a993b237 100644 --- a/src/gui/ApplicationSettingsWidgetGeneral.ui +++ b/src/gui/ApplicationSettingsWidgetGeneral.ui @@ -544,9 +544,9 @@ - + - Use group icon on entry creation + Open browser on double clicking URL field in entry view true @@ -554,16 +554,19 @@ - + - Minimize when opening a URL + Use group icon on entry creation + + + true - + - Double clicking "URL" column opens a browser window + Minimize when opening a URL @@ -1358,6 +1361,7 @@ alternativeSaveComboBox ConfirmMoveEntryToRecycleBinCheckBox EnableCopyOnDoubleClickCheckBox + openUrlOnDoubleClick useGroupIconOnEntryCreationCheckBox minimizeOnOpenUrlCheckBox hideWindowOnCopyCheckBox