[partition] Fix re-editing a newly created partition

- If there is a partition already (newly) created, then pass that
   to the dialog so that it can use the setings previously applied
   (e.g. mount point and flags).
 - This avoids the case where you create or format a partition,
   then click on it again to edit it and the previous settings are lost.
This commit is contained in:
Adriaan de Groot 2018-05-16 09:14:50 -04:00
parent ca03dad67b
commit bd57f1f2f1
3 changed files with 12 additions and 4 deletions

View file

@ -57,7 +57,7 @@ static QSet< FileSystem::Type > s_unmountableFS(
FileSystem::Lvm2_PV
} );
CreatePartitionDialog::CreatePartitionDialog( Device* device, PartitionNode* parentPartition, const QStringList& usedMountPoints, QWidget* parentWidget )
CreatePartitionDialog::CreatePartitionDialog( Device* device, PartitionNode* parentPartition, Partition* partition, const QStringList& usedMountPoints, QWidget* parentWidget )
: QDialog( parentWidget )
, m_ui( new Ui_CreatePartitionDialog )
, m_partitionSizeController( new PartitionSizeController( this ) )
@ -82,7 +82,7 @@ CreatePartitionDialog::CreatePartitionDialog( Device* device, PartitionNode* par
m_ui->lvNameLineEdit->setValidator(validator);
}
standardMountPoints( *(m_ui->mountPointComboBox) );
standardMountPoints( *(m_ui->mountPointComboBox), partition ? PartitionInfo::mountPoint( partition ) : QString() );
if ( device->partitionTable()->type() == PartitionTable::msdos ||
device->partitionTable()->type() == PartitionTable::msdos_sectorbased )
@ -121,7 +121,7 @@ CreatePartitionDialog::CreatePartitionDialog( Device* device, PartitionNode* par
m_ui->fsComboBox->setCurrentIndex( defaultFsIndex );
updateMountPointUi();
setFlagList( *(m_ui->m_listFlags), static_cast< PartitionTable::Flags >( ~PartitionTable::Flags::Int(0) ), PartitionTable::Flags() );
setFlagList( *(m_ui->m_listFlags), static_cast< PartitionTable::Flags >( ~PartitionTable::Flags::Int(0) ), partition ? PartitionInfo::flags( partition ) : PartitionTable::Flags() );
// Checks the initial selection.
checkMountPointSelection();