[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:
parent
ca03dad67b
commit
bd57f1f2f1
@ -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();
|
||||
|
@ -42,7 +42,13 @@ class CreatePartitionDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CreatePartitionDialog( Device* device, PartitionNode* parentPartition, const QStringList& usedMountPoints, QWidget* parentWidget = nullptr );
|
||||
/**
|
||||
* @brief Dialog for editing a new partition.
|
||||
*
|
||||
* For the (unlikely) case that a newly created partition is being re-edited,
|
||||
* pass a pointer to that @p partition, otherwise pass nullptr.
|
||||
*/
|
||||
CreatePartitionDialog( Device* device, PartitionNode* parentPartition, Partition* partition, const QStringList& usedMountPoints, QWidget* parentWidget = nullptr );
|
||||
~CreatePartitionDialog();
|
||||
|
||||
/**
|
||||
|
@ -190,6 +190,7 @@ PartitionPage::onCreateClicked()
|
||||
|
||||
QPointer< CreatePartitionDialog > dlg = new CreatePartitionDialog( model->device(),
|
||||
partition->parent(),
|
||||
nullptr,
|
||||
getCurrentUsedMountpoints(),
|
||||
this );
|
||||
dlg->initFromFreeSpace( partition );
|
||||
@ -285,6 +286,7 @@ PartitionPage::updatePartitionToCreate( Device* device, Partition* partition )
|
||||
|
||||
QPointer< CreatePartitionDialog > dlg = new CreatePartitionDialog( device,
|
||||
partition->parent(),
|
||||
partition,
|
||||
mountPoints,
|
||||
this );
|
||||
dlg->initFromPartitionToCreate( partition );
|
||||
|
Loading…
Reference in New Issue
Block a user