From a8b8a3a4555a6f8f0eabe75430c78fc63de3cb71 Mon Sep 17 00:00:00 2001 From: Teo Mrnjavac Date: Fri, 10 Apr 2015 12:41:10 +0200 Subject: [PATCH] Show an "are you sure" prompt before install, if prompt-install is true. --- src/libcalamaresui/ViewManager.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/libcalamaresui/ViewManager.cpp b/src/libcalamaresui/ViewManager.cpp index d55403dca..eb5253129 100644 --- a/src/libcalamaresui/ViewManager.cpp +++ b/src/libcalamaresui/ViewManager.cpp @@ -24,6 +24,8 @@ #include "JobQueue.h" #include "modulesystem/ModuleManager.h" #include "utils/Retranslator.h" +#include "Branding.h" +#include "Settings.h" #include #include @@ -238,6 +240,32 @@ ViewManager::next() bool installing = false; if ( step->isAtEnd() ) { + // Special case when the user clicks next on the very last page in the Prepare phase + // and right before switching to the Install phase. + // Depending on Calamares::Settings, we show an "are you sure" prompt or not. + if ( Calamares::Settings::instance()->showPromptBeforeInstall() && + m_currentStep + 1 < m_steps.count() && + m_steps.at( m_currentStep + 1 ) == m_installationViewStep ) + { + int reply = + QMessageBox::question( m_widget, + tr( "Continue with setup?" ), + tr( "The %1 installer is about to make changes to your " + "disk in order to install %2.
You will not be able " + "to undo these changes." ) + .arg( Calamares::Branding::instance()->string( + Calamares::Branding::ShortProductName ) ) + .arg( Calamares::Branding::instance()->string( + Calamares::Branding::ShortVersionedName ) ), + tr( "&Install now" ), + tr( "Go &back" ), + QString(), + 0, + 1 ); + if ( reply == 1 ) + return; + } + m_currentStep++; m_stack->setCurrentIndex( m_currentStep ); step->onLeave();