[partition] Polish up debugging when checking for next-enabled

- Improve the messages a bit
- Remove useless variable (it is checking that the switch(choice)
  statement covers all the cases; let's leave that to the compiler)
This commit is contained in:
Adriaan de Groot 2022-05-20 11:54:45 +02:00
parent 17814410e9
commit 51e3ac0ded

View File

@ -1610,35 +1610,27 @@ ChoicePage::isNextEnabled() const
bool bool
ChoicePage::calculateNextEnabled() const ChoicePage::calculateNextEnabled() const
{ {
bool enabled = false;
auto sm_p = m_beforePartitionBarsView ? m_beforePartitionBarsView->selectionModel() : nullptr; auto sm_p = m_beforePartitionBarsView ? m_beforePartitionBarsView->selectionModel() : nullptr;
switch ( m_config->installChoice() ) switch ( m_config->installChoice() )
{ {
case InstallChoice::NoChoice: case InstallChoice::NoChoice:
cDebug() << "No partitioning choice"; cDebug() << "No partitioning choice has been made yet";
return false; return false;
case InstallChoice::Replace: case InstallChoice::Replace:
case InstallChoice::Alongside: case InstallChoice::Alongside:
if ( !( sm_p && sm_p->currentIndex().isValid() ) ) if ( !( sm_p && sm_p->currentIndex().isValid() ) )
{ {
cDebug() << "No partition selected"; cDebug() << "No partition selected for alongside or replace";
return false; return false;
} }
enabled = true;
break; break;
case InstallChoice::Erase: case InstallChoice::Erase:
case InstallChoice::Manual: case InstallChoice::Manual:
enabled = true; // Nothing to check for these
break;
} }
if ( !enabled )
{
cDebug() << "No valid choice made";
return false;
}
if ( m_isEfi if ( m_isEfi
&& ( m_config->installChoice() == InstallChoice::Alongside && ( m_config->installChoice() == InstallChoice::Alongside
|| m_config->installChoice() == InstallChoice::Replace ) ) || m_config->installChoice() == InstallChoice::Replace ) )
@ -1655,7 +1647,7 @@ ChoicePage::calculateNextEnabled() const
switch ( m_encryptWidget->state() ) switch ( m_encryptWidget->state() )
{ {
case EncryptWidget::Encryption::Unconfirmed: case EncryptWidget::Encryption::Unconfirmed:
cDebug() << "No passphrase provided"; cDebug() << "No passphrase provided or passphrase mismatch.";
return false; return false;
case EncryptWidget::Encryption::Disabled: case EncryptWidget::Encryption::Disabled:
case EncryptWidget::Encryption::Confirmed: case EncryptWidget::Encryption::Confirmed: