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

Use new workflow for OpenPGP certificate creation if protocol is OpenPGP

If the protocol has been set to OpenPGP by the user of
NewCertificateCommand, then defer to NewOpenPGPCertificateCommand
instead of using the old wizard workflow for OpenPGP.

GnuPG-bug-id: 5832
parent bb057169
Pipeline #209559 passed with stage
in 4 minutes and 9 seconds
......@@ -93,6 +93,13 @@ void NewCertificateCommand::Private::onProtocolChosen()
protocol = protocolDialog->protocol();
protocolDialog->deleteLater();
createCertificate();
}
void Kleo::Commands::NewCertificateCommand::Private::createCertificate()
{
Q_ASSERT(protocol != GpgME::UnknownProtocol);
if (protocol == GpgME::OpenPGP) {
auto cmd = new NewOpenPGPCertificateCommand{view(), controller()};
if (parentWidgetOrView() != view()) {
......@@ -105,28 +112,22 @@ void NewCertificateCommand::Private::onProtocolChosen()
q, [this]() { canceled(); });
cmd->start();
} else {
createCertificate();
}
}
Q_ASSERT(!dialog);
void Kleo::Commands::NewCertificateCommand::Private::createCertificate()
{
Q_ASSERT(protocol != GpgME::UnknownProtocol);
Q_ASSERT(!dialog);
dialog = new NewCertificateWizard;
applyWindowID(dialog);
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog = new NewCertificateWizard;
applyWindowID(dialog);
dialog->setAttribute(Qt::WA_DeleteOnClose);
connect(dialog, &QDialog::accepted, q, [this]() {
slotDialogAccepted();
});
connect(dialog, &QDialog::rejected, q, [this]() {
canceled();
});
connect(dialog, &QDialog::accepted, q, [this]() {
slotDialogAccepted();
});
connect(dialog, &QDialog::rejected, q, [this]() {
canceled();
});
dialog->setProtocol(protocol);
dialog->show();
dialog->setProtocol(protocol);
dialog->show();
}
}
void NewCertificateCommand::Private::slotDialogAccepted()
......
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