From 42316fe6dc3304d9706a7ca2c78dde264d431b0d Mon Sep 17 00:00:00 2001 From: Teo Mrnjavac Date: Mon, 29 Jun 2015 10:48:50 +0200 Subject: [PATCH] Do ask for confirmation if quitting during install phase. --- src/libcalamaresui/ViewManager.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/libcalamaresui/ViewManager.cpp b/src/libcalamaresui/ViewManager.cpp index a255874f0..9f5e05229 100644 --- a/src/libcalamaresui/ViewManager.cpp +++ b/src/libcalamaresui/ViewManager.cpp @@ -76,13 +76,18 @@ ViewManager::ViewManager( QObject* parent ) bottomLayout->addSpacing( 12 ); bottomLayout->addWidget( m_quit ); + connect( m_next, &QPushButton::clicked, this, &ViewManager::next ); + connect( m_back, &QPushButton::clicked, this, &ViewManager::back ); + m_back->setEnabled( false ); + + m_installationViewStep = new InstallationViewStep( this ); + connect( m_quit, &QPushButton::clicked, this, [this]() { - if ( m_currentStep == m_steps.count() -1 && - m_steps.last()->isAtEnd() ) - qApp->quit(); - else + if ( m_steps.at( m_currentStep ) == m_installationViewStep || + !( m_currentStep == m_steps.count() -1 && + m_steps.last()->isAtEnd() ) ) { int response = QMessageBox::question( m_widget, tr( "Cancel installation?" ), @@ -93,12 +98,11 @@ ViewManager::ViewManager( QObject* parent ) if ( response == QMessageBox::Yes ) qApp->quit(); } + else //we're at the end + { + qApp->quit(); + } } ); - connect( m_next, &QPushButton::clicked, this, &ViewManager::next ); - connect( m_back, &QPushButton::clicked, this, &ViewManager::back ); - m_back->setEnabled( false ); - - m_installationViewStep = new InstallationViewStep( this ); }