diff --git a/src/modules/partition/gui/ChoicePage.cpp b/src/modules/partition/gui/ChoicePage.cpp index fffe9f3fb..393054ba2 100644 --- a/src/modules/partition/gui/ChoicePage.cpp +++ b/src/modules/partition/gui/ChoicePage.cpp @@ -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; + } } diff --git a/src/modules/partition/gui/ChoicePage.h b/src/modules/partition/gui/ChoicePage.h index 44c565b19..232f2009b 100644 --- a/src/modules/partition/gui/ChoicePage.h +++ b/src/modules/partition/gui/ChoicePage.h @@ -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 );