diff options
author | Saturneric <[email protected]> | 2023-03-30 16:06:26 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2023-03-30 16:06:26 +0000 |
commit | b741fc6d1c68241ac178a881e7daeb60c27a451e (patch) | |
tree | 987f8302ebc9e3c7b86255eca21bffa76693ac58 /src/core/GpgContext.cpp | |
parent | feat: improve key generation ui operations (diff) | |
download | GpgFrontend-b741fc6d1c68241ac178a881e7daeb60c27a451e.tar.gz GpgFrontend-b741fc6d1c68241ac178a881e7daeb60c27a451e.zip |
feat: add an option to use pinentry
Diffstat (limited to 'src/core/GpgContext.cpp')
-rw-r--r-- | src/core/GpgContext.cpp | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/core/GpgContext.cpp b/src/core/GpgContext.cpp index a5213134..68aedf4a 100644 --- a/src/core/GpgContext.cpp +++ b/src/core/GpgContext.cpp @@ -40,6 +40,7 @@ #include "core/GpgModel.h" #include "core/common/CoreCommonUtil.h" #include "core/function/CoreSignalStation.h" +#include "core/function/GlobalSettingStation.h" #include "core/function/gpg/GpgCommandExecutor.h" #include "core/thread/TaskRunnerGetter.h" #include "thread/Task.h" @@ -219,8 +220,22 @@ void GpgContext::post_init_ctx() { // preload info auto &info = GetInfo(); - // listen passphrase input event - SetPassphraseCb(custom_passphrase_cb); + auto &settings = GlobalSettingStation::GetInstance().GetUISettings(); + + bool use_pinentry_as_password_input_dialog = false; + try { + use_pinentry_as_password_input_dialog = + settings.lookup("general.use_pinentry_as_password_input_dialog"); + } catch (...) { + SPDLOG_ERROR( + "setting operation error: use_pinentry_as_password_input_dialog"); + } + + // use custom qt dialog to replace pinentry + if (!use_pinentry_as_password_input_dialog) { + SetPassphraseCb(custom_passphrase_cb); + } + connect(this, &GpgContext::SignalNeedUserInputPassphrase, CoreSignalStation::GetInstance(), &CoreSignalStation::SignalNeedUserInputPassphrase); @@ -372,6 +387,12 @@ const GpgInfo &GpgContext::GetInfo(bool refresh) { auto component_name = info_split_list[0]; auto component_desc = info_split_list[1]; auto component_path = info_split_list[2]; + +#ifdef WINDOWS + // replace some special substrings on windows platform + boost::replace_all(component_path, "%3a", ":"); +#endif + auto binary_checksum = check_binary_chacksum(component_path); SPDLOG_DEBUG( |