diff options
author | Saturneric <[email protected]> | 2022-12-04 10:15:50 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2022-12-04 10:16:25 +0000 |
commit | 6bdfddb208bb00fc67a309b0c23af124217d3541 (patch) | |
tree | b2fe2928b8ae7396021b433b808121260c6ef80f /src/core/GpgContext.cpp | |
parent | fix: solve a refresh crash (diff) | |
download | GpgFrontend-6bdfddb208bb00fc67a309b0c23af124217d3541.tar.gz GpgFrontend-6bdfddb208bb00fc67a309b0c23af124217d3541.zip |
feat(ui, core): add custom key db support
1. add custom key db support
2. add deep restart mode for custom key db settings
3. add core reset function
Diffstat (limited to 'src/core/GpgContext.cpp')
-rw-r--r-- | src/core/GpgContext.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/core/GpgContext.cpp b/src/core/GpgContext.cpp index 28857d32..7ebd9fa9 100644 --- a/src/core/GpgContext.cpp +++ b/src/core/GpgContext.cpp @@ -102,6 +102,9 @@ GpgContext::GpgContext(const GpgContextInitArgs &args) : args_(args) { find_openpgp = true; info_.AppPath = engine_info->file_name; info_.GnupgVersion = engine_info->version; + info_.DatabasePath = std::string(engine_info->home_dir == nullptr + ? "default" + : engine_info->home_dir); break; case GPGME_PROTOCOL_CMS: find_cms = true; @@ -128,6 +131,16 @@ GpgContext::GpgContext(const GpgContextInitArgs &args) : args_(args) { engine_info = engine_info->next; } + // set custom key db path + if (!args.db_path.empty()) { + info_.DatabasePath = args.db_path; + auto err = gpgme_ctx_set_engine_info(_ctx_ref.get(), GPGME_PROTOCOL_OpenPGP, + info_.AppPath.c_str(), + info_.DatabasePath.c_str()); + LOG(INFO) << "ctx set custom key db path:" << info_.DatabasePath; + assert(check_gpg_error_2_err_code(err) == GPG_ERR_NO_ERROR); + } + // conditional check if ((info_.GnupgVersion >= "2.0.0" && find_gpgconf && find_openpgp && find_cms) || |