[libcalamaresui] Fix disable-cancel behavior

- d78bc0c5 added an early `return false` when cancel is disabled,
   before checking if we were at the last step; so last-step
   didn't get any special handling.
 - refactor so that last-step now gets special handling first,
   **then** disable-cancel handling, and then the usual case.
This commit is contained in:
Adriaan de Groot 2019-05-28 13:38:28 +02:00
parent 0c24a01eb9
commit 95009a5222

View File

@ -367,15 +367,17 @@ bool ViewManager::confirmCancelInstallation()
{
const auto* const settings = Calamares::Settings::instance();
// When we're at the very end, then it's always OK to exit.
if ( m_currentStep == m_steps.count() -1 && m_steps.last()->isAtEnd() )
return true;
// Not at the very end, cancel/quit might be disabled
if ( settings->disableCancel() )
return false;
if ( settings->disableCancelDuringExec() && stepIsExecute( m_steps, m_currentStep ) )
return false;
// If it's NOT the last page of the last step, we ask for confirmation
if ( !( m_currentStep == m_steps.count() -1 &&
m_steps.last()->isAtEnd() ) )
{
// Otherwise, confirm cancel/quit.
QString title = settings->isSetupMode()
? tr( "Cancel setup?" )
: tr( "Cancel installation?" );
@ -394,9 +396,6 @@ bool ViewManager::confirmCancelInstallation()
mb.button( QMessageBox::No )->setText( tr( "&No" ) );
int response = mb.exec();
return response == QMessageBox::Yes;
}
else // Means we're at the end, no need to confirm.
return true;
}
void