aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/dialog/controller/GnuPGControllerDialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/dialog/controller/GnuPGControllerDialog.cpp')
-rw-r--r--src/ui/dialog/controller/GnuPGControllerDialog.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/ui/dialog/controller/GnuPGControllerDialog.cpp b/src/ui/dialog/controller/GnuPGControllerDialog.cpp
index fe334e45..72e9c276 100644
--- a/src/ui/dialog/controller/GnuPGControllerDialog.cpp
+++ b/src/ui/dialog/controller/GnuPGControllerDialog.cpp
@@ -272,7 +272,9 @@ void GnuPGControllerDialog::set_settings() {
buffered_key_db_so_ = GetGpgKeyDatabaseInfos();
editable_key_db_so_ = buffered_key_db_so_;
- editable_key_db_so_.pop_front();
+ if (!editable_key_db_so_.isEmpty()) {
+ editable_key_db_so_.pop_front();
+ }
this->slot_refresh_key_database_table();
}
@@ -380,7 +382,9 @@ void GnuPGControllerDialog::slot_add_new_key_database() {
key_databases.append(key_database);
editable_key_db_so_ = buffered_key_db_so_;
- editable_key_db_so_.pop_front();
+ if (!editable_key_db_so_.isEmpty()) {
+ editable_key_db_so_.pop_front();
+ }
// refresh ui
slot_refresh_key_database_table();
@@ -429,6 +433,16 @@ void GnuPGControllerDialog::slot_remove_existing_key_database() {
for (int i = 0; i < row_size; i++) {
auto* const item = ui_->keyDatabaseTable->item(i, 1);
if (!item->isSelected()) continue;
+
+ QMessageBox::StandardButton reply = QMessageBox::question(
+ this, tr("Confirm Deletion"),
+ tr("Are you sure you want to delete the selected key database?"),
+ QMessageBox::Yes | QMessageBox::No);
+
+ if (reply != QMessageBox::Yes) {
+ return;
+ }
+
key_databases.remove(i);
break;
}