From 8469fbd2e82c8008ed333007658f16cd2e4e3271 Mon Sep 17 00:00:00 2001 From: Penvern Vincent Date: Tue, 16 Apr 2024 18:08:11 +0200 Subject: [PATCH] Fix Next button behviour for all combinations of enableLuksAutomatedPartitioning and preCheckEncryption configure file variables --- src/modules/partition/gui/ChoicePage.cpp | 12 +++++------- src/modules/partition/gui/EncryptWidget.cpp | 16 ++++++++-------- src/modules/partition/gui/EncryptWidget.h | 1 + 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/modules/partition/gui/ChoicePage.cpp b/src/modules/partition/gui/ChoicePage.cpp index b2396ebc0..3824f4c54 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,11 +467,8 @@ ChoicePage::onActionChanged() { m_encryptWidget->setFilesystem( FileSystem::typeForName( m_replaceFsTypesChoiceComboBox->currentText() ) ); } - - if ( m_config->preCheckEncryption() ) - { - m_encryptWidget->setEncryptionCheckbox( m_config->preCheckEncryption() ); - } + + m_encryptWidget->setEncryptionCheckbox( m_config->preCheckEncryption() ); } Device* currd = selectedDevice(); @@ -1580,7 +1576,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 3d5f122f2..562166a6b 100644 --- a/src/modules/partition/gui/EncryptWidget.cpp +++ b/src/modules/partition/gui/EncryptWidget.cpp @@ -70,6 +70,11 @@ 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 ); @@ -174,15 +179,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 8833f61ad..c7cc23daa 100644 --- a/src/modules/partition/gui/EncryptWidget.h +++ b/src/modules/partition/gui/EncryptWidget.h @@ -39,6 +39,7 @@ public: void setEncryptionCheckbox( bool preCheckEncrypt = false); void reset( bool checkVisible = true ); + bool isEncryptionCheckboxChecked(); Encryption state() const; void setText( const QString& text );