[partition] Newly-created (fresh) partitions don't have flags yet

When a partition is set as "freshly created", the dialog was
passing in newFlags() as the **already-active** flags on the
partition; then the caller was setting those same flags as
"set these in the future", so that afterwards, no flags would
actually be set (because they're already active -- see the
first sentence).

Now, fresh partitions have no flags.
This commit is contained in:
Adriaan de Groot 2021-06-21 23:22:40 +02:00
parent f06766085a
commit dbfd8bea03

View File

@ -204,17 +204,21 @@ CreatePartitionDialog::getNewlyCreatedPartition()
: FileSystem::typeForName( m_ui->fsComboBox->currentText() ); : FileSystem::typeForName( m_ui->fsComboBox->currentText() );
const QString fsLabel = m_ui->filesystemLabelEdit->text(); const QString fsLabel = m_ui->filesystemLabelEdit->text();
// The newly-created partitions have no flags set (no **active** flags),
// because they're new. The desired flags can be retrieved from
// newFlags() and the consumer (see PartitionPage::onCreateClicked)
// does so, to set up the partition for create-and-then-set-flags.
Partition* partition = nullptr; Partition* partition = nullptr;
QString luksPassphrase = m_ui->encryptWidget->passphrase(); QString luksPassphrase = m_ui->encryptWidget->passphrase();
if ( m_ui->encryptWidget->state() == EncryptWidget::Encryption::Confirmed && !luksPassphrase.isEmpty() ) if ( m_ui->encryptWidget->state() == EncryptWidget::Encryption::Confirmed && !luksPassphrase.isEmpty() )
{ {
partition = KPMHelpers::createNewEncryptedPartition( partition = KPMHelpers::createNewEncryptedPartition(
m_parent, *m_device, m_role, fsType, fsLabel, first, last, luksPassphrase, newFlags() ); m_parent, *m_device, m_role, fsType, fsLabel, first, last, luksPassphrase, PartitionTable::Flags() );
} }
else else
{ {
partition partition
= KPMHelpers::createNewPartition( m_parent, *m_device, m_role, fsType, fsLabel, first, last, newFlags() ); = KPMHelpers::createNewPartition( m_parent, *m_device, m_role, fsType, fsLabel, first, last, PartitionTable::Flags() );
} }
if ( m_device->type() == Device::Type::LVM_Device ) if ( m_device->type() == Device::Type::LVM_Device )