diff --git a/settings.conf b/settings.conf index 8135ef3db..bd0d307bd 100644 --- a/settings.conf +++ b/settings.conf @@ -163,3 +163,8 @@ dont-chroot: false # # YAML: boolean. disable-cancel: false + +# If this is set to true, the "Cancel" button will be disabled once +# you start the 'Installation', meaning there won't be a way to cancel +# the Installation until it has finished or installation has failed. +dont-cancel: false diff --git a/src/libcalamares/Settings.cpp b/src/libcalamares/Settings.cpp index 00f17c2b2..4b33fa2e7 100644 --- a/src/libcalamares/Settings.cpp +++ b/src/libcalamares/Settings.cpp @@ -1,5 +1,7 @@ /* === This file is part of Calamares - === * + * Copyright 2019, Dominic Hayes + * Copyright 2019, Gabriel Craciunescu * Copyright 2014-2015, Teo Mrnjavac * Copyright 2017-2018, Adriaan de Groot * @@ -183,6 +185,7 @@ Settings::Settings( const QString& settingsFilePath, , m_doChroot( true ) , m_promptInstall( false ) , m_disableCancel( false ) + , m_dontCancel( false ) { cDebug() << "Using Calamares settings file at" << settingsFilePath; QFile file( settingsFilePath ); @@ -204,6 +207,7 @@ Settings::Settings( const QString& settingsFilePath, m_doChroot = !requireBool( config, "dont-chroot", false ); m_isSetupMode = requireBool( config, "oem-setup", !m_doChroot ); m_disableCancel = requireBool( config, "disable-cancel", false ); + m_dontCancel = requireBool( config, "dont-cancel", false ); } catch ( YAML::Exception& e ) { @@ -271,6 +275,12 @@ Settings::disableCancel() const { return m_disableCancel; } + +bool +Settings::dontCancel() const +{ + return m_dontCancel; +} } diff --git a/src/libcalamares/Settings.h b/src/libcalamares/Settings.h index 0c0f0aa91..75c7886c9 100644 --- a/src/libcalamares/Settings.h +++ b/src/libcalamares/Settings.h @@ -1,5 +1,7 @@ /* === This file is part of Calamares - === * + * Copyright 2019, Dominic Hayes + * Copyright 2019, Gabriel Craciunescu * Copyright 2014-2015, Teo Mrnjavac * Copyright 2017-2018, Adriaan de Groot * @@ -68,6 +70,8 @@ public: bool isSetupMode() const { return m_isSetupMode; } bool disableCancel() const; + + bool dontCancel() const; private: static Settings* s_instance; @@ -84,6 +88,7 @@ private: bool m_isSetupMode; bool m_promptInstall; bool m_disableCancel; + bool m_dontCancel; }; } diff --git a/src/libcalamaresui/ViewManager.cpp b/src/libcalamaresui/ViewManager.cpp index f9a7c9e06..655e581ea 100644 --- a/src/libcalamaresui/ViewManager.cpp +++ b/src/libcalamaresui/ViewManager.cpp @@ -1,5 +1,7 @@ /* === This file is part of Calamares - === * + * Copyright 2019, Dominic Hayes + * Copyright 2019, Gabriel Craciunescu * Copyright 2014-2015, Teo Mrnjavac * Copyright 2017-2018, Adriaan de Groot * @@ -281,6 +283,8 @@ ViewManager::next() { m_back->setEnabled( false ); m_next->setEnabled( false ); + if (Calamares::Settings::instance()->dontCancel()) + m_quit->setEnabled( false ); } } else