Commit 7ffea143 authored by Andre Heinecke's avatar Andre Heinecke
Browse files

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.
parent 42ff7ff2
......@@ -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"));
......
......@@ -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 },
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment