Merge pull request #2316 from SixK/calamares

[partition] add option for the encryption checkbox to be checked by default
This commit is contained in:
dalto8 2024-04-28 15:58:43 +00:00 committed by GitHub
commit 1c1ade6816
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 36 additions and 11 deletions

View File

@ -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" );

View File

@ -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;
};

View File

@ -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() )
{

View File

@ -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 );
}
}

View File

@ -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 );

View File

@ -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.

View File

@ -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 }