[partition] Move encryption state-calculation to state()
Previously, state() just returned a stored state, which changed via updateState(). However, when updateState() started taking visibility-of-the-widget into account, it became possible to de-sync the *apparent* state of the encryption widget, from the stored one: - make an encryption widget, which is not visible - show it. Now the stored-state takes visibility into account that is different (hidden, so we end up with a state of Unconfirmed) from the apparent value (shown and unchecked). Move the calculation to state() instead, so whenever queried, it checks the current checks-and-visibility values. Restore the previously-reverted bit for accepting LUKS partitions. SEE #1935 SEE #1953
This commit is contained in:
parent
900700b9bc
commit
0a4e6804c6
@ -85,7 +85,26 @@ EncryptWidget::reset( bool checkVisible )
|
||||
EncryptWidget::Encryption
|
||||
EncryptWidget::state() const
|
||||
{
|
||||
return m_state;
|
||||
Encryption newState = Encryption::Unconfirmed;
|
||||
|
||||
if ( m_ui->m_encryptCheckBox->isChecked() || !m_ui->m_encryptCheckBox->isVisible() )
|
||||
{
|
||||
if ( !m_ui->m_passphraseLineEdit->text().isEmpty()
|
||||
&& m_ui->m_passphraseLineEdit->text() == m_ui->m_confirmLineEdit->text() )
|
||||
{
|
||||
newState = Encryption::Confirmed;
|
||||
}
|
||||
else
|
||||
{
|
||||
newState = Encryption::Unconfirmed;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
newState = Encryption::Disabled;
|
||||
}
|
||||
|
||||
return newState;
|
||||
}
|
||||
|
||||
|
||||
@ -148,23 +167,7 @@ EncryptWidget::updateState()
|
||||
}
|
||||
}
|
||||
|
||||
Encryption newState;
|
||||
if ( m_ui->m_encryptCheckBox->isChecked() )
|
||||
{
|
||||
if ( !m_ui->m_passphraseLineEdit->text().isEmpty()
|
||||
&& m_ui->m_passphraseLineEdit->text() == m_ui->m_confirmLineEdit->text() )
|
||||
{
|
||||
newState = Encryption::Confirmed;
|
||||
}
|
||||
else
|
||||
{
|
||||
newState = Encryption::Unconfirmed;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
newState = Encryption::Disabled;
|
||||
}
|
||||
Encryption newState = state();
|
||||
|
||||
if ( newState != m_state )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user