Show an "are you sure" prompt before install, if prompt-install is true.

This commit is contained in:
Teo Mrnjavac 2015-04-10 12:41:10 +02:00
parent fb677dbaf6
commit a8b8a3a455

View File

@ -24,6 +24,8 @@
#include "JobQueue.h" #include "JobQueue.h"
#include "modulesystem/ModuleManager.h" #include "modulesystem/ModuleManager.h"
#include "utils/Retranslator.h" #include "utils/Retranslator.h"
#include "Branding.h"
#include "Settings.h"
#include <QApplication> #include <QApplication>
#include <QBoxLayout> #include <QBoxLayout>
@ -238,6 +240,32 @@ ViewManager::next()
bool installing = false; bool installing = false;
if ( step->isAtEnd() ) 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.<br/><strong>You will not be able "
"to undo these changes.</strong>" )
.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_currentStep++;
m_stack->setCurrentIndex( m_currentStep ); m_stack->setCurrentIndex( m_currentStep );
step->onLeave(); step->onLeave();