Commit bb057169 authored by Ingo Klöcker's avatar Ingo Klöcker
Browse files

Use NewOpenPGPCertificateCommand if we want an OpenPGP certificate

If we already know that we want to create an OpenPGP certificate, then
we can simply use the new OpenPGP-specific command for creating a
certificate.

GnuPG-bug-id: 5832
parent fe004263
......@@ -11,7 +11,7 @@
#include <config-kleopatra.h>
#include "certifycertificatecommand.h"
#include "newcertificatecommand.h"
#include "newopenpgpcertificatecommand.h"
#include "command_p.h"
......@@ -162,11 +162,10 @@ void CertifyCertificateCommand::doStart()
i18n("Certification Not Possible"));
if (sel == KMessageBox::Yes) {
QEventLoop loop;
auto cmd = new Commands::NewCertificateCommand();
auto cmd = new NewOpenPGPCertificateCommand;
cmd->setParentWidget(d->parentWidgetOrView());
cmd->setProtocol(GpgME::OpenPGP);
connect(cmd, &Command::finished, &loop, &QEventLoop::quit);
QMetaObject::invokeMethod(cmd, &Commands::NewCertificateCommand::start, Qt::QueuedConnection);
QMetaObject::invokeMethod(cmd, &NewOpenPGPCertificateCommand::start, Qt::QueuedConnection);
loop.exec();
} else {
Q_EMIT(canceled());
......
......@@ -270,6 +270,11 @@ void NewOpenPGPCertificateCommand::Private::showErrorDialog(const KeyGenerationR
}
}
NewOpenPGPCertificateCommand::NewOpenPGPCertificateCommand()
: NewOpenPGPCertificateCommand(nullptr, nullptr)
{
}
NewOpenPGPCertificateCommand::NewOpenPGPCertificateCommand(QAbstractItemView *v, KeyListController *c)
: Command(v, new Private(this, c))
{
......
......@@ -20,6 +20,7 @@ class NewOpenPGPCertificateCommand : public Command
{
Q_OBJECT
public:
NewOpenPGPCertificateCommand();
NewOpenPGPCertificateCommand(QAbstractItemView *view, KeyListController *parent);
~NewOpenPGPCertificateCommand() override;
......
......@@ -23,7 +23,7 @@
#include <QAction>
#include "commands/importcertificatefromfilecommand.h"
#include "commands/newcertificatecommand.h"
#include "commands/newopenpgpcertificatecommand.h"
#include <KLocalizedString>
#include <KSharedConfig>
......@@ -129,11 +129,10 @@ public:
void generate()
{
mGenerateBtn->setEnabled(false);
auto cmd = new Commands::NewCertificateCommand();
cmd->setProtocol(GpgME::OpenPGP);
auto cmd = new NewOpenPGPCertificateCommand;
cmd->setParentWidget(q);
QObject::connect(cmd, &Commands::NewCertificateCommand::finished,
QObject::connect(cmd, &NewOpenPGPCertificateCommand::finished,
q, [this]() {
mGenerateBtn->setEnabled(true);
});
......
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