diff --git a/settings.conf b/settings.conf index 1c95721b7..2be482d44 100644 --- a/settings.conf +++ b/settings.conf @@ -146,3 +146,12 @@ prompt-install: false # # YAML: boolean. dont-chroot: false + +# If this is set to true, the "Cancel" button will be disabled. +# This can be useful if when e.g. calamares is used as a post-install configuration +# tool and you require the user to go through all the configuration steps. +# +# Default is false. +# +# YAML: boolean. +disable-cancel: false diff --git a/src/libcalamares/Settings.cpp b/src/libcalamares/Settings.cpp index 8fd4eeac3..3a00399f4 100644 --- a/src/libcalamares/Settings.cpp +++ b/src/libcalamares/Settings.cpp @@ -81,6 +81,7 @@ Settings::Settings( const QString& settingsFilePath, , m_debug( debugMode ) , m_doChroot( true ) , m_promptInstall( false ) + , m_disableCancel( false ) { cDebug() << "Using Calamares settings file at" << settingsFilePath; QFile file( settingsFilePath ); @@ -183,6 +184,7 @@ Settings::Settings( const QString& settingsFilePath, m_brandingComponentName = requireString( config, "branding" ); m_promptInstall = requireBool( config, "prompt-install", false ); m_doChroot = !requireBool( config, "dont-chroot", false ); + m_disableCancel = requireBool( config, "disable-cancel", false ); } catch ( YAML::Exception& e ) { @@ -245,5 +247,11 @@ Settings::doChroot() const return m_doChroot; } +bool +Settings::disableCancel() const +{ + return m_disableCancel; +} + } diff --git a/src/libcalamares/Settings.h b/src/libcalamares/Settings.h index 4da65f710..4d7568c7d 100644 --- a/src/libcalamares/Settings.h +++ b/src/libcalamares/Settings.h @@ -58,6 +58,8 @@ public: bool doChroot() const; + bool disableCancel() const; + private: static Settings* s_instance; @@ -71,6 +73,7 @@ private: bool m_debug; bool m_doChroot; bool m_promptInstall; + bool m_disableCancel; }; } diff --git a/src/libcalamaresui/ViewManager.cpp b/src/libcalamaresui/ViewManager.cpp index 4d1f3591e..e222707ac 100644 --- a/src/libcalamaresui/ViewManager.cpp +++ b/src/libcalamaresui/ViewManager.cpp @@ -95,6 +95,10 @@ ViewManager::ViewManager( QObject* parent ) this, &ViewManager::onInstallationFailed ); connect( JobQueue::instance(), &JobQueue::finished, this, &ViewManager::next ); + + if (Calamares::Settings::instance()->disableCancel()) + m_quit->setVisible( false ); + } @@ -282,9 +286,13 @@ ViewManager::updateButtonLabels() { m_quit->setText( tr( "&Done" ) ); m_quit->setToolTip( tr( "The installation is complete. Close the installer." ) ); + if (Calamares::Settings::instance()->disableCancel()) + m_quit->setVisible( true ); } else { + if (Calamares::Settings::instance()->disableCancel()) + m_quit->setVisible( false ); m_quit->setText( tr( "&Cancel" ) ); m_quit->setToolTip( tr( "Cancel installation without changing the system." ) ); }