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