diff options
author | saturneric <[email protected]> | 2024-04-12 09:14:37 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2024-04-12 09:14:37 +0000 |
commit | 26e24222e434036e5ec13f8ec99b958faf325154 (patch) | |
tree | 2a7145ae6f480713a529a20a29a90de4c436c399 /src/core/GpgCoreInit.cpp | |
parent | fix: find and solve some issues on module management (diff) | |
download | GpgFrontend-26e24222e434036e5ec13f8ec99b958faf325154.tar.gz GpgFrontend-26e24222e434036e5ec13f8ec99b958faf325154.zip |
feat: add auto activate function and optimums for some structures
Diffstat (limited to 'src/core/GpgCoreInit.cpp')
-rw-r--r-- | src/core/GpgCoreInit.cpp | 59 |
1 files changed, 10 insertions, 49 deletions
diff --git a/src/core/GpgCoreInit.cpp b/src/core/GpgCoreInit.cpp index 8b2dbbed..42991564 100644 --- a/src/core/GpgCoreInit.cpp +++ b/src/core/GpgCoreInit.cpp @@ -276,7 +276,6 @@ void InitGpgFrontendCore(CoreInitArgs args) { // initialize global register table Module::UpsertRTValue("core", "env.state.gpgme", 0); Module::UpsertRTValue("core", "env.state.ctx", 0); - Module::UpsertRTValue("core", "env.state.gnupg", 0); Module::UpsertRTValue("core", "env.state.basic", 0); Module::UpsertRTValue("core", "env.state.all", 0); @@ -409,60 +408,22 @@ void InitGpgFrontendCore(CoreInitArgs args) { QCoreApplication::tr("Gpg Key Detabase initiation failed")); }; } + GF_CORE_LOG_DEBUG( - "basic env checking finished, " - "including gpgme, ctx, and key infos"); + "basic env checking finished, including gpgme, ctx, and key infos"); + Module::UpsertRTValue("core", "env.state.basic", 1); CoreSignalStation::GetInstance()->SignalGoodGnupgEnv(); - // if gnupg_info_gathering module activated - if (args.gather_external_gnupg_info && - Module::IsModuleAcivate("com.bktus.gpgfrontend.module." - "integrated.gnupg_info_gathering")) { - GF_CORE_LOG_DEBUG( - "module gnupg_info_gathering is activated, " - "loading external gnupg info..."); - - // gather external gnupg info - Module::TriggerEvent( - "GPGFRONTEND_CORE_INITLIZED", - [](const Module::EventIdentifier& /*e*/, - const Module::Event::ListenerIdentifier& l_id, - DataObjectPtr o) { - GF_CORE_LOG_DEBUG( - "received event GPGFRONTEND_CORE_INITLIZED callback " - "from module: {}", - l_id); - - if (l_id == - "com.bktus.gpgfrontend.module.integrated.gnupg-info-" - "gathering") { - GF_CORE_LOG_DEBUG( - "received callback from gnupg_info_gathering "); - - // try to restart all components - auto settings = - GlobalSettingStation::GetInstance().GetSettings(); - auto restart_all_gnupg_components_on_start = - settings.value("gnupg/restart_gpg_agent_on_start", false) - .toBool(); - - if (restart_all_gnupg_components_on_start) { - GpgAdvancedOperator::RestartGpgComponents(); - } - Module::UpsertRTValue("core", "env.state.gnupg", 1); + // try to restart all components + auto restart_all_gnupg_components_on_start = + settings.value("gnupg/restart_gpg_agent_on_start", false).toBool(); - // announce that all checkings were finished - GF_CORE_LOG_INFO( - "all env checking finished, including gpgme, " - "ctx and gnupg"); - Module::UpsertRTValue("core", "env.state.all", 1); - } - }); - } else { - GF_CORE_LOG_DEBUG("gnupg_info_gathering is not activated"); - Module::UpsertRTValue("core", "env.state.all", 1); + if (restart_all_gnupg_components_on_start) { + GpgAdvancedOperator::RestartGpgComponents(); } + + Module::UpsertRTValue("core", "env.state.all", 1); return 0; }, "core_init_task"); |