diff options
author | saturneric <[email protected]> | 2024-01-17 11:39:47 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2024-01-17 11:39:47 +0000 |
commit | e352e8e6b8d03a24ef5d52eef3e4d370807b5bbd (patch) | |
tree | 9a59f0b573a845644afe4b8857a89c4b28bdcc0d /src/ui/dialog/key_generate/KeygenDialog.cpp | |
parent | fix: solve the gnupg tab options info not shown issue (diff) | |
download | GpgFrontend-e352e8e6b8d03a24ef5d52eef3e4d370807b5bbd.tar.gz GpgFrontend-e352e8e6b8d03a24ef5d52eef3e4d370807b5bbd.zip |
fix: find and slove some bugs
Diffstat (limited to 'src/ui/dialog/key_generate/KeygenDialog.cpp')
-rw-r--r-- | src/ui/dialog/key_generate/KeygenDialog.cpp | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/ui/dialog/key_generate/KeygenDialog.cpp b/src/ui/dialog/key_generate/KeygenDialog.cpp index ad9c7a54..0f6c19d8 100644 --- a/src/ui/dialog/key_generate/KeygenDialog.cpp +++ b/src/ui/dialog/key_generate/KeygenDialog.cpp @@ -28,15 +28,12 @@ #include "KeygenDialog.h" -#include <qdialog.h> -#include <qeventloop.h> -#include <qobject.h> - #include "core/GpgModel.h" #include "core/function/GlobalSettingStation.h" #include "core/function/gpg/GpgKeyOpera.h" #include "core/model/DataObject.h" #include "core/typedef/GpgTypedef.h" +#include "core/utils/CacheUtils.h" #include "core/utils/GpgUtils.h" #include "ui/UISignalStation.h" #include "ui/UserInterfaceUtils.h" @@ -142,6 +139,14 @@ void KeyGenDialog::slot_key_gen_accept() { } } + if (!GlobalSettingStation::GetInstance() + .GetSettings() + .value("basic/use_pinentry_as_password_input_dialog", false) + .toBool() && + !no_pass_phrase_check_box_->isChecked()) { + SetCacheValue("PinentryContext", "NEW_PASSPHRASE"); + } + CommonUtils::WaitForOpera( this, tr("Generating"), [this, gen_key_info = this->gen_key_info_](const OperaWaitingHd& hd) { @@ -151,6 +156,12 @@ void KeyGenDialog::slot_key_gen_accept() { // stop showing waiting dialog hd(); + if (CheckGpgError(err) == GPG_ERR_USER_1) { + QMessageBox::critical(this, tr("Error"), + tr("Unknown error occurred")); + return; + } + CommonUtils::RaiseMessageBox(this->parentWidget() != nullptr ? this->parentWidget() : this, @@ -253,6 +264,8 @@ void KeyGenDialog::slot_activated_key_type(int index) { const auto [name, key_algo, subkey_algo] = gen_key_info_->GetSupportedKeyAlgo()[index]; + GF_UI_LOG_DEBUG("target key algo changed, name: {}, key: {}, subkey: {}", + name, key_algo, subkey_algo); assert(!key_algo.isEmpty()); gen_key_info_->SetAlgo(key_algo); @@ -261,7 +274,6 @@ void KeyGenDialog::slot_activated_key_type(int index) { if (gen_subkey_info_ == nullptr) { gen_subkey_info_ = SecureCreateSharedObject<GenKeyInfo>(true); } - gen_subkey_info_->SetAlgo(subkey_algo); } else { gen_subkey_info_ = nullptr; |