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

Restart at Enter Details page on restart after failure

It's unlikely that the user wants to create a key pair for the other
protocol, if creation failed. So, start over at the Enter Details page.
Remember the current protocol before restarting the wizard because
restarting the wizard resets the protocol to the initial protocol (which
may be unset).

GnuPG-bug-id: 5832
parent b9e85f1f
......@@ -341,6 +341,11 @@ protected:
wizard()->resetProtocol();
}
void restartAtEnterDetailsPage()
{
wizard()->restartAtEnterDetailsPage();
}
QDir tmpDir() const;
protected:
......@@ -1030,9 +1035,12 @@ public:
wizard()->setOptions(wizard()->options() | QWizard::NoCancelButtonOnLastPage);
}
if (!initialized)
if (!initialized) {
connect(ui.restartWizardPB, &QAbstractButton::clicked,
wizard(), &QWizard::restart);
this, [this]() {
restartAtEnterDetailsPage();
});
}
initialized = true;
}
......@@ -1304,6 +1312,16 @@ void NewCertificateWizard::resetProtocol()
d->ui.chooseProtocolPage.setProtocol(d->initialProtocol);
}
void NewCertificateWizard::restartAtEnterDetailsPage()
{
const auto protocol = d->ui.chooseProtocolPage.protocol();
restart(); // resets the protocol to the initial protocol
d->ui.chooseProtocolPage.setProtocol(protocol);
while (currentId() != NewCertificateWizard::EnterDetailsPageId) {
next();
}
}
static QString pgpLabel(const QString &attr)
{
if (attr == QLatin1String("NAME")) {
......
......@@ -45,6 +45,7 @@ public:
private:
void resetProtocol();
void restartAtEnterDetailsPage();
private:
class Private;
......
Markdown is supported
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