aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2024-01-23 07:52:20 +0000
committersaturneric <[email protected]>2024-01-23 07:52:20 +0000
commit3cf18ada6ee8cb074030d98f93b14cc7f4bcbbda (patch)
treeb5060560dfcf6627b5779f34ae67dfee49853953
parentfix: solve issues on detected gnupg path function and fix linking errors on w... (diff)
downloadGpgFrontend-3cf18ada6ee8cb074030d98f93b14cc7f4bcbbda.tar.gz
GpgFrontend-3cf18ada6ee8cb074030d98f93b14cc7f4bcbbda.zip
fix: set gpgconf path to gpgme engine
-rw-r--r--src/core/GpgCoreInit.cpp25
-rw-r--r--src/module/integrated/version_checking_module/VersionCheckTask.cpp11
2 files changed, 24 insertions, 12 deletions
diff --git a/src/core/GpgCoreInit.cpp b/src/core/GpgCoreInit.cpp
index f231056f..8ae7e51e 100644
--- a/src/core/GpgCoreInit.cpp
+++ b/src/core/GpgCoreInit.cpp
@@ -77,7 +77,7 @@ auto SearchKeyDatabasePath(const QList<QString>& candidate_paths) -> QString {
return {};
}
-auto InitGpgME(const QString& gnupg_path) -> bool {
+auto InitGpgME(const QString& gpgconf_path, const QString& gnupg_path) -> bool {
// init gpgme subsystem and get gpgme library version
Module::UpsertRTValue("core", "gpgme.version",
QString(gpgme_check_version(nullptr)));
@@ -88,8 +88,11 @@ auto InitGpgME(const QString& gnupg_path) -> bool {
#endif
if (!gnupg_path.isEmpty()) {
- GF_CORE_LOG_DEBUG("gpgme set engine info, gnupg path: {}", gnupg_path);
- CheckGpgError(gpgme_set_engine_info(GPGME_PROTOCOL_OPENPGP,
+ GF_CORE_LOG_DEBUG("gpgme set engine info, gpgconf path: {}, gnupg path: {}",
+ gpgconf_path, gnupg_path);
+ CheckGpgError(gpgme_set_engine_info(GPGME_PROTOCOL_GPGCONF,
+ gpgconf_path.toUtf8(), nullptr));
+ CheckGpgError(gpgme_set_engine_info(GPGME_PROTOCOL_OpenPGP,
gnupg_path.toUtf8(), nullptr));
}
@@ -218,8 +221,7 @@ auto GetGnuPGPathByGpgConf(const QString& gnupg_install_fs_path) -> QString {
}
return "";
}
-
-auto DetectGnuPGPath() -> QString {
+auto DetectGpgConfPath() -> QString {
auto settings = GlobalSettingStation::GetInstance().GetSettings();
auto use_custom_gnupg_install_path =
settings.value("basic/use_custom_gnupg_install_path", false).toBool();
@@ -262,12 +264,15 @@ auto DetectGnuPGPath() -> QString {
}
if (!gnupg_install_fs_path.isEmpty()) {
- return GetGnuPGPathByGpgConf(
- QFileInfo(gnupg_install_fs_path).absoluteFilePath());
+ return QFileInfo(gnupg_install_fs_path).absoluteFilePath();
}
return "";
}
+auto DetectGnuPGPath(QString gpgconf_path) -> QString {
+ return GetGnuPGPathByGpgConf(gpgconf_path);
+}
+
void InitGpgFrontendCore(CoreInitArgs args) {
// initialize global register table
Module::UpsertRTValue("core", "env.state.gpgme", 0);
@@ -279,11 +284,13 @@ void InitGpgFrontendCore(CoreInitArgs args) {
// initialize locale environment
GF_CORE_LOG_DEBUG("locale: {}", setlocale(LC_CTYPE, nullptr));
- auto gnupg_install_fs_path = DetectGnuPGPath();
+ auto gpgconf_install_fs_path = DetectGpgConfPath();
+ auto gnupg_install_fs_path = DetectGnuPGPath(gpgconf_install_fs_path);
+ GF_CORE_LOG_INFO("detected gpgconf path: {}", gpgconf_install_fs_path);
GF_CORE_LOG_INFO("detected gnupg path: {}", gnupg_install_fs_path);
// initialize library gpgme
- if (!InitGpgME(gnupg_install_fs_path)) {
+ if (!InitGpgME(gpgconf_install_fs_path, gnupg_install_fs_path)) {
CoreSignalStation::GetInstance()->SignalBadGnupgEnv(
QObject::tr("GpgME inilization failed"));
return;
diff --git a/src/module/integrated/version_checking_module/VersionCheckTask.cpp b/src/module/integrated/version_checking_module/VersionCheckTask.cpp
index 34827838..8699b7b6 100644
--- a/src/module/integrated/version_checking_module/VersionCheckTask.cpp
+++ b/src/module/integrated/version_checking_module/VersionCheckTask.cpp
@@ -116,11 +116,16 @@ void VersionCheckTask::slot_parse_latest_version_info() {
}
void VersionCheckTask::slot_parse_current_version_info() {
- if (current_reply_ == nullptr ||
- current_reply_->error() != QNetworkReply::NoError) {
+ if (current_reply_ == nullptr) {
+ // loading done
+ version_.loading_done = false;
+ return;
+ }
+
+ if (current_reply_->error() != QNetworkReply::NoError) {
if (current_reply_ != nullptr) {
MODULE_LOG_ERROR("current version request network error: {}",
- current_reply_->errorString().toStdString());
+ current_reply_->errorString());
} else {
MODULE_LOG_ERROR(
"current version request network error, null reply object");