From dbfd8bea030b9513a8f088723de5f0c9f1c37e01 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 21 Jun 2021 23:22:40 +0200 Subject: [PATCH] [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. --- src/modules/partition/gui/CreatePartitionDialog.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/modules/partition/gui/CreatePartitionDialog.cpp b/src/modules/partition/gui/CreatePartitionDialog.cpp index e7aab89cd..37547ef8c 100644 --- a/src/modules/partition/gui/CreatePartitionDialog.cpp +++ b/src/modules/partition/gui/CreatePartitionDialog.cpp @@ -204,17 +204,21 @@ CreatePartitionDialog::getNewlyCreatedPartition() : FileSystem::typeForName( m_ui->fsComboBox->currentText() ); 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; QString luksPassphrase = m_ui->encryptWidget->passphrase(); if ( m_ui->encryptWidget->state() == EncryptWidget::Encryption::Confirmed && !luksPassphrase.isEmpty() ) { 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 { 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 )