diff --git a/src/modules/partition/Config.cpp b/src/modules/partition/Config.cpp index 2010fecdd..f4e404c28 100644 --- a/src/modules/partition/Config.cpp +++ b/src/modules/partition/Config.cpp @@ -444,6 +444,7 @@ Config::setConfigurationMap( const QVariantMap& configurationMap ) m_allowZfsEncryption = Calamares::getBool( configurationMap, "allowZfsEncryption", true ); m_allowManualPartitioning = Calamares::getBool( configurationMap, "allowManualPartitioning", true ); + m_preCheckEncryption = Calamares::getBool( configurationMap, "preCheckEncryption", false ); m_showNotEncryptedBootMessage = Calamares::getBool( configurationMap, "showNotEncryptedBootMessage", true ); m_requiredPartitionTableType = Calamares::getStringList( configurationMap, "requiredPartitionTableType" ); diff --git a/src/modules/partition/Config.h b/src/modules/partition/Config.h index d8d68c6d2..199ddaf88 100644 --- a/src/modules/partition/Config.h +++ b/src/modules/partition/Config.h @@ -35,7 +35,7 @@ class Config : public QObject replaceModeFilesystemChanged ) Q_PROPERTY( bool allowManualPartitioning READ allowManualPartitioning CONSTANT FINAL ) - + Q_PROPERTY( bool preCheckEncryption READ preCheckEncryption CONSTANT FINAL ) Q_PROPERTY( bool showNotEncryptedBootMessage READ showNotEncryptedBootMessage CONSTANT FINAL ) public: @@ -148,6 +148,13 @@ public: /// @brief Is manual partitioning allowed (not explicitly disabled in the config file)? bool allowManualPartitioning() const { return m_allowManualPartitioning; } + /** @brief pre check encryption checkbox. + * + * parameter is used if enableLuksAutomatedPartitioning is true. + * Default value is false + */ + bool preCheckEncryption() const { return m_preCheckEncryption; } + /// @brief Show "Boot partition not encrypted" warning (not explicitly disabled in the config file)? bool showNotEncryptedBootMessage() const { return m_showNotEncryptedBootMessage; } @@ -199,6 +206,7 @@ private: QStringList m_requiredPartitionTableType; bool m_allowZfsEncryption = true; bool m_allowManualPartitioning = true; + bool m_preCheckEncryption = false; bool m_showNotEncryptedBootMessage = true; }; diff --git a/src/modules/partition/gui/ChoicePage.cpp b/src/modules/partition/gui/ChoicePage.cpp index 4ff9b772b..1d77fd75d 100644 --- a/src/modules/partition/gui/ChoicePage.cpp +++ b/src/modules/partition/gui/ChoicePage.cpp @@ -185,7 +185,6 @@ ChoicePage::init( PartitionCoreModule* core ) setModelToComboBox( m_drivesCombo, core->deviceModel() ); connect( m_drivesCombo, qOverload< int >( &QComboBox::currentIndexChanged ), this, &ChoicePage::applyDeviceChoice ); - connect( m_encryptWidget, &EncryptWidget::stateChanged, this, &ChoicePage::onEncryptWidgetStateChanged ); connect( m_reuseHomeCheckBox, &QCheckBox::stateChanged, this, &ChoicePage::onHomeCheckBoxStateChanged ); @@ -468,6 +467,8 @@ ChoicePage::onActionChanged() { m_encryptWidget->setFilesystem( FileSystem::typeForName( m_replaceFsTypesChoiceComboBox->currentText() ) ); } + + m_encryptWidget->setEncryptionCheckbox( m_config->preCheckEncryption() ); } Device* currd = selectedDevice(); @@ -1583,7 +1584,9 @@ ChoicePage::calculateNextEnabled() const } } - if ( m_config->installChoice() != InstallChoice::Manual && m_encryptWidget->isVisible() ) + if ( m_config->installChoice() != InstallChoice::Manual + && (m_encryptWidget->isVisible() || + m_encryptWidget->isEncryptionCheckboxChecked())) { switch ( m_encryptWidget->state() ) { diff --git a/src/modules/partition/gui/EncryptWidget.cpp b/src/modules/partition/gui/EncryptWidget.cpp index 73a6b6f8b..013018d25 100644 --- a/src/modules/partition/gui/EncryptWidget.cpp +++ b/src/modules/partition/gui/EncryptWidget.cpp @@ -70,6 +70,16 @@ EncryptWidget::EncryptWidget( QWidget* parent ) CALAMARES_RETRANSLATE_SLOT( &EncryptWidget::retranslate ); } +bool EncryptWidget::isEncryptionCheckboxChecked() +{ + return m_ui->m_encryptCheckBox->isChecked(); +} + +void EncryptWidget::setEncryptionCheckbox( bool preCheckEncrypt) +{ + m_ui->m_encryptCheckBox->setChecked( preCheckEncrypt ); +} + void EncryptWidget::reset( bool checkVisible ) { @@ -170,15 +180,10 @@ EncryptWidget::updateState( const bool notify ) } } - Encryption newState = state(); - - if ( newState != m_state ) + m_state = state(); + if ( notify ) { - m_state = newState; - if ( notify ) - { - Q_EMIT stateChanged( m_state ); - } + Q_EMIT stateChanged( m_state ); } } diff --git a/src/modules/partition/gui/EncryptWidget.h b/src/modules/partition/gui/EncryptWidget.h index 9669b4d21..c7cc23daa 100644 --- a/src/modules/partition/gui/EncryptWidget.h +++ b/src/modules/partition/gui/EncryptWidget.h @@ -36,8 +36,10 @@ public: explicit EncryptWidget( QWidget* parent = nullptr ); + void setEncryptionCheckbox( bool preCheckEncrypt = false); void reset( bool checkVisible = true ); + bool isEncryptionCheckboxChecked(); Encryption state() const; void setText( const QString& text ); diff --git a/src/modules/partition/partition.conf b/src/modules/partition/partition.conf index 0975179de..3d335432f 100644 --- a/src/modules/partition/partition.conf +++ b/src/modules/partition/partition.conf @@ -240,6 +240,11 @@ defaultFileSystemType: "ext4" # If nothing is specified, LUKS is enabled in automated modes. #enableLuksAutomatedPartitioning: true +# When enableLuksAutomatedPartitioning is true, this option will pre-check +# encryption checkbox. This option is only usefull to help people to not forget +# to cypher their disk when installing in enterprise (for exemple). +#preCheckEncryption: false + # Partition layout. # # This optional setting specifies a custom partition layout. diff --git a/src/modules/partition/partition.schema.yaml b/src/modules/partition/partition.schema.yaml index 769c1abae..65bc723f5 100644 --- a/src/modules/partition/partition.schema.yaml +++ b/src/modules/partition/partition.schema.yaml @@ -34,6 +34,7 @@ properties: luksGeneration: { type: string, enum: [luks1, luks2] } # Also allows "luks" as alias of "luks1" enableLuksAutomatedPartitioning: { type: boolean, default: false } + preCheckEncryption: { type: boolean, default: false } allowManualPartitioning: { type: boolean, default: true } showNotEncryptedBootMessage: { type: boolean, default: true }