[partition] Update icons on all state changes
The encryption widget (passphrase for disk encryption) should show ok / warning / error whenever the state changes; this avoids it showing up first with **no** icon (it should show a warning when both passphrases are empty).
This commit is contained in:
parent
0eb1f002db
commit
ef4c2666e1
@ -91,9 +91,39 @@ EncryptWidget::retranslate()
|
||||
}
|
||||
|
||||
|
||||
///@brief Give @p label the @p pixmap from the standard-pixmaps
|
||||
static void
|
||||
applyPixmap( QLabel* label, CalamaresUtils::ImageType pixmap )
|
||||
{
|
||||
label->setFixedWidth( label->height() );
|
||||
label->setPixmap( CalamaresUtils::defaultPixmap( pixmap, CalamaresUtils::Original, label->size() ) );
|
||||
}
|
||||
|
||||
void
|
||||
EncryptWidget::updateState()
|
||||
{
|
||||
if ( m_ui->m_passphraseLineEdit->isVisible() )
|
||||
{
|
||||
QString p1 = m_ui->m_passphraseLineEdit->text();
|
||||
QString p2 = m_ui->m_confirmLineEdit->text();
|
||||
|
||||
if ( p1.isEmpty() && p2.isEmpty() )
|
||||
{
|
||||
applyPixmap( m_ui->m_iconLabel, CalamaresUtils::StatusWarning );
|
||||
m_ui->m_iconLabel->setToolTip( tr( "Please enter the same passphrase in both boxes." ) );
|
||||
}
|
||||
else if ( p1 == p2 )
|
||||
{
|
||||
applyPixmap( m_ui->m_iconLabel, CalamaresUtils::StatusOk );
|
||||
m_ui->m_iconLabel->setToolTip( QString() );
|
||||
}
|
||||
else
|
||||
{
|
||||
applyPixmap( m_ui->m_iconLabel, CalamaresUtils::StatusError );
|
||||
m_ui->m_iconLabel->setToolTip( tr( "Please enter the same passphrase in both boxes." ) );
|
||||
}
|
||||
}
|
||||
|
||||
Encryption newState;
|
||||
if ( m_ui->m_encryptCheckBox->isChecked() )
|
||||
{
|
||||
@ -119,14 +149,6 @@ EncryptWidget::updateState()
|
||||
}
|
||||
}
|
||||
|
||||
///@brief Give @p label the @p pixmap from the standard-pixmaps
|
||||
static void
|
||||
applyPixmap( QLabel* label, CalamaresUtils::ImageType pixmap )
|
||||
{
|
||||
label->setFixedWidth( label->height() );
|
||||
label->setPixmap( CalamaresUtils::defaultPixmap( pixmap, CalamaresUtils::Original, label->size() ) );
|
||||
}
|
||||
|
||||
void
|
||||
EncryptWidget::onPassphraseEdited()
|
||||
{
|
||||
@ -135,25 +157,6 @@ EncryptWidget::onPassphraseEdited()
|
||||
m_ui->m_iconLabel->show();
|
||||
}
|
||||
|
||||
QString p1 = m_ui->m_passphraseLineEdit->text();
|
||||
QString p2 = m_ui->m_confirmLineEdit->text();
|
||||
|
||||
m_ui->m_iconLabel->setToolTip( QString() );
|
||||
if ( p1.isEmpty() && p2.isEmpty() )
|
||||
{
|
||||
applyPixmap( m_ui->m_iconLabel, CalamaresUtils::StatusWarning );
|
||||
m_ui->m_iconLabel->setToolTip( tr( "Please enter the same passphrase in both boxes." ) );
|
||||
}
|
||||
else if ( p1 == p2 )
|
||||
{
|
||||
applyPixmap( m_ui->m_iconLabel, CalamaresUtils::StatusOk );
|
||||
}
|
||||
else
|
||||
{
|
||||
applyPixmap( m_ui->m_iconLabel, CalamaresUtils::StatusError );
|
||||
m_ui->m_iconLabel->setToolTip( tr( "Please enter the same passphrase in both boxes." ) );
|
||||
}
|
||||
|
||||
updateState();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user