[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.
main
Adriaan de Groot 6 years ago
parent 0c24a01eb9
commit 95009a5222

@ -367,15 +367,17 @@ bool ViewManager::confirmCancelInstallation()
{ {
const auto* const settings = Calamares::Settings::instance(); 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() ) if ( settings->disableCancel() )
return false; return false;
if ( settings->disableCancelDuringExec() && stepIsExecute( m_steps, m_currentStep ) ) if ( settings->disableCancelDuringExec() && stepIsExecute( m_steps, m_currentStep ) )
return false; return false;
// If it's NOT the last page of the last step, we ask for confirmation // Otherwise, confirm cancel/quit.
if ( !( m_currentStep == m_steps.count() -1 &&
m_steps.last()->isAtEnd() ) )
{
QString title = settings->isSetupMode() QString title = settings->isSetupMode()
? tr( "Cancel setup?" ) ? tr( "Cancel setup?" )
: tr( "Cancel installation?" ); : tr( "Cancel installation?" );
@ -395,9 +397,6 @@ bool ViewManager::confirmCancelInstallation()
int response = mb.exec(); int response = mb.exec();
return response == QMessageBox::Yes; return response == QMessageBox::Yes;
} }
else // Means we're at the end, no need to confirm.
return true;
}
void void
ViewManager::updateCancelEnabled( bool enabled ) ViewManager::updateCancelEnabled( bool enabled )

Loading…
Cancel
Save