From fcd0e8d362d4d2586f24ec2ef68a5adbf8bdf57d Mon Sep 17 00:00:00 2001 From: Arnaud Ferraris Date: Mon, 7 Jan 2019 17:28:02 +0100 Subject: [PATCH] [partition] Apply partition layout when replacing free space When chosing the "Replace partition" option, free space is not handled like any partition. In order to apply the custom partition layout in that case too, we have to modify the code where "replace free space" is handled. Signed-off-by: Arnaud Ferraris --- src/modules/partition/gui/ChoicePage.cpp | 35 +++--------------------- 1 file changed, 4 insertions(+), 31 deletions(-) diff --git a/src/modules/partition/gui/ChoicePage.cpp b/src/modules/partition/gui/ChoicePage.cpp index 6b703cb00..cc32ca12a 100644 --- a/src/modules/partition/gui/ChoicePage.cpp +++ b/src/modules/partition/gui/ChoicePage.cpp @@ -745,37 +745,10 @@ ChoicePage::doReplaceSelectedPartition( const QModelIndex& current ) } } - Partition* newPartition = nullptr; - if ( m_encryptWidget->state() == EncryptWidget::EncryptionConfirmed ) - { - newPartition = KPMHelpers::createNewEncryptedPartition( - newParent, - *selectedDevice(), - newRoles, - FileSystem::typeForName( m_defaultFsType ), - selectedPartition->firstSector(), - selectedPartition->lastSector(), - m_encryptWidget->passphrase(), - PartitionTable::FlagNone - ); - } - else - { - newPartition = KPMHelpers::createNewPartition( - newParent, - *selectedDevice(), - newRoles, - FileSystem::typeForName( m_defaultFsType ), - selectedPartition->firstSector(), - selectedPartition->lastSector(), - PartitionTable::FlagNone - ); - } - - PartitionInfo::setMountPoint( newPartition, "/" ); - PartitionInfo::setFormat( newPartition, true ); - - m_core->createPartition( selectedDevice(), newPartition); + m_core->layoutApply( selectedDevice(), selectedPartition->firstSector(), + selectedPartition->lastSector(), + m_encryptWidget->passphrase(), newParent, newRoles + ); } else {