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

Fix hiding of Cancel button on result page

Setting the visibility of the Cancel button to false in case there was
no error does not work (anymore). Most likely the wizard updates the
button states after calling initializePage() on the page.

Setting (or unsetting in case of an error) the NoCancelButtonOnLastPage
option makes it work as intended.

GnuPG-bug-id: 5832
parent 1a8a734b
......@@ -336,20 +336,6 @@ protected:
return static_cast<NewCertificateWizard *>(QWizardPage::wizard());
}
QAbstractButton *button(QWizard::WizardButton button) const
{
return QWizardPage::wizard() ? QWizardPage::wizard()->button(button) : nullptr;
}
bool isButtonVisible(QWizard::WizardButton button) const
{
if (const QAbstractButton *const b = this->button(button)) {
return b->isVisible();
} else {
return false;
}
}
void resetProtocol()
{
wizard()->resetProtocol();
......@@ -357,14 +343,6 @@ protected:
QDir tmpDir() const;
protected Q_SLOTS:
void setButtonVisible(QWizard::WizardButton button, bool visible)
{
if (QAbstractButton *const b = this->button(button)) {
b->setVisible(visible);
}
}
protected:
#define FIELD(type, name) type name() const { return field( QStringLiteral(#name) ).value<type>(); }
FIELD(bool, pgp)
......@@ -1046,7 +1024,11 @@ public:
ui.createSigningCertificatePB->setVisible(successfullyCreatedEncryptionCertificate &&!successfullyCreatedSigningCertificate);
ui.createEncryptionCertificatePB->setVisible(successfullyCreatedSigningCertificate &&!successfullyCreatedEncryptionCertificate);
setButtonVisible(QWizard::CancelButton, error);
if (error) {
wizard()->setOptions(wizard()->options() & ~QWizard::NoCancelButtonOnLastPage);
} else {
wizard()->setOptions(wizard()->options() | QWizard::NoCancelButtonOnLastPage);
}
if (!initialized)
connect(ui.restartWizardPB, &QAbstractButton::clicked,
......@@ -1054,10 +1036,6 @@ public:
initialized = true;
}
void cleanupPage() override {
setButtonVisible(QWizard::CancelButton, true);
}
bool isError() const
{
return !ui.errorTB->document()->isEmpty();
......
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