[partition] defuse is-next-enabled

Both the KPMCore and the ChoicePage -- asynchronously -- were connected
to the nextStatusChanged() signal. So if the core said next was true,
that could end up communicated to the ViewManager, enabling the *next*
button in the UI.

Changing to the *erase* page generally triggers a KPMCore reload,
which later emits a `hasRootMountPointChanged()` signal, once the
layout is applied and the disk gets a root mount point. So we'd
get a `true` from KPMCore, which -- because it was connected directly
to the signal to the VM -- would override any other considerations.

Hook up both signals to an intermediate slot that just recalculates
whether the next button should be enabled, based on the state
both of the Choice page and whatever else.
This commit is contained in:
Adriaan de Groot 2020-07-29 14:13:43 +02:00
parent f1c4caba48
commit 0eb1f002db
2 changed files with 10 additions and 2 deletions

View file

@ -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

View file

@ -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;