[partition] Set radio buttons conistently

Put the setChecked() calls together so that it is obvious
that only one is checked. *Keep* button is the inverse of
*Format* now. Previously, it used only the not-ZFS value,
and so would override the value obtained from the partition's
*format* setting.
This commit is contained in:
Adriaan de Groot 2024-02-17 22:47:19 +01:00
parent 3881737bbd
commit 2ea5a2b5d5

View File

@ -138,13 +138,16 @@ EditExistingPartitionDialog::EditExistingPartitionDialog( Device* device,
m_ui->fileSystemComboBox->setCurrentText( FileSystem::nameForType( defaultFSType ) );
}
// Force a format if the existing device is a zfs device since reusing a zpool isn't currently supported
// Force a format if the existing device is a zfs device since reusing a
// zpool isn't currently supported; disable the radio buttons then.
const bool partitionIsZFS = m_partition->fileSystem().type() == FileSystem::Type::Zfs;
m_ui->formatRadioButton->setChecked( partitionIsZFS || PartitionInfo::format( m_partition ) );
m_ui->formatRadioButton->setEnabled( !partitionIsZFS );
m_ui->keepRadioButton->setChecked( !partitionIsZFS );
m_ui->keepRadioButton->setEnabled( !partitionIsZFS );
const bool formatChecked = partitionIsZFS || PartitionInfo::format( m_partition );
m_ui->formatRadioButton->setChecked( formatChecked );
m_ui->keepRadioButton->setChecked( !formatChecked );
m_ui->fileSystemComboBox->setEnabled( m_ui->formatRadioButton->isChecked() );
setFlagList( *( m_ui->m_listFlags ), m_partition->availableFlags(), PartitionInfo::flags( m_partition ) );