summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Noonan <steven@uplinklabs.net>2016-09-24 05:30:36 (GMT)
committerRolf Eike Beer <kde@opensource.sf-tec.de>2016-10-11 16:16:46 (GMT)
commitaf3b40cbb204b69f30b33777b10606a6814276c6 (patch)
tree5f885f45f82b672685639ce8d977a6963ee1a8f6
parente1743170d44157424df0f29f7df89cf5411a6cb5 (diff)
slotGenerateKey: correctly invoke GPG for interactive key generation
While at it, use --full-gen-key if the given GnuPG binary is new enough. BUG:369274 FIXED-IN:16.12.0 Signed-off-by: Steven Noonan <steven@uplinklabs.net>
-rw-r--r--keysmanager.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/keysmanager.cpp b/keysmanager.cpp
index 8cf6eb0..4ce0f04 100644
--- a/keysmanager.cpp
+++ b/keysmanager.cpp
@@ -21,6 +21,7 @@
#include "core/images.h"
#include "core/kgpgkey.h"
#include "detailedconsole.h"
+#include "gpgproc.h"
#include "groupedit.h"
#include "keyadaptor.h"
#include "keyexport.h"
@@ -509,11 +510,17 @@ void KeysManager::slotGenerateKey()
KConfigGroup config(KSharedConfig::openConfig(), "General");
QString terminalApp(config.readPathEntry("TerminalApplication", QLatin1String( "konsole" )));
+
+ const QString gpgbin = KGpgSettings::gpgBinaryPath();
+ QString gpg_args = gpgbin + QLatin1String(" --expert");
+ if (GPGProc::gpgVersion(GPGProc::gpgVersionString(gpgbin)) > 0x20100)
+ gpg_args += QLatin1String(" --full-gen-key");
+ else
+ gpg_args += QLatin1String(" --gen-key");
+
QStringList args;
args << QLatin1String( "-e" )
- << KGpgSettings::gpgBinaryPath()
- << QLatin1String("--gen-key")
- << QLatin1String("--expert");
+ << gpg_args;
QProcess *genKeyProc = new QProcess(this);
genKeyProc->start(terminalApp, args);