add possibility to pre check encryption checkox

This commit is contained in:
Penvern Vincent 2024-04-13 02:09:09 +02:00
parent 131b2eded1
commit 70a59d6cd1
7 changed files with 22 additions and 0 deletions

View File

@ -698,6 +698,8 @@ PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap )
Calamares::getBool( configurationMap, "alwaysShowPartitionLabels", true ) ); Calamares::getBool( configurationMap, "alwaysShowPartitionLabels", true ) );
gs->insert( "enableLuksAutomatedPartitioning", gs->insert( "enableLuksAutomatedPartitioning",
Calamares::getBool( configurationMap, "enableLuksAutomatedPartitioning", true ) ); Calamares::getBool( configurationMap, "enableLuksAutomatedPartitioning", true ) );
gs->insert( "preCheckEncryption",
Calamares::getBool( configurationMap, "preCheckEncryption", false ) );
QString partitionTableName = Calamares::getString( configurationMap, "defaultPartitionTableType" ); QString partitionTableName = Calamares::getString( configurationMap, "defaultPartitionTableType" );
if ( partitionTableName.isEmpty() ) if ( partitionTableName.isEmpty() )

View File

@ -83,12 +83,14 @@ ChoicePage::ChoicePage( Config* config, QWidget* parent )
, m_beforePartitionLabelsView( nullptr ) , m_beforePartitionLabelsView( nullptr )
, m_bootloaderComboBox( nullptr ) , m_bootloaderComboBox( nullptr )
, m_enableEncryptionWidget( true ) , m_enableEncryptionWidget( true )
, m_preCheckEncryption( false )
{ {
setupUi( this ); setupUi( this );
auto gs = Calamares::JobQueue::instance()->globalStorage(); auto gs = Calamares::JobQueue::instance()->globalStorage();
m_enableEncryptionWidget = gs->value( "enableLuksAutomatedPartitioning" ).toBool(); m_enableEncryptionWidget = gs->value( "enableLuksAutomatedPartitioning" ).toBool();
m_preCheckEncryption = gs->value( "preCheckEncryption" ).toBool();
// Set up drives combo // Set up drives combo
m_mainLayout->setDirection( QBoxLayout::TopToBottom ); m_mainLayout->setDirection( QBoxLayout::TopToBottom );
@ -468,6 +470,11 @@ ChoicePage::onActionChanged()
{ {
m_encryptWidget->setFilesystem( FileSystem::typeForName( m_replaceFsTypesChoiceComboBox->currentText() ) ); m_encryptWidget->setFilesystem( FileSystem::typeForName( m_replaceFsTypesChoiceComboBox->currentText() ) );
} }
if ( m_preCheckEncryption )
{
m_encryptWidget->setEncryptionCheckbox( m_preCheckEncryption );
}
} }
Device* currd = selectedDevice(); Device* currd = selectedDevice();

View File

@ -170,6 +170,7 @@ private:
int m_lastSelectedDeviceIndex = -1; int m_lastSelectedDeviceIndex = -1;
bool m_enableEncryptionWidget = false; bool m_enableEncryptionWidget = false;
bool m_preCheckEncryption = false;
QMutex m_coreMutex; QMutex m_coreMutex;
}; };

View File

@ -70,6 +70,11 @@ EncryptWidget::EncryptWidget( QWidget* parent )
CALAMARES_RETRANSLATE_SLOT( &EncryptWidget::retranslate ); CALAMARES_RETRANSLATE_SLOT( &EncryptWidget::retranslate );
} }
void EncryptWidget::setEncryptionCheckbox( bool preCheckEncrypt)
{
m_ui->m_encryptCheckBox->setChecked( preCheckEncrypt );
}
void void
EncryptWidget::reset( bool checkVisible ) EncryptWidget::reset( bool checkVisible )
{ {

View File

@ -36,6 +36,7 @@ public:
explicit EncryptWidget( QWidget* parent = nullptr ); explicit EncryptWidget( QWidget* parent = nullptr );
void setEncryptionCheckbox( bool preCheckEncrypt = false);
void reset( bool checkVisible = true ); void reset( bool checkVisible = true );
Encryption state() const; Encryption state() const;

View File

@ -240,6 +240,11 @@ defaultFileSystemType: "ext4"
# If nothing is specified, LUKS is enabled in automated modes. # If nothing is specified, LUKS is enabled in automated modes.
#enableLuksAutomatedPartitioning: true #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. # Partition layout.
# #
# This optional setting specifies a custom 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" luksGeneration: { type: string, enum: [luks1, luks2] } # Also allows "luks" as alias of "luks1"
enableLuksAutomatedPartitioning: { type: boolean, default: false } enableLuksAutomatedPartitioning: { type: boolean, default: false }
preCheckEncryption: { type: boolean, default: false }
allowManualPartitioning: { type: boolean, default: true } allowManualPartitioning: { type: boolean, default: true }
showNotEncryptedBootMessage: { type: boolean, default: true } showNotEncryptedBootMessage: { type: boolean, default: true }