Merge pull request #1126 from feren/patch-3

Patch to add 'dont-cancel' setting to disable Cancel only during the installation phase
This commit is contained in:
Adriaan de Groot 2019-04-21 17:02:21 +02:00 committed by GitHub
commit 10727c7bd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 0 deletions

View File

@ -163,3 +163,8 @@ dont-chroot: false
# #
# YAML: boolean. # YAML: boolean.
disable-cancel: false 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

View File

@ -1,5 +1,7 @@
/* === This file is part of Calamares - <https://github.com/calamares> === /* === This file is part of Calamares - <https://github.com/calamares> ===
* *
* Copyright 2019, Dominic Hayes <ferenosdev@outlook.com>
* Copyright 2019, Gabriel Craciunescu <crazy@frugalware.org>
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org> * Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
* Copyright 2017-2018, Adriaan de Groot <groot@kde.org> * Copyright 2017-2018, Adriaan de Groot <groot@kde.org>
* *
@ -183,6 +185,7 @@ Settings::Settings( const QString& settingsFilePath,
, m_doChroot( true ) , m_doChroot( true )
, m_promptInstall( false ) , m_promptInstall( false )
, m_disableCancel( false ) , m_disableCancel( false )
, m_dontCancel( false )
{ {
cDebug() << "Using Calamares settings file at" << settingsFilePath; cDebug() << "Using Calamares settings file at" << settingsFilePath;
QFile file( settingsFilePath ); QFile file( settingsFilePath );
@ -204,6 +207,7 @@ Settings::Settings( const QString& settingsFilePath,
m_doChroot = !requireBool( config, "dont-chroot", false ); m_doChroot = !requireBool( config, "dont-chroot", false );
m_isSetupMode = requireBool( config, "oem-setup", !m_doChroot ); m_isSetupMode = requireBool( config, "oem-setup", !m_doChroot );
m_disableCancel = requireBool( config, "disable-cancel", false ); m_disableCancel = requireBool( config, "disable-cancel", false );
m_dontCancel = requireBool( config, "dont-cancel", false );
} }
catch ( YAML::Exception& e ) catch ( YAML::Exception& e )
{ {
@ -272,5 +276,11 @@ Settings::disableCancel() const
return m_disableCancel; return m_disableCancel;
} }
bool
Settings::dontCancel() const
{
return m_dontCancel;
}
} }

View File

@ -1,5 +1,7 @@
/* === This file is part of Calamares - <https://github.com/calamares> === /* === This file is part of Calamares - <https://github.com/calamares> ===
* *
* Copyright 2019, Dominic Hayes <ferenosdev@outlook.com>
* Copyright 2019, Gabriel Craciunescu <crazy@frugalware.org>
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org> * Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
* Copyright 2017-2018, Adriaan de Groot <groot@kde.org> * Copyright 2017-2018, Adriaan de Groot <groot@kde.org>
* *
@ -69,6 +71,8 @@ public:
bool disableCancel() const; bool disableCancel() const;
bool dontCancel() const;
private: private:
static Settings* s_instance; static Settings* s_instance;
@ -84,6 +88,7 @@ private:
bool m_isSetupMode; bool m_isSetupMode;
bool m_promptInstall; bool m_promptInstall;
bool m_disableCancel; bool m_disableCancel;
bool m_dontCancel;
}; };
} }

View File

@ -1,5 +1,7 @@
/* === This file is part of Calamares - <https://github.com/calamares> === /* === This file is part of Calamares - <https://github.com/calamares> ===
* *
* Copyright 2019, Dominic Hayes <ferenosdev@outlook.com>
* Copyright 2019, Gabriel Craciunescu <crazy@frugalware.org>
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org> * Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
* Copyright 2017-2018, Adriaan de Groot <groot@kde.org> * Copyright 2017-2018, Adriaan de Groot <groot@kde.org>
* *
@ -281,6 +283,8 @@ ViewManager::next()
{ {
m_back->setEnabled( false ); m_back->setEnabled( false );
m_next->setEnabled( false ); m_next->setEnabled( false );
if (Calamares::Settings::instance()->dontCancel())
m_quit->setEnabled( false );
} }
} }
else else