Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/keepassxreboot/keepassxc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/dbsettings/DatabaseSettingsWidgetMasterKey.cpp')
-rw-r--r--src/gui/dbsettings/DatabaseSettingsWidgetMasterKey.cpp29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/gui/dbsettings/DatabaseSettingsWidgetMasterKey.cpp b/src/gui/dbsettings/DatabaseSettingsWidgetMasterKey.cpp
index ed22244c7..a58ee701f 100644
--- a/src/gui/dbsettings/DatabaseSettingsWidgetMasterKey.cpp
+++ b/src/gui/dbsettings/DatabaseSettingsWidgetMasterKey.cpp
@@ -155,7 +155,21 @@ bool DatabaseSettingsWidgetMasterKey::save()
}
}
- if (!addToCompositeKey(m_passwordEditWidget, newKey, oldPasswordKey)) {
+ if (m_passwordEditWidget->visiblePage() == KeyComponentWidget::Page::AddNew || m_passwordEditWidget->isEmpty()) {
+ QScopedPointer<QMessageBox> msgBox(new QMessageBox(this));
+ msgBox->setIcon(QMessageBox::Warning);
+ msgBox->setWindowTitle(tr("No password set"));
+ msgBox->setText(tr("WARNING! You have not set a password. Using a database without "
+ "a password is strongly discouraged!\n\n"
+ "Are you sure you want to continue without a password?"));
+ auto btn = msgBox->addButton(tr("Continue without password"), QMessageBox::ButtonRole::AcceptRole);
+ msgBox->addButton(QMessageBox::Cancel);
+ msgBox->setDefaultButton(QMessageBox::Cancel);
+ msgBox->exec();
+ if (msgBox->clickedButton() != btn) {
+ return false;
+ }
+ } else if (!addToCompositeKey(m_passwordEditWidget, newKey, oldPasswordKey)) {
return false;
}
@@ -178,19 +192,6 @@ bool DatabaseSettingsWidgetMasterKey::save()
return false;
}
- if (m_passwordEditWidget->isEmpty()) {
- auto answer = MessageBox::warning(this,
- tr("No password set"),
- tr("WARNING! You have not set a password. Using a database without "
- "a password is strongly discouraged!\n\n"
- "Are you sure you want to continue without a password?"),
- MessageBox::Yes | MessageBox::Cancel,
- MessageBox::Cancel);
- if (answer != MessageBox::Yes) {
- return false;
- }
- }
-
m_db->setKey(newKey, true, false, false);
emit editFinished(true);