diff options
Diffstat (limited to 'src/core/function')
-rw-r--r-- | src/core/function/gpg/GpgContext.cpp | 34 | ||||
-rw-r--r-- | src/core/function/gpg/GpgContext.h | 1 | ||||
-rw-r--r-- | src/core/function/gpg/GpgKeyGetter.cpp | 1 |
3 files changed, 24 insertions, 12 deletions
diff --git a/src/core/function/gpg/GpgContext.cpp b/src/core/function/gpg/GpgContext.cpp index a661f183..5c5dd813 100644 --- a/src/core/function/gpg/GpgContext.cpp +++ b/src/core/function/gpg/GpgContext.cpp @@ -209,13 +209,19 @@ class GpgContext::Impl { GPGME_KEYLIST_MODE_WITH_TOFU)) == GPG_ERR_NO_ERROR; } - static auto set_ctx_openpgp_engine_info(gpgme_ctx_t ctx) -> bool { + auto set_ctx_openpgp_engine_info(gpgme_ctx_t ctx) -> bool { const auto app_path = Module::RetrieveRTValueTypedOrDefault<>( - "core", "gpgme.ctx.app_path", QString{}); - const auto database_path = Module::RetrieveRTValueTypedOrDefault<>( - "core", "gpgme.ctx.database_path", QString{}); + "core", QString("gpgme.ctx.app_path").arg(parent_->GetChannel()), + QString{}); - LOG_D() << "ctx set engine info, db path: " << database_path + QString database_path; + // set custom gpg key db path + if (!args_.db_path.isEmpty()) { + database_path = args_.db_path; + } + + LOG_D() << "ctx set engine info, channel: " << parent_->GetChannel() + << ", db name: " << args_.db_name << ", db path: " << args_.db_path << ", app path: " << app_path; auto app_path_buffer = app_path.toUtf8(); @@ -281,17 +287,23 @@ class GpgContext::Impl { } } - // set custom gpg key db path - if (!args_.db_path.isEmpty()) { - LOG_D() << "set context database path to" << args_.db_path; - Module::UpsertRTValue("core", "gpgme.ctx.database_path", args_.db_path); - } - if (!set_ctx_openpgp_engine_info(ctx)) { FLOG_W("set gpgme context openpgp engine info failed"); return false; } + Module::UpsertRTValue( + "core", QString("gpgme.ctx.list.%1.channel").arg(parent_->GetChannel()), + parent_->GetChannel()); + Module::UpsertRTValue( + "core", + QString("gpgme.ctx.list.%1.database_name").arg(parent_->GetChannel()), + args_.db_name); + Module::UpsertRTValue( + "core", + QString("gpgme.ctx.list.%1.database_path").arg(parent_->GetChannel()), + args_.db_path); + return true; } diff --git a/src/core/function/gpg/GpgContext.h b/src/core/function/gpg/GpgContext.h index 1ff22b8a..f98adde8 100644 --- a/src/core/function/gpg/GpgContext.h +++ b/src/core/function/gpg/GpgContext.h @@ -40,6 +40,7 @@ namespace GpgFrontend { * */ struct GpgContextInitArgs { + QString db_name; ///< QString db_path; ///< bool test_mode = false; ///< diff --git a/src/core/function/gpg/GpgKeyGetter.cpp b/src/core/function/gpg/GpgKeyGetter.cpp index af77b067..5d002b0d 100644 --- a/src/core/function/gpg/GpgKeyGetter.cpp +++ b/src/core/function/gpg/GpgKeyGetter.cpp @@ -31,7 +31,6 @@ #include <gpg-error.h> #include <mutex> -#include <shared_mutex> #include "core/GpgModel.h" #include "core/function/gpg/GpgContext.h" |