[partition] Set intent while creating FS-labeling job

This commit is contained in:
Adriaan de Groot 2024-02-17 17:55:34 +01:00
parent 23d203b00b
commit 3881737bbd
2 changed files with 5 additions and 4 deletions

View File

@ -557,15 +557,17 @@ PartitionCoreModule::formatPartition( Device* device, Partition* partition )
void void
PartitionCoreModule::setFilesystemLabel( Device* device, Partition* partition, const QString& newLabel ) PartitionCoreModule::setFilesystemLabel( Device* device, Partition* partition, const QString& newLabel )
{ {
if ( newLabel.isEmpty() ) if ( newLabel == PartitionInfo::label( partition ) )
{ {
// Don't bother
return; return;
} }
auto deviceInfo = infoForDevice( device ); auto deviceInfo = infoForDevice( device );
Q_ASSERT( deviceInfo ); Q_ASSERT( deviceInfo );
OperationHelper helper( partitionModelForDevice( device ), this ); OperationHelper helper( partitionModelForDevice( device ), this );
PartitionInfo::setLabel( partition, newLabel );
deviceInfo->takeJob< ChangeFilesystemLabelJob >( partition );
deviceInfo->makeJob< ChangeFilesystemLabelJob >( partition, newLabel ); deviceInfo->makeJob< ChangeFilesystemLabelJob >( partition, newLabel );
} }

View File

@ -54,7 +54,6 @@ updateLabel( PartitionCoreModule* core, Device* device, Partition* partition, co
if ( partition->fileSystem().type() != FileSystem::Type::Unformatted && fsLabel != partition->fileSystem().label() ) if ( partition->fileSystem().type() != FileSystem::Type::Unformatted && fsLabel != partition->fileSystem().label() )
{ {
core->setFilesystemLabel( device, partition, fsLabel ); core->setFilesystemLabel( device, partition, fsLabel );
PartitionInfo::setLabel(partition, fsLabel);
} }
} }
@ -84,7 +83,7 @@ EditExistingPartitionDialog::EditExistingPartitionDialog( Device* device,
// The filesystem label field is always enabled, because we may want to change // The filesystem label field is always enabled, because we may want to change
// the label on the current filesystem without formatting. // the label on the current filesystem without formatting.
m_ui->fileSystemLabelEdit->setText( PartitionInfo::label(m_partition)); m_ui->fileSystemLabelEdit->setText( PartitionInfo::label( m_partition ) );
m_ui->fileSystemLabel->setEnabled( true ); m_ui->fileSystemLabel->setEnabled( true );
replacePartResizerWidget(); replacePartResizerWidget();