summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Heinecke <aheinecke@intevation.de>2016-08-04 11:13:24 (GMT)
committerAndre Heinecke <aheinecke@intevation.de>2016-08-04 11:13:24 (GMT)
commit7ffea143f14dfd3f50b8b2a250b42213803c401d (patch)
tree1f606ed61cb0cda596e1f1d6bab86548c29f088e
parent42ff7ff278ee2f03325eee4e09eaad0602b06c2b (diff)
Add command line option --gen-key
This provides a quick way for callers to open the Key Generation wizard. The option respects the protocol. E.g. kleopatra --openpgp --gen-key will start in OpenPGP mode.
-rw-r--r--src/kleopatra_options.h2
-rw-r--r--src/kleopatraapplication.cpp10
2 files changed, 12 insertions, 0 deletions
diff --git a/src/kleopatra_options.h b/src/kleopatra_options.h
index fd4f2db..b99a023 100644
--- a/src/kleopatra_options.h
+++ b/src/kleopatra_options.h
@@ -89,6 +89,8 @@ static void kleopatra_options(QCommandLineParser *parser)
"Show details of a local certificate or search for it on a keyserver"
" by fingerprint"),
QStringLiteral("fingerprint"))
+ << QCommandLineOption(QStringList() << QStringLiteral("gen-key"),
+ i18n("Create a new key pair or certificate signing request"))
<< QCommandLineOption(QStringLiteral("parent-windowid"),
i18n("Parent Window Id for dialogs"),
QStringLiteral("windowId"));
diff --git a/src/kleopatraapplication.cpp b/src/kleopatraapplication.cpp
index 95827f2..38424e3 100644
--- a/src/kleopatraapplication.cpp
+++ b/src/kleopatraapplication.cpp
@@ -61,6 +61,7 @@
#include "commands/checksumcreatefilescommand.h"
#include "commands/checksumverifyfilescommand.h"
#include "commands/detailscommand.h"
+#include "commands/newcertificatecommand.h"
#include <KIconLoader>
#include <KLocalizedString>
@@ -321,6 +322,15 @@ QString KleopatraApplication::newInstance(const QCommandLineParser &parser,
return QString();
}
+ // Check for --gen-key command
+ if (parser.isSet("gen-key")) {
+ auto cmd = new NewCertificateCommand(Q_NULLPTR);
+ cmd->setParentWId(parentId);
+ cmd->setProtocol(protocol);
+ cmd->start();
+ return QString();
+ }
+
static const QMap<QString, Func> funcMap {
{ QStringLiteral("import-certificate"), &KleopatraApplication::importCertificatesFromFile },
{ QStringLiteral("encrypt"), &KleopatraApplication::encryptFiles },