diff options
author | saturneric <[email protected]> | 2024-07-31 05:55:59 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2024-07-31 05:55:59 +0000 |
commit | 2be9cf21aef39a34a807eb29b29eec726ec68f97 (patch) | |
tree | b1c053696132d4754bff72261061cfb84c4365ab /src/m_gpg_info | |
parent | feat: update copyright info (diff) | |
download | Modules-2be9cf21aef39a34a807eb29b29eec726ec68f97.tar.gz Modules-2be9cf21aef39a34a807eb29b29eec726ec68f97.zip |
fix: addressing some of the issues identified
Diffstat (limited to 'src/m_gpg_info')
-rw-r--r-- | src/m_gpg_info/CMakeLists.txt | 12 | ||||
-rw-r--r-- | src/m_gpg_info/GnuPGInfoGatheringModule.cpp | 33 |
2 files changed, 25 insertions, 20 deletions
diff --git a/src/m_gpg_info/CMakeLists.txt b/src/m_gpg_info/CMakeLists.txt index 3833547..e9f269d 100644 --- a/src/m_gpg_info/CMakeLists.txt +++ b/src/m_gpg_info/CMakeLists.txt @@ -25,6 +25,7 @@ # com.bktus.gpgfrontend.module.integrated.gnupg_info_gathering +set(INTEGRATED_MODULE_SOURCE "") aux_source_directory(. INTEGRATED_MODULE_SOURCE) # define libgpgfrontend_module @@ -38,13 +39,8 @@ install(TARGETS mod_gpg_info target_link_libraries(mod_gpg_info PRIVATE gpgfrontend_module_sdk) -if(GPGFRONTEND_QT5_BUILD) - # link Qt core - target_link_libraries(mod_gpg_info PRIVATE Qt5::Core Qt5::Widgets) -else() - # link Qt core - target_link_libraries(mod_gpg_info PRIVATE Qt6::Core Qt6::Widgets) -endif() +# link qt +target_link_libraries(mod_gpg_info PRIVATE Qt::Core Qt::Widgets) # using std c++ 17 target_compile_features(mod_gpg_info PRIVATE cxx_std_17) @@ -60,5 +56,5 @@ set(TS_FILES "${LOCALE_TS_PATH}/ModuleGnuPGInfoGathering.en_US.ts" qt_add_translations(mod_gpg_info RESOURCE_PREFIX "/i18n" TS_FILES ${TS_FILES} - SOURCES ${MODULE_SOURCE_FILES} + SOURCES ${INTEGRATED_MODULE_SOURCE} INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR})
\ No newline at end of file diff --git a/src/m_gpg_info/GnuPGInfoGatheringModule.cpp b/src/m_gpg_info/GnuPGInfoGatheringModule.cpp index f0ff772..7c6d70c 100644 --- a/src/m_gpg_info/GnuPGInfoGatheringModule.cpp +++ b/src/m_gpg_info/GnuPGInfoGatheringModule.cpp @@ -50,6 +50,8 @@ GF_MODULE_API_DEFINE("com.bktus.gpgfrontend.module.gnupg_info_gathering", "GatherGnupgInfo", "1.0.0", "Try gathering gnupg informations.", "Saturneric") +DEFINE_TRANSLATIONS_STRUCTURE(ModuleGnuPGInfoGathering); + extern auto CalculateBinaryChacksum(const QString &path) -> std::optional<QString>; @@ -69,16 +71,23 @@ using Context = struct { GpgComponentInfo component_info; }; -auto GFRegisterModule() -> int { return 0; } +auto GFRegisterModule() -> int { + MLogDebug("gnupg info gathering module registering..."); + + REGISTER_TRANS_READER(); + + GFUIMountEntry(DUP("AboutDialogTabs"), + QMapToMetaDataArray({ + {"TabTitle", GTrC::tr("GnuPG")}, + }), + 1, GnupgTabFactory); + + return 0; +} auto GFActiveModule() -> int { LISTEN("REQUEST_GATHERING_GNUPG_INFO"); - LOAD_TRANS("ModuleGnuPGInfoGathering"); - - GFUIMountEntry(DUP("AboutDialogTabs"), - QMapToMetaDataArray({{"TabTitle", GTrC::tr("GnuPG")}}), 1, - GnupgTabFactory); return 0; } @@ -95,7 +104,7 @@ END_EXECUTE_MODULE() auto GFDeactivateModule() -> int { return 0; } auto GFUnregisterModule() -> int { - MLogDebug("gnupg info gathering module unregistering"); + MLogDebug("gnupg info gathering module unregistering..."); return 0; } @@ -118,10 +127,10 @@ auto StartGatheringGnuPGInfo() -> int { GFExecuteCommandSync(gpgconf_path, 1, argv, GetGpgComponentInfos, &context); MLogDebug("load gnupg component info done."); -#ifdef QT5_BUILD - QVector<GFCommandExecuteContext> exec_contexts; -#else +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 4) QList<GFCommandExecuteContext> exec_contexts; +#else + QVector<GFCommandExecuteContext> exec_contexts; #endif const char **argv_0 = @@ -277,7 +286,7 @@ void GetGpgComponentInfos(void *data, int exit_code, const char *out, auto component_desc = info_split_list[1].trimmed(); auto component_path = info_split_list[2].trimmed(); -#ifdef WINDOWS +#ifdef __MINGW32__ // replace some special substrings on windows // platform component_path.replace("%3a", ":"); @@ -353,7 +362,7 @@ void GetGpgDirectoryInfos(void *, int exit_code, const char *out, auto configuration_name = info_split_list[0].trimmed(); auto configuration_value = info_split_list[1].trimmed(); -#ifdef WINDOWS +#ifdef __MINGW32__ // replace some special substrings on windows // platform configuration_value.replace("%3a", ":"); |