Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:rhabacker:branches:windows:mingw:win32:snapshots
mingw32-kmymoney5
0001-Change-order-to-search-for-GPG-configurati...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-Change-order-to-search-for-GPG-configuration-directo.patch of Package mingw32-kmymoney5
From 6a6ae29ebe69ce3255b3cf87129e8225f0dfa32e Mon Sep 17 00:00:00 2001 From: Thomas Baumgart <thb@net-bembel.de> Date: Tue, 20 Apr 2021 12:45:27 +0200 Subject: [PATCH] Change order to search for GPG configuration directory Up to now, KMyMoney used a more or less hardcoded set of directories to find out, where gpg has its home directory. The order used is not ideal to be used in all operating system environments. This code change makes sure that the directory information provided by GPG is searched first, then the directories returned by QStandardPaths::AppDataLocation and as a last resort the QStandardPaths::HomeLocation. Within these directories a search inside sub-directories ".gnupg" and "gnupg" is also performed. This does not change to the original implementation. (cherry picked from commit 904be93b8ccdc051527077f645cd2f4dde6f5db0) --- kmymoney/plugins/xml/libkgpgfile/kgpgfile.cpp | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/kmymoney/plugins/xml/libkgpgfile/kgpgfile.cpp b/kmymoney/plugins/xml/libkgpgfile/kgpgfile.cpp index ddc38c1af..991a1b354 100644 --- a/kmymoney/plugins/xml/libkgpgfile/kgpgfile.cpp +++ b/kmymoney/plugins/xml/libkgpgfile/kgpgfile.cpp @@ -47,28 +47,38 @@ public: m_fileWrite = 0; GpgME::initializeLibrary(); + ctx = GpgME::Context::createForProtocol(GpgME::OpenPGP); + if (!ctx) { + qDebug("Failed to create the GpgME context for the OpenPGP protocol"); + return; + } + // figure out the location of the GPG home directory QStringList baseDirs; - // we search in the home directory ... - baseDirs << QStandardPaths::standardLocations(QStandardPaths::HomeLocation); + // we search the directory that GPG provides as default + if (ctx->engineInfo().homeDirectory() == nullptr) { + baseDirs << QString::fromUtf8(GpgME::dirInfo("homedir")); + } else { + baseDirs << QString::fromUtf8(ctx->engineInfo().homeDirectory()); + } - // ... and in the application data dirs. + // we search in the application data dirs. // since we look for gnupg, we need to replace the application name foreach (auto baseDir, QStandardPaths::standardLocations(QStandardPaths::AppDataLocation)) { baseDirs << baseDir.replace(QLatin1String("kmymoney"), QLatin1String("gnupg"), Qt::CaseInsensitive); } + // ... and in the users home directory + baseDirs << QStandardPaths::standardLocations(QStandardPaths::HomeLocation); + + // ... and possible subdirs of those const QStringList subDirs = { QStringLiteral(".gnupg"), QString(), QStringLiteral("gnupg"), }; - ctx = GpgME::Context::createForProtocol(GpgME::OpenPGP); - if (!ctx) - qDebug("Failed to create the GpgME context for the OpenPGP protocol"); - bool found = false; foreach (const auto baseDir, baseDirs) { foreach (const auto subDir, subDirs) { -- 2.26.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor