Apply partitioning action choice separately from preview, and update.

This commit is contained in:
Teo Mrnjavac 2015-11-05 15:57:15 +01:00
parent e59418e880
commit 368d3fe747
2 changed files with 26 additions and 6 deletions

View File

@ -258,12 +258,6 @@ ChoicePage::setupChoices()
if ( checked )
{
m_choice = Erase;
if ( m_core->isDirty() )
m_core->clearJobs();
PartitionActions::doAutopartition( m_core, selectedDevice() );
setNextEnabled( true );
emit actionChosen();
}
@ -301,6 +295,7 @@ ChoicePage::setupChoices()
Device* currd = selectedDevice();
if ( currd )
{
applyActionChoice( currd, currentChoice() );
updateActionChoicePreview( currd, currentChoice() );
}
} );
@ -352,6 +347,9 @@ ChoicePage::applyDeviceChoice()
{
Device* currd = selectedDevice();
if ( m_core->isDirty() )
m_core->clearJobs();
// The device should only be nullptr immediately after a PCM reset.
// applyDeviceChoice() will be called again momentarily as soon as we handle the
// PartitionCoreModule::reverted signal.
@ -367,6 +365,27 @@ ChoicePage::applyDeviceChoice()
m_lastSelectedDeviceIndex = drivesCombo->currentIndex();
else
m_lastSelectedDeviceIndex = drivesList->selectionModel()->currentIndex().row();
emit actionChosen();
}
void
ChoicePage::applyActionChoice( Device* currentDevice, ChoicePage::Choice choice )
{
switch ( choice )
{
case Erase:
if ( m_core->isDirty() )
m_core->clearJobs();
PartitionActions::doAutopartition( m_core, selectedDevice() );
break;
case Replace:
case NoChoice:
case Manual:
break;
}
}

View File

@ -70,6 +70,7 @@ private:
Device* selectedDevice();
void applyDeviceChoice();
void updateDeviceStatePreview( Device* currentDevice );
void applyActionChoice( Device* currentDevice, ChoicePage::Choice choice );
void updateActionChoicePreview( Device* currentDevice, ChoicePage::Choice choice );
void setupActions( Device* currentDevice );