[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
|
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 )
|
: QDialog( parentWidget )
|
||||||
, m_ui( new Ui_CreatePartitionDialog )
|
, m_ui( new Ui_CreatePartitionDialog )
|
||||||
, m_partitionSizeController( new PartitionSizeController( this ) )
|
, m_partitionSizeController( new PartitionSizeController( this ) )
|
||||||
@ -82,7 +82,7 @@ CreatePartitionDialog::CreatePartitionDialog( Device* device, PartitionNode* par
|
|||||||
m_ui->lvNameLineEdit->setValidator(validator);
|
m_ui->lvNameLineEdit->setValidator(validator);
|
||||||
}
|
}
|
||||||
|
|
||||||
standardMountPoints( *(m_ui->mountPointComboBox) );
|
standardMountPoints( *(m_ui->mountPointComboBox), partition ? PartitionInfo::mountPoint( partition ) : QString() );
|
||||||
|
|
||||||
if ( device->partitionTable()->type() == PartitionTable::msdos ||
|
if ( device->partitionTable()->type() == PartitionTable::msdos ||
|
||||||
device->partitionTable()->type() == PartitionTable::msdos_sectorbased )
|
device->partitionTable()->type() == PartitionTable::msdos_sectorbased )
|
||||||
@ -121,7 +121,7 @@ CreatePartitionDialog::CreatePartitionDialog( Device* device, PartitionNode* par
|
|||||||
m_ui->fsComboBox->setCurrentIndex( defaultFsIndex );
|
m_ui->fsComboBox->setCurrentIndex( defaultFsIndex );
|
||||||
updateMountPointUi();
|
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.
|
// Checks the initial selection.
|
||||||
checkMountPointSelection();
|
checkMountPointSelection();
|
||||||
|
@ -42,7 +42,13 @@ class CreatePartitionDialog : public QDialog
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
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();
|
~CreatePartitionDialog();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -190,6 +190,7 @@ PartitionPage::onCreateClicked()
|
|||||||
|
|
||||||
QPointer< CreatePartitionDialog > dlg = new CreatePartitionDialog( model->device(),
|
QPointer< CreatePartitionDialog > dlg = new CreatePartitionDialog( model->device(),
|
||||||
partition->parent(),
|
partition->parent(),
|
||||||
|
nullptr,
|
||||||
getCurrentUsedMountpoints(),
|
getCurrentUsedMountpoints(),
|
||||||
this );
|
this );
|
||||||
dlg->initFromFreeSpace( partition );
|
dlg->initFromFreeSpace( partition );
|
||||||
@ -285,6 +286,7 @@ PartitionPage::updatePartitionToCreate( Device* device, Partition* partition )
|
|||||||
|
|
||||||
QPointer< CreatePartitionDialog > dlg = new CreatePartitionDialog( device,
|
QPointer< CreatePartitionDialog > dlg = new CreatePartitionDialog( device,
|
||||||
partition->parent(),
|
partition->parent(),
|
||||||
|
partition,
|
||||||
mountPoints,
|
mountPoints,
|
||||||
this );
|
this );
|
||||||
dlg->initFromPartitionToCreate( partition );
|
dlg->initFromPartitionToCreate( partition );
|
||||||
|
Loading…
Reference in New Issue
Block a user