From 2759529841d91129a57296abbed5fc2e0e0610f9 Mon Sep 17 00:00:00 2001 From: shainer Date: Sun, 20 Nov 2016 23:19:33 +0000 Subject: [PATCH] Remove current partition's mountpoint from used list. This means that when we edit a partition, we don't consider its current mountpoint invalid because it is already in-use. We need to do this for both "edit existing partition" and "edit a partition that we are still creating". --- .../partition/gui/EditExistingPartitionDialog.cpp | 2 -- src/modules/partition/gui/PartitionPage.cpp | 10 ++++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/modules/partition/gui/EditExistingPartitionDialog.cpp b/src/modules/partition/gui/EditExistingPartitionDialog.cpp index a11aec48b..5aa1e21f6 100644 --- a/src/modules/partition/gui/EditExistingPartitionDialog.cpp +++ b/src/modules/partition/gui/EditExistingPartitionDialog.cpp @@ -62,8 +62,6 @@ EditExistingPartitionDialog::EditExistingPartitionDialog( Device* device, Partit mountPoints.sort(); m_ui->mountPointComboBox->addItems( mountPoints ); - m_usedMountPoints.removeOne( PartitionInfo::mountPoint( partition ) ); - QColor color = ColorUtils::colorForPartition( m_partition ); m_partitionSizeController->init( m_device, m_partition, color ); m_partitionSizeController->setSpinBox( m_ui->sizeSpinBox ); diff --git a/src/modules/partition/gui/PartitionPage.cpp b/src/modules/partition/gui/PartitionPage.cpp index 6fa64fda8..5e3239050 100644 --- a/src/modules/partition/gui/PartitionPage.cpp +++ b/src/modules/partition/gui/PartitionPage.cpp @@ -266,7 +266,10 @@ PartitionPage::onPartitionViewActivated() void PartitionPage::updatePartitionToCreate( Device* device, Partition* partition ) { - QPointer dlg = new CreatePartitionDialog( device, partition->parent(), getCurrentUsedMountpoints(), this ); + QStringList mountPoints = getCurrentUsedMountpoints(); + mountPoints.removeOne( PartitionInfo::mountPoint( partition ) ); + + QPointer dlg = new CreatePartitionDialog( device, partition->parent(), mountPoints, this ); dlg->initFromPartitionToCreate( partition ); if ( dlg->exec() == QDialog::Accepted ) { @@ -280,7 +283,10 @@ PartitionPage::updatePartitionToCreate( Device* device, Partition* partition ) void PartitionPage::editExistingPartition( Device* device, Partition* partition ) { - QPointer dlg = new EditExistingPartitionDialog( device, partition, getCurrentUsedMountpoints(), this ); + QStringList mountPoints = getCurrentUsedMountpoints(); + mountPoints.removeOne( PartitionInfo::mountPoint( partition ) ); + + QPointer dlg = new EditExistingPartitionDialog( device, partition, mountPoints, this ); if ( dlg->exec() == QDialog::Accepted ) dlg->applyChanges( m_core ); delete dlg;