aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/core/GpgCoreInit.cpp35
-rw-r--r--src/module/integrated/gnupg_info_gathering_module/CMakeLists.txt3
-rw-r--r--src/module/integrated/gnupg_info_gathering_module/GnuPGInfoGatheringModule.h1
-rw-r--r--src/module/integrated/version_checking_module/CMakeLists.txt3
-rw-r--r--src/ui/dialog/gnupg/GnuPGControllerDialog.cpp18
5 files changed, 40 insertions, 20 deletions
diff --git a/src/core/GpgCoreInit.cpp b/src/core/GpgCoreInit.cpp
index 7ce48ca4..286c6d1f 100644
--- a/src/core/GpgCoreInit.cpp
+++ b/src/core/GpgCoreInit.cpp
@@ -124,7 +124,7 @@ auto InitGpgME() -> bool {
QString(engine_info->version));
Module::UpsertRTValue(
"core", "gpgme.ctx.database_path",
- QString(engine_info->home_dir == nullptr ? "default"
+ QString(engine_info->home_dir == nullptr ? ""
: engine_info->home_dir));
break;
case GPGME_PROTOCOL_CMS:
@@ -279,7 +279,7 @@ void InitGpgFrontendCore(CoreInitArgs args) {
key_database_fs_path);
}
} else {
-#ifdef MACOS
+#if defined(LINUX) || defined(MACOS)
use_custom_key_database_path = true;
key_database_fs_path =
SearchKeyDatabasePath({QDir::home().path() + "/.gnupg"});
@@ -297,13 +297,36 @@ void InitGpgFrontendCore(CoreInitArgs args) {
// set key database path
if (use_custom_key_database_path &&
!key_database_fs_path.isEmpty()) {
- args.db_path = key_database_fs_path;
+ QFileInfo dir_info(key_database_fs_path);
+ if (dir_info.exists() && dir_info.isDir() &&
+ dir_info.isReadable() && dir_info.isWritable()) {
+ args.db_path = dir_info.absoluteFilePath();
+ GF_CORE_LOG_INFO("using key database path: {}",
+ args.db_path);
+ } else {
+ GF_CORE_LOG_ERROR(
+ "custom key database path: {}, is not point to "
+ "an accessible directory",
+ gnupg_install_fs_path);
+ }
}
// set custom gnupg path
- if (use_custom_gnupg_install_path) {
- args.custom_gpgconf = true;
- args.custom_gpgconf_path = gnupg_install_fs_path;
+ if (use_custom_gnupg_install_path &&
+ !gnupg_install_fs_path.isEmpty()) {
+ QFileInfo file_info(gnupg_install_fs_path);
+ if (file_info.exists() && file_info.isFile() &&
+ file_info.isExecutable()) {
+ args.custom_gpgconf = true;
+ args.custom_gpgconf_path = file_info.absoluteFilePath();
+ GF_CORE_LOG_INFO("using gnupg path: {}",
+ args.custom_gpgconf_path);
+ } else {
+ GF_CORE_LOG_ERROR(
+ "custom gnupg path: {}, is not point to an executable "
+ "gpgconf binary",
+ gnupg_install_fs_path);
+ }
}
args.offline_mode = forbid_all_gnupg_connection;
diff --git a/src/module/integrated/gnupg_info_gathering_module/CMakeLists.txt b/src/module/integrated/gnupg_info_gathering_module/CMakeLists.txt
index beccc99f..e8ec477c 100644
--- a/src/module/integrated/gnupg_info_gathering_module/CMakeLists.txt
+++ b/src/module/integrated/gnupg_info_gathering_module/CMakeLists.txt
@@ -44,5 +44,8 @@ endif ()
target_link_libraries(gpgfrontend_integrated_module_gnupg_info_gathering PRIVATE
gpgfrontend_module_sdk)
+# property
+set_property(TARGET gpgfrontend_integrated_module_gnupg_info_gathering PROPERTY AUTOMOC ON)
+
# using std c++ 17
target_compile_features(gpgfrontend_integrated_module_gnupg_info_gathering PRIVATE cxx_std_17) \ No newline at end of file
diff --git a/src/module/integrated/gnupg_info_gathering_module/GnuPGInfoGatheringModule.h b/src/module/integrated/gnupg_info_gathering_module/GnuPGInfoGatheringModule.h
index 5c228298..8b62ceba 100644
--- a/src/module/integrated/gnupg_info_gathering_module/GnuPGInfoGatheringModule.h
+++ b/src/module/integrated/gnupg_info_gathering_module/GnuPGInfoGatheringModule.h
@@ -37,7 +37,6 @@ namespace GpgFrontend::Module::Integrated::GnuPGInfoGatheringModule {
*
*/
class GPGFRONTEND_MODULE_SDK_EXPORT GnuPGInfoGatheringModule : public Module {
- Q_OBJECT
public:
GnuPGInfoGatheringModule();
diff --git a/src/module/integrated/version_checking_module/CMakeLists.txt b/src/module/integrated/version_checking_module/CMakeLists.txt
index bebd24c9..81b1d881 100644
--- a/src/module/integrated/version_checking_module/CMakeLists.txt
+++ b/src/module/integrated/version_checking_module/CMakeLists.txt
@@ -47,5 +47,8 @@ target_link_libraries(gpgfrontend_integrated_module_version_checking PRIVATE
# link Qt
target_link_libraries(gpgfrontend_integrated_module_version_checking PRIVATE Qt6::Network)
+# property
+set_property(TARGET gpgfrontend_integrated_module_version_checking PROPERTY AUTOMOC ON)
+
# using std c++ 17
target_compile_features(gpgfrontend_integrated_module_version_checking PRIVATE cxx_std_17) \ No newline at end of file
diff --git a/src/ui/dialog/gnupg/GnuPGControllerDialog.cpp b/src/ui/dialog/gnupg/GnuPGControllerDialog.cpp
index fbf018ca..9e3573f5 100644
--- a/src/ui/dialog/gnupg/GnuPGControllerDialog.cpp
+++ b/src/ui/dialog/gnupg/GnuPGControllerDialog.cpp
@@ -326,12 +326,8 @@ void GnuPGControllerDialog::slot_set_restart_needed(int mode) {
this->restart_needed_ = mode;
}
-bool GnuPGControllerDialog::check_custom_gnupg_path(QString path) {
- if (path.isEmpty()) {
- QMessageBox::critical(this, tr("Illegal GnuPG Path"),
- tr("Target GnuPG Path is empty."));
- return false;
- }
+auto GnuPGControllerDialog::check_custom_gnupg_path(QString path) -> bool {
+ if (path.isEmpty()) return false;
QFileInfo dir_info(path);
if (!dir_info.exists() || !dir_info.isReadable() || !dir_info.isDir()) {
@@ -352,8 +348,8 @@ bool GnuPGControllerDialog::check_custom_gnupg_path(QString path) {
QFileInfo gpgconf_info(path + "/gpgconf");
#endif
- if (!gpgconf_info.exists() || !gpgconf_info.isExecutable() ||
- !gpgconf_info.isFile()) {
+ if (!gpgconf_info.exists() || !gpgconf_info.isFile() ||
+ !gpgconf_info.isExecutable()) {
QMessageBox::critical(
this, tr("Illegal GnuPG Path"),
tr("Target GnuPG Path contains no \"gpgconf\" executable."));
@@ -365,11 +361,7 @@ bool GnuPGControllerDialog::check_custom_gnupg_path(QString path) {
auto GnuPGControllerDialog::check_custom_gnupg_key_database_path(QString path)
-> bool {
- if (path.isEmpty()) {
- QMessageBox::critical(this, tr("Illegal GnuPG Key Database Path"),
- tr("Target GnuPG Key Database Path is empty."));
- return false;
- }
+ if (path.isEmpty()) return false;
QFileInfo dir_info(path);
if (!dir_info.exists() || !dir_info.isReadable() || !dir_info.isDir()) {