diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-12-13 12:24:02 -0600 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-12-13 12:24:02 -0600 |
commit | 0a4b3b9cd1095f05651bff685d02c809db8768a9 (patch) | |
tree | 38fde288e82b90c1723c8363a6fa8e07a58effad /ui/qt5/horizonwizard.cc | |
parent | 1257064e43c6c4269e1b8cf0507b238fd4a0ab1a (diff) | |
download | horizon-0a4b3b9cd1095f05651bff685d02c809db8768a9.tar.gz horizon-0a4b3b9cd1095f05651bff685d02c809db8768a9.tar.bz2 horizon-0a4b3b9cd1095f05651bff685d02c809db8768a9.tar.xz horizon-0a4b3b9cd1095f05651bff685d02c809db8768a9.zip |
Qt UI: Handle cancel/exit of wizard using the proper pattern
Diffstat (limited to 'ui/qt5/horizonwizard.cc')
-rw-r--r-- | ui/qt5/horizonwizard.cc | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/ui/qt5/horizonwizard.cc b/ui/qt5/horizonwizard.cc index cdeac28..a71b824 100644 --- a/ui/qt5/horizonwizard.cc +++ b/ui/qt5/horizonwizard.cc @@ -238,25 +238,6 @@ HorizonWizard::HorizonWizard(QWidget *parent) : QWizard(parent) { help.exec(); }); - /* REQ: UI.Global.Cancel.Confirm */ - button(CancelButton)->disconnect(this); - QObject::connect(button(CancelButton), &QAbstractButton::clicked, - [=](bool) { - QMessageBox cancel(QMessageBox::Question, - tr("Exit Adélie Linux System Installation"), - #ifdef HAS_INSTALL_ENV - tr("Adélie Linux has not yet been set up on your computer. Exiting will reboot your computer. Do you wish to exit?"), - #else - tr("You have not yet completed the System Installation wizard. No installfile will be generated. Do you wish to exit?"), - #endif - QMessageBox::Yes | QMessageBox::No, - this); - cancel.setDefaultButton(QMessageBox::No); - if(cancel.exec() == QMessageBox::Yes) { - reject(); - } - }); - /* REQ: Iface.UI.ButtonAccel */ setButtonText(HelpButton, tr("&Help (F1)")); setButtonText(CancelButton, tr("E&xit (F3)")); @@ -273,9 +254,6 @@ HorizonWizard::HorizonWizard(QWidget *parent) : QWizard(parent) { button(HelpButton), &QAbstractButton::click); f1->setWhatsThis(tr("Activates the Help screen.")); - esc = new QShortcut(Qt::Key_Escape, this); - connect(esc, &QShortcut::activated, - button(CancelButton), &QAbstractButton::click); f3 = new QShortcut(Qt::Key_F3, this); connect(f3, &QShortcut::activated, button(CancelButton), &QAbstractButton::click); @@ -469,3 +447,23 @@ void HorizonWizard::accept() { done(QDialog::Accepted); } + +void HorizonWizard::reject() { + /* REQ: UI.Global.Cancel.Confirm */ + QMessageBox cancel(QMessageBox::Question, + tr("Exit Adélie Linux System Installation"), + #ifdef HAS_INSTALL_ENV + tr("Adélie Linux has not yet been set up on your computer. Exiting will reboot your computer. Do you wish to exit?"), + #else + tr("You have not yet completed the System Installation wizard. No installfile will be generated. Do you wish to exit?"), + #endif + QMessageBox::Yes | QMessageBox::No, + this); + cancel.setDefaultButton(QMessageBox::No); + + if(cancel.exec() == QMessageBox::Yes) { + done(QDialog::Rejected); + } else { + return; + } +} |