diff --git a/src/browser/BrowserOptionDialog.cpp b/src/browser/BrowserOptionDialog.cpp
index e212fc6b4..29fa1b2e1 100644
--- a/src/browser/BrowserOptionDialog.cpp
+++ b/src/browser/BrowserOptionDialog.cpp
@@ -116,6 +116,7 @@ void BrowserOptionDialog::loadSettings()
m_ui->httpAuthPermission->setChecked(settings->httpAuthPermission());
m_ui->searchInAllDatabases->setChecked(settings->searchInAllDatabases());
m_ui->supportKphFields->setChecked(settings->supportKphFields());
+ m_ui->noMigrationPrompt->setChecked(settings->noMigrationPrompt());
m_ui->supportBrowserProxy->setChecked(settings->supportBrowserProxy());
m_ui->useCustomProxy->setChecked(settings->useCustomProxy());
m_ui->customProxyLocation->setText(settings->customProxyLocation());
@@ -183,6 +184,7 @@ void BrowserOptionDialog::saveSettings()
settings->setHttpAuthPermission(m_ui->httpAuthPermission->isChecked());
settings->setSearchInAllDatabases(m_ui->searchInAllDatabases->isChecked());
settings->setSupportKphFields(m_ui->supportKphFields->isChecked());
+ settings->setNoMigrationPrompt(m_ui->noMigrationPrompt->isChecked());
settings->setChromeSupport(m_ui->chromeSupport->isChecked());
settings->setChromiumSupport(m_ui->chromiumSupport->isChecked());
diff --git a/src/browser/BrowserOptionDialog.ui b/src/browser/BrowserOptionDialog.ui
index bb87efcf2..3466100a3 100755
--- a/src/browser/BrowserOptionDialog.ui
+++ b/src/browser/BrowserOptionDialog.ui
@@ -321,6 +321,16 @@
+ -
+
+
+ Don't display the popup suggesting migration of legacy KeePassHTTP settings.
+
+
+ &Do not prompt for KeePassHTTP settings migration.
+
+
+
-
diff --git a/src/browser/BrowserService.cpp b/src/browser/BrowserService.cpp
index 94c89526c..f8e9f0371 100644
--- a/src/browser/BrowserService.cpp
+++ b/src/browser/BrowserService.cpp
@@ -22,6 +22,7 @@
#include
#include
#include
+#include
#include "BrowserAccessControlDialog.h"
#include "BrowserEntryConfig.h"
@@ -1070,7 +1071,7 @@ int BrowserService::moveKeysToCustomData(Entry* entry, const QSharedPointerisEnabled()) {
+ if (!browserSettings()->isEnabled() || browserSettings()->noMigrationPrompt()) {
return false;
}
@@ -1093,13 +1094,21 @@ bool BrowserService::checkLegacySettings()
return false;
}
+ auto* checkbox = new QCheckBox(tr("Don't show this warning again"));
+ QObject::connect(checkbox, &QCheckBox::stateChanged, [&](int state) {
+ browserSettings()->setNoMigrationPrompt(static_cast(state) == Qt::CheckState::Checked);
+ });
+
auto dialogResult =
MessageBox::warning(nullptr,
tr("KeePassXC: Legacy browser integration settings detected"),
tr("Your KeePassXC-Browser settings need to be moved into the database settings.\n"
"This is necessary to maintain your current browser connections.\n"
"Would you like to migrate your existing settings now?"),
- MessageBox::Yes | MessageBox::No);
+ MessageBox::Yes | MessageBox::No,
+ MessageBox::NoButton,
+ MessageBox::Raise,
+ checkbox);
return dialogResult == MessageBox::Yes;
}
diff --git a/src/browser/BrowserSettings.cpp b/src/browser/BrowserSettings.cpp
index a284488e5..046734268 100644
--- a/src/browser/BrowserSettings.cpp
+++ b/src/browser/BrowserSettings.cpp
@@ -151,6 +151,16 @@ void BrowserSettings::setSupportKphFields(bool supportKphFields)
config()->set("Browser/SupportKphFields", supportKphFields);
}
+bool BrowserSettings::noMigrationPrompt()
+{
+ return config()->get("Browser/NoMigrationPrompt", false).toBool();
+}
+
+void BrowserSettings::setNoMigrationPrompt(bool prompt)
+{
+ config()->set("Browser/NoMigrationPrompt", prompt);
+}
+
bool BrowserSettings::supportBrowserProxy()
{
return config()->get("Browser/SupportBrowserProxy", true).toBool();
diff --git a/src/browser/BrowserSettings.h b/src/browser/BrowserSettings.h
index bc8f2de18..0fa2359ee 100644
--- a/src/browser/BrowserSettings.h
+++ b/src/browser/BrowserSettings.h
@@ -55,6 +55,8 @@ public:
void setHttpAuthPermission(bool httpAuthPermission);
bool supportKphFields();
void setSupportKphFields(bool supportKphFields);
+ bool noMigrationPrompt();
+ void setNoMigrationPrompt(bool prompt);
bool supportBrowserProxy();
void setSupportBrowserProxy(bool enabled);
diff --git a/src/gui/MessageBox.cpp b/src/gui/MessageBox.cpp
index 938228731..7652d6345 100644
--- a/src/gui/MessageBox.cpp
+++ b/src/gui/MessageBox.cpp
@@ -19,6 +19,7 @@
#include "MessageBox.h"
#include
+#include
QWindow* MessageBox::m_overrideParent(nullptr);
@@ -77,7 +78,8 @@ MessageBox::Button MessageBox::messageBox(QWidget* parent,
const QString& text,
MessageBox::Buttons buttons,
MessageBox::Button defaultButton,
- MessageBox::Action action)
+ MessageBox::Action action,
+ QCheckBox* checkbox)
{
if (m_nextAnswer == MessageBox::NoButton) {
QMessageBox msgBox(parent);
@@ -110,6 +112,11 @@ MessageBox::Button MessageBox::messageBox(QWidget* parent,
}
}
+ if (checkbox) {
+ checkbox->setParent(&msgBox);
+ msgBox.setCheckBox(checkbox);
+ }
+
if (action == MessageBox::Raise) {
msgBox.setWindowFlags(Qt::WindowStaysOnTopHint);
msgBox.activateWindow();
@@ -133,9 +140,10 @@ MessageBox::Button MessageBox::critical(QWidget* parent,
const QString& text,
MessageBox::Buttons buttons,
MessageBox::Button defaultButton,
- MessageBox::Action action)
+ MessageBox::Action action,
+ QCheckBox* checkbox)
{
- return messageBox(parent, QMessageBox::Critical, title, text, buttons, defaultButton, action);
+ return messageBox(parent, QMessageBox::Critical, title, text, buttons, defaultButton, action, checkbox);
}
MessageBox::Button MessageBox::information(QWidget* parent,
@@ -143,9 +151,10 @@ MessageBox::Button MessageBox::information(QWidget* parent,
const QString& text,
MessageBox::Buttons buttons,
MessageBox::Button defaultButton,
- MessageBox::Action action)
+ MessageBox::Action action,
+ QCheckBox* checkbox)
{
- return messageBox(parent, QMessageBox::Information, title, text, buttons, defaultButton, action);
+ return messageBox(parent, QMessageBox::Information, title, text, buttons, defaultButton, action, checkbox);
}
MessageBox::Button MessageBox::question(QWidget* parent,
@@ -153,9 +162,10 @@ MessageBox::Button MessageBox::question(QWidget* parent,
const QString& text,
MessageBox::Buttons buttons,
MessageBox::Button defaultButton,
- MessageBox::Action action)
+ MessageBox::Action action,
+ QCheckBox* checkbox)
{
- return messageBox(parent, QMessageBox::Question, title, text, buttons, defaultButton, action);
+ return messageBox(parent, QMessageBox::Question, title, text, buttons, defaultButton, action, checkbox);
}
MessageBox::Button MessageBox::warning(QWidget* parent,
@@ -163,9 +173,10 @@ MessageBox::Button MessageBox::warning(QWidget* parent,
const QString& text,
MessageBox::Buttons buttons,
MessageBox::Button defaultButton,
- MessageBox::Action action)
+ MessageBox::Action action,
+ QCheckBox* checkbox)
{
- return messageBox(parent, QMessageBox::Warning, title, text, buttons, defaultButton, action);
+ return messageBox(parent, QMessageBox::Warning, title, text, buttons, defaultButton, action, checkbox);
}
void MessageBox::setNextAnswer(MessageBox::Button button)
diff --git a/src/gui/MessageBox.h b/src/gui/MessageBox.h
index 59852431b..13deffb62 100644
--- a/src/gui/MessageBox.h
+++ b/src/gui/MessageBox.h
@@ -81,25 +81,29 @@ public:
const QString& text,
Buttons buttons = MessageBox::Ok,
Button defaultButton = MessageBox::NoButton,
- Action action = MessageBox::None);
+ Action action = MessageBox::None,
+ QCheckBox* checkbox = nullptr);
static Button information(QWidget* parent,
const QString& title,
const QString& text,
Buttons buttons = MessageBox::Ok,
Button defaultButton = MessageBox::NoButton,
- Action action = MessageBox::None);
+ Action action = MessageBox::None,
+ QCheckBox* checkbox = nullptr);
static Button question(QWidget* parent,
const QString& title,
const QString& text,
Buttons buttons = MessageBox::Ok,
Button defaultButton = MessageBox::NoButton,
- Action action = MessageBox::None);
+ Action action = MessageBox::None,
+ QCheckBox* checkbox = nullptr);
static Button warning(QWidget* parent,
const QString& title,
const QString& text,
Buttons buttons = MessageBox::Ok,
Button defaultButton = MessageBox::NoButton,
- Action action = MessageBox::None);
+ Action action = MessageBox::None,
+ QCheckBox* checkbox = nullptr);
class OverrideParent
{
@@ -123,7 +127,8 @@ private:
const QString& text,
Buttons buttons = MessageBox::Ok,
Button defaultButton = MessageBox::NoButton,
- Action action = MessageBox::None);
+ Action action = MessageBox::None,
+ QCheckBox* checkbox = nullptr);
static QString stdButtonText(QMessageBox::StandardButton button);
};