aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/keygen/SubkeyGenerateDialog.cpp
diff options
context:
space:
mode:
authorSaturneric <[email protected]>2021-11-28 07:29:39 +0000
committerSaturneric <[email protected]>2021-11-28 07:29:39 +0000
commitc5918a7245b6124916799c0345026ef3ec02265e (patch)
treefa4ba76fc21570f88cd7c94f28f4a0d54e7051ca /src/ui/keygen/SubkeyGenerateDialog.cpp
parentCan be compiled with minimal UI support. (diff)
downloadGpgFrontend-c5918a7245b6124916799c0345026ef3ec02265e.tar.gz
GpgFrontend-c5918a7245b6124916799c0345026ef3ec02265e.zip
Solve key generation and related update issues.
Diffstat (limited to 'src/ui/keygen/SubkeyGenerateDialog.cpp')
-rw-r--r--src/ui/keygen/SubkeyGenerateDialog.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/ui/keygen/SubkeyGenerateDialog.cpp b/src/ui/keygen/SubkeyGenerateDialog.cpp
index 1da37393..41bc36c9 100644
--- a/src/ui/keygen/SubkeyGenerateDialog.cpp
+++ b/src/ui/keygen/SubkeyGenerateDialog.cpp
@@ -26,6 +26,7 @@
#include "gpg/function/GpgKeyGetter.h"
#include "gpg/function/GpgKeyOpera.h"
+#include "ui/SignalStation.h"
#include "ui/WaitingDialog.h"
namespace GpgFrontend::UI {
@@ -50,10 +51,12 @@ SubkeyGenerateDialog::SubkeyGenerateDialog(const KeyId& key_id, QWidget* parent)
vbox2->addWidget(buttonBox);
this->setWindowTitle(tr("Generate New Subkey"));
-
this->setLayout(vbox2);
this->setModal(true);
+ connect(this, SIGNAL(SubKeyGenerated()), SignalStation::GetInstance(),
+ SIGNAL(KeyDatabaseRefresh()));
+
set_signal_slot();
refresh_widgets_state();
}
@@ -233,8 +236,9 @@ void SubkeyGenerateDialog::slotKeyGenAccept() {
.date());
}
- gpgme_error_t error = false;
+ GpgError error;
auto thread = QThread::create([&]() {
+ LOG(INFO) << "SubkeyGenerateDialog::slotKeyGenAccept() Thread Started";
error = GpgKeyOpera::GetInstance().GenerateSubkey(mKey, genKeyInfo);
});
thread->start();
@@ -245,12 +249,18 @@ void SubkeyGenerateDialog::slotKeyGenAccept() {
while (thread->isRunning()) {
QCoreApplication::processEvents();
}
-
dialog->close();
- if (gpgme_err_code(error) == GPG_ERR_NO_ERROR) {
- QMessageBox::information(nullptr, tr("Success"),
- tr("The new subkey has been generated."));
+ if (check_gpg_error_2_err_code(error) == GPG_ERR_NO_ERROR) {
+ auto* msg_box = new QMessageBox(nullptr);
+ msg_box->setAttribute(Qt::WA_DeleteOnClose);
+ msg_box->setStandardButtons(QMessageBox::Ok);
+ msg_box->setWindowTitle(tr("Success"));
+ msg_box->setText(tr("The new subkey has been generated."));
+ msg_box->setModal(false);
+ msg_box->open();
+
+ emit SubKeyGenerated();
this->close();
} else
QMessageBox::critical(this, tr("Failure"), tr(gpgme_strerror(error)));