commit
8f133fe113
@ -1442,46 +1442,75 @@ ChoicePage::currentChoice() const
|
||||
return m_choice;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ChoicePage::updateNextEnabled()
|
||||
bool
|
||||
ChoicePage::calculateNextEnabled() const
|
||||
{
|
||||
bool enabled = false;
|
||||
|
||||
auto sm_p = m_beforePartitionBarsView ? m_beforePartitionBarsView->selectionModel() : nullptr;
|
||||
|
||||
switch ( m_choice )
|
||||
{
|
||||
case NoChoice:
|
||||
enabled = false;
|
||||
break;
|
||||
cDebug() << "No partitioning choice";
|
||||
return false;
|
||||
case Replace:
|
||||
case Alongside:
|
||||
enabled = sm_p && sm_p->currentIndex().isValid();
|
||||
if ( !( sm_p && sm_p->currentIndex().isValid() ) )
|
||||
{
|
||||
cDebug() << "No partition selected";
|
||||
return false;
|
||||
}
|
||||
enabled = true;
|
||||
break;
|
||||
case Erase:
|
||||
case Manual:
|
||||
enabled = true;
|
||||
}
|
||||
|
||||
if ( m_isEfi &&
|
||||
( m_choice == Alongside ||
|
||||
m_choice == Replace ) )
|
||||
if (!enabled)
|
||||
{
|
||||
if ( m_core->efiSystemPartitions().count() == 0 )
|
||||
enabled = false;
|
||||
cDebug() << "No valid choice made";
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( m_choice != Manual &&
|
||||
m_encryptWidget->isVisible() &&
|
||||
m_encryptWidget->state() == EncryptWidget::Encryption::Unconfirmed )
|
||||
enabled = false;
|
||||
|
||||
if ( enabled == m_nextEnabled )
|
||||
return;
|
||||
if ( m_isEfi && ( m_choice == Alongside || m_choice == Replace ) )
|
||||
{
|
||||
if ( m_core->efiSystemPartitions().count() == 0 )
|
||||
{
|
||||
cDebug() << "No EFI partition for alongside or replace";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
m_nextEnabled = enabled;
|
||||
emit nextStatusChanged( enabled );
|
||||
if ( m_choice != Manual && m_encryptWidget->isVisible() )
|
||||
{
|
||||
switch ( m_encryptWidget->state() )
|
||||
{
|
||||
case EncryptWidget::Encryption::Unconfirmed:
|
||||
cDebug() << "No passphrase provided";
|
||||
return false;
|
||||
case EncryptWidget::Encryption::Disabled:
|
||||
case EncryptWidget::Encryption::Confirmed:
|
||||
// Checkbox not checked, **or** passphrases match
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ChoicePage::updateNextEnabled()
|
||||
{
|
||||
bool enabled = calculateNextEnabled();
|
||||
|
||||
if ( enabled != m_nextEnabled )
|
||||
{
|
||||
m_nextEnabled = enabled;
|
||||
emit nextStatusChanged( enabled );
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -126,6 +126,7 @@ private slots:
|
||||
void onEraseSwapChoiceChanged();
|
||||
|
||||
private:
|
||||
bool calculateNextEnabled() const;
|
||||
void updateNextEnabled();
|
||||
void setupChoices();
|
||||
QComboBox* createBootloaderComboBox( QWidget* parentButton );
|
||||
|
@ -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,24 +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() )
|
||||
{
|
||||
m_ui->m_iconLabel->clear();
|
||||
}
|
||||
else if ( p1 == p2 )
|
||||
{
|
||||
applyPixmap( m_ui->m_iconLabel, CalamaresUtils::Yes );
|
||||
}
|
||||
else
|
||||
{
|
||||
applyPixmap( m_ui->m_iconLabel, CalamaresUtils::No );
|
||||
m_ui->m_iconLabel->setToolTip( tr( "Please enter the same passphrase in both boxes." ) );
|
||||
}
|
||||
|
||||
updateState();
|
||||
}
|
||||
|
||||
|
@ -107,8 +107,8 @@ PartitionViewStep::continueLoading()
|
||||
m_waitingWidget->deleteLater();
|
||||
m_waitingWidget = nullptr;
|
||||
|
||||
connect( m_core, &PartitionCoreModule::hasRootMountPointChanged, this, &PartitionViewStep::nextStatusChanged );
|
||||
connect( m_choicePage, &ChoicePage::nextStatusChanged, this, &PartitionViewStep::nextStatusChanged );
|
||||
connect( m_core, &PartitionCoreModule::hasRootMountPointChanged, this, &PartitionViewStep::nextPossiblyChanged );
|
||||
connect( m_choicePage, &ChoicePage::nextStatusChanged, this, &PartitionViewStep::nextPossiblyChanged );
|
||||
}
|
||||
|
||||
|
||||
@ -348,6 +348,11 @@ PartitionViewStep::isNextEnabled() const
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
PartitionViewStep::nextPossiblyChanged(bool)
|
||||
{
|
||||
emit nextStatusChanged( isNextEnabled() );
|
||||
}
|
||||
|
||||
bool
|
||||
PartitionViewStep::isBackEnabled() const
|
||||
|
@ -78,6 +78,9 @@ private:
|
||||
void initPartitionCoreModule();
|
||||
void continueLoading();
|
||||
|
||||
/// "slot" for changes to next-status from the KPMCore and ChoicePage
|
||||
void nextPossiblyChanged( bool );
|
||||
|
||||
PartitionCoreModule* m_core;
|
||||
QStackedWidget* m_widget;
|
||||
ChoicePage* m_choicePage;
|
||||
|
Loading…
Reference in New Issue
Block a user