From d6aa4d2e5058bccccb167087a10cc26fced8f561 Mon Sep 17 00:00:00 2001 From: saturneric Date: Sat, 19 Apr 2025 02:34:18 +0200 Subject: fix: solve found issues by testing --- resource/lfs/locale/ts/GpgFrontend.de_DE.ts | 133 +++++++++++++---------- resource/lfs/locale/ts/GpgFrontend.en_US.ts | 125 +++++++++++---------- resource/lfs/locale/ts/GpgFrontend.fr_FR.ts | 131 ++++++++++++---------- resource/lfs/locale/ts/GpgFrontend.it_IT.ts | 133 +++++++++++++---------- resource/lfs/locale/ts/GpgFrontend.zh_CN.ts | 133 +++++++++++++---------- resource/lfs/locale/ts/GpgFrontend.zh_TW.ts | 131 ++++++++++++---------- src/core/function/gpg/GpgAdvancedOperator.cpp | 9 +- src/core/function/gpg/GpgAdvancedOperator.h | 2 +- src/core/function/gpg/GpgAssuanHelper.cpp | 35 +++--- src/core/function/gpg/GpgAssuanHelper.h | 8 +- src/core/function/gpg/GpgComponentManager.cpp | 8 +- src/core/function/gpg/GpgComponentManager.h | 7 ++ src/ui/dialog/key_generate/KeyGenerateDialog.cpp | 1 + 13 files changed, 487 insertions(+), 369 deletions(-) diff --git a/resource/lfs/locale/ts/GpgFrontend.de_DE.ts b/resource/lfs/locale/ts/GpgFrontend.de_DE.ts index 5f3b0c5c..ce3ee6b0 100644 --- a/resource/lfs/locale/ts/GpgFrontend.de_DE.ts +++ b/resource/lfs/locale/ts/GpgFrontend.de_DE.ts @@ -546,62 +546,72 @@ GpgFrontend::UI::ADSKsPicker - + Confirm Bestätigen - + Cancel Abbrechen - + No Subkeys Selected Keine Unterschlüssel ausgewählt - + Please select at least one Subkey. Bitte wählen Sie mindestens einen Unterschlüssel aus. - + Select ADSK(s) ADSK(s) auswählen - + ADSK (Additional Decryption Subkey) allows others to encrypt data for you without having access to your private key. You are only allow to check subkeys with encryption capability. ADSK (zusätzlicher Entschlüsselungs-Unterschlüssel) ermöglicht es anderen, Daten für Sie zu verschlüsseln, ohne Zugriff auf Ihren privaten Schlüssel zu haben. Es können nur Unterschlüssel mit Verschlüsselungsfunktion ausgewählt werden. - + ADSKs Picker ADSK-Auswahl - + Key ID: %1 Reason: %2 Schlüssel-ID: %1 Grund: %2 - + + Unknown Error + Unbekannter Fehler + + + + Caught unknown error while exporting the key. + Beim Exportieren des Schlüssels ist ein unbekannter Fehler aufgetreten. + + + Failed Fehlgeschlagen - + Partially Failed Teilweise fehlgeschlagen - + Failed to add all selected subkeys. Alle ausgewählten Unterschlüssel konnten nicht hinzugefügt werden. - + Some subkeys failed to be added as ADSKs. Einige Unterschlüssel konnten nicht als ADSKs hinzugefügt werden. @@ -1854,67 +1864,67 @@ This will result in loss of all cached form positions, statuses, key servers, et - - + + Custom Benutzerdefiniert - + 3 Months 3 Monate - + 6 Months 6 Monate - + 1 Year 1 Jahr - - - + + + 2 Years 2 Jahre - + 5 Years 5 Jahre - + 10 Years 10 Jahre - - - + + + Non Expired Nicht abgelaufen - - + + Primary Key Only Nur Primärschlüssel - + Primary Key With Subkey Primärschlüssel mit Unterschlüssel @@ -1940,130 +1950,135 @@ This will result in loss of all cached form positions, statuses, key servers, et - - + + Algorithm Algorithmus - + Combination + + + + + Validity Period Gültigkeitsdauer - - + + Key Length Länge des Schlüssels - - + + Usage Verwendungszweck - - + + Encrypt Verschlüsseln - - + + Sign Unterschreiben - - + + Authentication Authentifizierung - + No Passphrase Keine Passphrase - + Expire Date Ablaufdatum - + Easy Mode Einfacher Modus - + Primary Key Primärschlüssel - + Subkey Unterschlüssel - + Generate Erstellen - - + + None Kein - + Generate Key Schlüssel erstellen - + Name must contain at least five characters. Der Name muss mindestens fünf Zeichen enthalten. - + Please give a valid email address. Bitte geben Sie eine gültige E-Mail Adresse an. - + Please give a valid primary key algorithm. Bitte geben Sie einen gültigen Primärschlüssel-Algorithmus an. - + Time to primary key expiration must not be less than 120 seconds. Die Zeit bis zum Ablauf des Primärschlüssels darf nicht weniger als 120 Sekunden betragen. - + Please give a valid subkey algorithm. Bitte geben Sie einen gültigen Unterschlüssel-Algorithmus an. - + Time to subkey expiration must not be less than 120 seconds. Die Zeit bis zum Ablauf des Unterschlüssels darf nicht weniger als 120 Sekunden betragen. - + Error Fehler - + Unknown error occurred Unbekannter Fehler ist aufgetreten - + Generating Erstellen diff --git a/resource/lfs/locale/ts/GpgFrontend.en_US.ts b/resource/lfs/locale/ts/GpgFrontend.en_US.ts index 8c1e8f24..045fb107 100644 --- a/resource/lfs/locale/ts/GpgFrontend.en_US.ts +++ b/resource/lfs/locale/ts/GpgFrontend.en_US.ts @@ -546,62 +546,72 @@ GpgFrontend::UI::ADSKsPicker - + Confirm - + Cancel - + No Subkeys Selected - + Please select at least one Subkey. - + Select ADSK(s) - + ADSK (Additional Decryption Subkey) allows others to encrypt data for you without having access to your private key. You are only allow to check subkeys with encryption capability. - + ADSKs Picker - + Key ID: %1 Reason: %2 - + + Unknown Error + + + + + Caught unknown error while exporting the key. + + + + Failed - + Partially Failed - + Failed to add all selected subkeys. - + Some subkeys failed to be added as ADSKs. @@ -1854,67 +1864,67 @@ This will result in loss of all cached form positions, statuses, key servers, et - - + + Custom - + 3 Months - + 6 Months - + 1 Year - - - + + + 2 Years - + 5 Years - + 10 Years - - - + + + Non Expired - - + + Primary Key Only - + Primary Key With Subkey @@ -1940,130 +1950,135 @@ This will result in loss of all cached form positions, statuses, key servers, et - - + + Algorithm - - Validity Period + Combination + - - Key Length + Validity Period - Usage + Key Length - Encrypt + Usage - Sign + Encrypt - Authentication + Sign + + Authentication + + + + No Passphrase - + Expire Date - + Easy Mode - + Primary Key - + Subkey - + Generate - - + + None - + Generate Key - + Name must contain at least five characters. - + Please give a valid email address. - + Please give a valid primary key algorithm. - + Time to primary key expiration must not be less than 120 seconds. - + Please give a valid subkey algorithm. - + Time to subkey expiration must not be less than 120 seconds. - + Error - + Unknown error occurred - + Generating diff --git a/resource/lfs/locale/ts/GpgFrontend.fr_FR.ts b/resource/lfs/locale/ts/GpgFrontend.fr_FR.ts index 74d57ad2..9914fb6b 100644 --- a/resource/lfs/locale/ts/GpgFrontend.fr_FR.ts +++ b/resource/lfs/locale/ts/GpgFrontend.fr_FR.ts @@ -546,62 +546,72 @@ GpgFrontend::UI::ADSKsPicker - + Confirm Confirmer - + Cancel Annuler - + No Subkeys Selected - + Please select at least one Subkey. - + Select ADSK(s) - + ADSK (Additional Decryption Subkey) allows others to encrypt data for you without having access to your private key. You are only allow to check subkeys with encryption capability. - + ADSKs Picker - + Key ID: %1 Reason: %2 - + + Unknown Error + + + + + Caught unknown error while exporting the key. + + + + Failed Échoué - + Partially Failed - + Failed to add all selected subkeys. - + Some subkeys failed to be added as ADSKs. @@ -1854,67 +1864,67 @@ This will result in loss of all cached form positions, statuses, key servers, et - - + + Custom - + 3 Months - + 6 Months - + 1 Year - - - + + + 2 Years - + 5 Years - + 10 Years - - - + + + Non Expired - - + + Primary Key Only - + Primary Key With Subkey @@ -1940,130 +1950,135 @@ This will result in loss of all cached form positions, statuses, key servers, et - - + + Algorithm Algorithme - - Validity Period + Combination + - - Key Length + Validity Period - Usage - Usage + Key Length + - Encrypt - Chiffrer + Usage + Usage - Sign - Signer + Encrypt + Chiffrer + Sign + Signer + + + + Authentication Authentification - + No Passphrase - + Expire Date Date d'expiration - + Easy Mode - + Primary Key Clé primaire - + Subkey Sous-clé - + Generate - - + + None - + Generate Key Générer la clé - + Name must contain at least five characters. Le nom doit contenir au moins cinq caractères. - + Please give a valid email address. - + Please give a valid primary key algorithm. - + Time to primary key expiration must not be less than 120 seconds. - + Please give a valid subkey algorithm. - + Time to subkey expiration must not be less than 120 seconds. - + Error Erreur - + Unknown error occurred Une erreur inconnue s'est produite - + Generating Générateur diff --git a/resource/lfs/locale/ts/GpgFrontend.it_IT.ts b/resource/lfs/locale/ts/GpgFrontend.it_IT.ts index 2db76daa..078883a8 100644 --- a/resource/lfs/locale/ts/GpgFrontend.it_IT.ts +++ b/resource/lfs/locale/ts/GpgFrontend.it_IT.ts @@ -546,62 +546,72 @@ GpgFrontend::UI::ADSKsPicker - + Confirm Conferma - + Cancel Annulla - + No Subkeys Selected - + Please select at least one Subkey. - + Select ADSK(s) - + ADSK (Additional Decryption Subkey) allows others to encrypt data for you without having access to your private key. You are only allow to check subkeys with encryption capability. - + ADSKs Picker - + Key ID: %1 Reason: %2 - + + Unknown Error + + + + + Caught unknown error while exporting the key. + + + + Failed Fallito - + Partially Failed - + Failed to add all selected subkeys. - + Some subkeys failed to be added as ADSKs. @@ -1863,67 +1873,67 @@ This will result in loss of all cached form positions, statuses, key servers, et - - + + Custom Impiego - + 3 Months 3 Mesi - + 6 Months 6 Mesi - + 1 Year 1 Anno - - - + + + 2 Years 2 Anni - + 5 Years 5 Anni - + 10 Years 10 Anni - - - + + + Non Expired Non Scaduto - - + + Primary Key Only Solo Chiave Primaria - + Primary Key With Subkey Chiave Primaria con Sottochiave @@ -1949,130 +1959,135 @@ This will result in loss of all cached form positions, statuses, key servers, et - - + + Algorithm Algoritmo - + Combination + + + + + Validity Period Periodo di validità - - + + Key Length Lunghezza Chiave - - + + Usage Utilizzo - - + + Encrypt Cifra - - + + Sign Firma - - + + Authentication Autenticazione - + No Passphrase Nessuna frase segreta - + Expire Date Data di scadenza - + Easy Mode Modalità facile - + Primary Key Chiave primaria - + Subkey Sottochiave - + Generate Generare - - + + None Nessuno - + Generate Key Genera chiave - + Name must contain at least five characters. Il nome deve contenere almeno cinque caratteri. - + Please give a valid email address. Inserisci un indirizzo email valido. - + Please give a valid primary key algorithm. Fornisci un algoritmo di chiave primaria valido. - + Time to primary key expiration must not be less than 120 seconds. Il tempo di scadenza della chiave primaria non deve essere inferiore a 120 secondi. - + Please give a valid subkey algorithm. Si prega di fornire un algoritmo di sottochiave valido. - + Time to subkey expiration must not be less than 120 seconds. Il tempo di scadenza della sottochiave non deve essere inferiore a 120 secondi. - + Error Errore - + Unknown error occurred Si è verificato un errore sconosciuto - + Generating Generazione diff --git a/resource/lfs/locale/ts/GpgFrontend.zh_CN.ts b/resource/lfs/locale/ts/GpgFrontend.zh_CN.ts index 6aa2789f..55da445e 100644 --- a/resource/lfs/locale/ts/GpgFrontend.zh_CN.ts +++ b/resource/lfs/locale/ts/GpgFrontend.zh_CN.ts @@ -546,62 +546,72 @@ GpgFrontend::UI::ADSKsPicker - + Confirm 确认 - + Cancel 取消 - + No Subkeys Selected 没有选择任何子密钥 - + Please select at least one Subkey. 请至少选择一个子密钥 - + Select ADSK(s) 选择 ADSK: - + ADSK (Additional Decryption Subkey) allows others to encrypt data for you without having access to your private key. You are only allow to check subkeys with encryption capability. ADSK(附加解密子密钥)允许他人为你加密数据,而无需访问你的私人密钥。您只能选中具有加密功能的子密钥。 - + ADSKs Picker ADSK选择器 - + Key ID: %1 Reason: %2 密钥ID: %1 原因: %2 - + + Unknown Error + 未知错误 + + + + Caught unknown error while exporting the key. + 在导出密钥的过程中发生错误。 + + + Failed 失败 - + Partially Failed 部分失败 - + Failed to add all selected subkeys. 无法添加任何选中的子密钥。 - + Some subkeys failed to be added as ADSKs. 无法添加选中的部分子密钥。 @@ -1854,67 +1864,67 @@ This will result in loss of all cached form positions, statuses, key servers, et - - + + Custom 自定义 - + 3 Months 3个月 - + 6 Months 6个月 - + 1 Year 1年 - - - + + + 2 Years 2年 - + 5 Years 5年 - + 10 Years 10年 - - - + + + Non Expired 不过期 - - + + Primary Key Only 仅主密钥 - + Primary Key With Subkey 主密钥附带子密钥 @@ -1940,130 +1950,135 @@ This will result in loss of all cached form positions, statuses, key servers, et - - + + Algorithm 算法 - + Combination + + + + + Validity Period 有效时长 - - + + Key Length 密钥长度 - - + + Usage 用法 - - + + Encrypt 加密 - - + + Sign 签名 - - + + Authentication 验证 - + No Passphrase 无密码 - + Expire Date 到期日期 - + Easy Mode 简单模式 - + Primary Key 主密钥 - + Subkey 子密钥 - + Generate 生成 - - + + None - + Generate Key 生成密钥 - + Name must contain at least five characters. 名称必须至少包含五个字符。 - + Please give a valid email address. 请使用一个有效的电子邮件地址。 - + Please give a valid primary key algorithm. 请选择一个有效的主密钥算法。 - + Time to primary key expiration must not be less than 120 seconds. 距离主密钥过期时间不得少于 120 秒。 - + Please give a valid subkey algorithm. 请选择一个有效的子密钥算法。 - + Time to subkey expiration must not be less than 120 seconds. 距离子密钥过期时间不得少于 120 秒。 - + Error 错误 - + Unknown error occurred 发生未知错误 - + Generating 生成中 diff --git a/resource/lfs/locale/ts/GpgFrontend.zh_TW.ts b/resource/lfs/locale/ts/GpgFrontend.zh_TW.ts index cdf7f23d..3a8388ae 100644 --- a/resource/lfs/locale/ts/GpgFrontend.zh_TW.ts +++ b/resource/lfs/locale/ts/GpgFrontend.zh_TW.ts @@ -546,62 +546,72 @@ GpgFrontend::UI::ADSKsPicker - + Confirm 確認 - + Cancel 取消 - + No Subkeys Selected - + Please select at least one Subkey. - + Select ADSK(s) - + ADSK (Additional Decryption Subkey) allows others to encrypt data for you without having access to your private key. You are only allow to check subkeys with encryption capability. - + ADSKs Picker - + Key ID: %1 Reason: %2 - + + Unknown Error + + + + + Caught unknown error while exporting the key. + + + + Failed 失敗 - + Partially Failed - + Failed to add all selected subkeys. - + Some subkeys failed to be added as ADSKs. @@ -1854,67 +1864,67 @@ This will result in loss of all cached form positions, statuses, key servers, et - - + + Custom - + 3 Months - + 6 Months - + 1 Year - - - + + + 2 Years - + 5 Years - + 10 Years - - - + + + Non Expired - - + + Primary Key Only - + Primary Key With Subkey @@ -1940,130 +1950,135 @@ This will result in loss of all cached form positions, statuses, key servers, et - - + + Algorithm 算法 - - Validity Period + Combination + - - Key Length + Validity Period - Usage - 用法 + Key Length + - Encrypt - 加密 + Usage + 用法 - Sign - 標誌 + Encrypt + 加密 + Sign + 標誌 + + + + Authentication 驗證 - + No Passphrase - + Expire Date 到期日期 - + Easy Mode - + Primary Key 首要的關鍵 - + Subkey - + Generate - - + + None - + Generate Key 生成金鑰 - + Name must contain at least five characters. 名稱必須至少包含五個字符。 - + Please give a valid email address. - + Please give a valid primary key algorithm. - + Time to primary key expiration must not be less than 120 seconds. - + Please give a valid subkey algorithm. - + Time to subkey expiration must not be less than 120 seconds. - + Error 錯誤 - + Unknown error occurred - + Generating 生成 diff --git a/src/core/function/gpg/GpgAdvancedOperator.cpp b/src/core/function/gpg/GpgAdvancedOperator.cpp index d6323901..5e43d4d4 100644 --- a/src/core/function/gpg/GpgAdvancedOperator.cpp +++ b/src/core/function/gpg/GpgAdvancedOperator.cpp @@ -36,26 +36,29 @@ namespace GpgFrontend { auto GpgAdvancedOperator::ClearGpgPasswordCache() -> bool { - return info_.ReloadGpgAgent(); + return mgr_.ReloadGpgAgent(); } auto GpgAdvancedOperator::ReloadAllGpgComponents() -> bool { - return info_.ReloadGpgAgent(); + return mgr_.ReloadGpgAgent(); } auto GpgAdvancedOperator::KillAllGpgComponents() -> bool { + mgr_.Reset(); return ctx_.RestartGpgAgent(); } auto GpgAdvancedOperator::ResetConfigures() -> bool { - return info_.ReloadGpgAgent(); + return mgr_.ReloadGpgAgent(); } auto GpgAdvancedOperator::LaunchAllGpgComponents() -> bool { + mgr_.Reset(); return ctx_.RestartGpgAgent(); } auto GpgAdvancedOperator::RestartGpgComponents() -> bool { + mgr_.Reset(); return ctx_.RestartGpgAgent(); } diff --git a/src/core/function/gpg/GpgAdvancedOperator.h b/src/core/function/gpg/GpgAdvancedOperator.h index e6934f42..48a2d755 100644 --- a/src/core/function/gpg/GpgAdvancedOperator.h +++ b/src/core/function/gpg/GpgAdvancedOperator.h @@ -100,7 +100,7 @@ class GPGFRONTEND_CORE_EXPORT GpgAdvancedOperator GpgCommandExecutor::GetInstance(SingletonFunctionObject::GetChannel()); GpgContext& ctx_ = GpgContext::GetInstance(SingletonFunctionObject::GetChannel()); - GpgComponentManager& info_ = + GpgComponentManager& mgr_ = GpgComponentManager::GetInstance(SingletonFunctionObject::GetChannel()); }; diff --git a/src/core/function/gpg/GpgAssuanHelper.cpp b/src/core/function/gpg/GpgAssuanHelper.cpp index a83c5655..b9ee63f1 100644 --- a/src/core/function/gpg/GpgAssuanHelper.cpp +++ b/src/core/function/gpg/GpgAssuanHelper.cpp @@ -38,11 +38,7 @@ GpgAssuanHelper::GpgAssuanHelper(int channel) gpgconf_path_(Module::RetrieveRTValueTypedOrDefault<>( "core", "gpgme.ctx.gpgconf_path", QString{})) {} -GpgAssuanHelper::~GpgAssuanHelper() { - for (const auto& ctx : assuan_ctx_) { - assuan_release(ctx); - } -} +GpgAssuanHelper::~GpgAssuanHelper() = default; auto GpgAssuanHelper::ConnectToSocket(GpgComponentType type) -> GpgError { if (assuan_ctx_.contains(type)) return GPG_ERR_NO_ERROR; @@ -70,10 +66,17 @@ auto GpgAssuanHelper::ConnectToSocket(GpgComponentType type) -> GpgError { } assuan_context_t a_ctx; - assuan_new(&a_ctx); + auto err = assuan_new(&a_ctx); + if (err != GPG_ERR_NO_ERROR) { + LOG_E() << "create assuan context failed, err:" << CheckGpgError(err); + return err; + } + + auto pa_ctx = QSharedPointer( + a_ctx, [](assuan_context_t p) { assuan_release(p); }); - auto err = assuan_socket_connect(a_ctx, info.absoluteFilePath().toUtf8(), - ASSUAN_INVALID_PID, 0); + err = assuan_socket_connect(pa_ctx.get(), info.absoluteFilePath().toUtf8(), + ASSUAN_INVALID_PID, 0); if (err != GPG_ERR_NO_ERROR) { LOG_W() << "failed to connect to socket:" << info.absoluteFilePath() << "err:" << CheckGpgError(err); @@ -83,14 +86,14 @@ auto GpgAssuanHelper::ConnectToSocket(GpgComponentType type) -> GpgError { LOG_D() << "connected to socket by assuan protocol: " << info.absoluteFilePath() << "channel:" << GetChannel(); - err = assuan_transact(a_ctx, "GETINFO pid", simple_data_callback, nullptr, - nullptr, nullptr, nullptr, nullptr); + err = assuan_transact(pa_ctx.get(), "GETINFO pid", simple_data_callback, + nullptr, nullptr, nullptr, nullptr, nullptr); if (err != GPG_ERR_NO_ERROR) { LOG_W() << "failed to test assuan connection:" << CheckGpgError(err); return err; } - assuan_ctx_[type] = a_ctx; + assuan_ctx_[type] = pa_ctx; return err; } @@ -114,9 +117,10 @@ auto GpgAssuanHelper::SendCommand(GpgComponentType type, const QString& command, LOG_D() << "sending assuan command: " << command; - auto err = assuan_transact( - assuan_ctx_[type], command.toUtf8(), default_data_callback, &context, - default_inquery_callback, &context, default_status_callback, &context); + auto err = + assuan_transact(assuan_ctx_[type].get(), command.toUtf8(), + default_data_callback, &context, default_inquery_callback, + &context, default_status_callback, &context); if (err != GPG_ERR_NO_ERROR) { LOG_W() << "failed to send assuan command:" << CheckGpgError(err); @@ -124,6 +128,7 @@ auto GpgAssuanHelper::SendCommand(GpgComponentType type, const QString& command, // broken pipe error, try reconnect next time if (CheckGpgError(err) == 32877) { assuan_ctx_.remove(type); + return SendCommand(type, command, data_cb, inquery_cb, status_cb); } return err; } @@ -270,4 +275,6 @@ auto GpgAssuanHelper::AssuanCallbackContext::SendData(const QByteArray& b) const -> gpg_error_t { return assuan_send_data(ctx, b.constData(), b.size()); } + +void GpgAssuanHelper::ResetAllConnections() { assuan_ctx_.clear(); } } // namespace GpgFrontend \ No newline at end of file diff --git a/src/core/function/gpg/GpgAssuanHelper.h b/src/core/function/gpg/GpgAssuanHelper.h index adf6d0ff..f357ed93 100644 --- a/src/core/function/gpg/GpgAssuanHelper.h +++ b/src/core/function/gpg/GpgAssuanHelper.h @@ -118,10 +118,16 @@ class GPGFRONTEND_CORE_EXPORT GpgAssuanHelper auto SendDataCommand(GpgComponentType type, const QString& command) -> std::tuple; + /** + * @brief + * + */ + void ResetAllConnections(); + private: GpgContext& ctx_ = GpgContext::GetInstance(SingletonFunctionObject::GetChannel()); - QMap assuan_ctx_; + QMap> assuan_ctx_; QByteArray temp_data_; QString temp_status_; diff --git a/src/core/function/gpg/GpgComponentManager.cpp b/src/core/function/gpg/GpgComponentManager.cpp index 1b302631..56b95aab 100644 --- a/src/core/function/gpg/GpgComponentManager.cpp +++ b/src/core/function/gpg/GpgComponentManager.cpp @@ -68,7 +68,6 @@ auto GpgComponentManager::ReloadGpgAgent() -> bool { LOG_D() << "invalid response of RELOADAGENT: " << s; return false; } - return true; } @@ -79,8 +78,13 @@ auto GpgComponentManager::GpgKillAgent() -> bool { LOG_D() << "invalid response of KILLAGENT: " << s; return false; } - + Reset(); return true; } +void GpgComponentManager::Reset() { + scdaemon_version_.clear(); + gpg_agent_version_.clear(); + assuan_.ResetAllConnections(); +} } // namespace GpgFrontend \ No newline at end of file diff --git a/src/core/function/gpg/GpgComponentManager.h b/src/core/function/gpg/GpgComponentManager.h index cfd6a99f..1048793f 100644 --- a/src/core/function/gpg/GpgComponentManager.h +++ b/src/core/function/gpg/GpgComponentManager.h @@ -73,6 +73,13 @@ class GPGFRONTEND_CORE_EXPORT GpgComponentManager */ auto GpgKillAgent() -> bool; + /** + * @brief + * + * @return auto + */ + void Reset(); + private: GpgContext& ctx_ = GpgContext::GetInstance(SingletonFunctionObject::GetChannel()); diff --git a/src/ui/dialog/key_generate/KeyGenerateDialog.cpp b/src/ui/dialog/key_generate/KeyGenerateDialog.cpp index df8b5232..c2275a79 100644 --- a/src/ui/dialog/key_generate/KeyGenerateDialog.cpp +++ b/src/ui/dialog/key_generate/KeyGenerateDialog.cpp @@ -88,6 +88,7 @@ KeyGenerateDialog::KeyGenerateDialog(int channel, QWidget* parent) ui_->commentLabel->setText(tr("Comment")); ui_->keyDBLabel->setText(tr("Key Database")); ui_->easyAlgoLabel->setText(tr("Algorithm")); + ui_->combinationLabel->setText(tr("Combination")); ui_->easyValidPeriodLabel->setText(tr("Validity Period")); ui_->pAlgoLabel->setText(tr("Algorithm")); -- cgit v1.2.3