[partition] With rvalue, code becomes even more compact

This commit is contained in:
Adriaan de Groot 2021-12-11 21:35:09 +01:00
parent 8bb2c5fc6b
commit 1356012fb4
4 changed files with 5 additions and 6 deletions

View File

@ -128,7 +128,7 @@ clonePartition( Device* device, Partition* partition )
} }
Calamares::JobResult Calamares::JobResult
execute( Operation& operation, const QString& failureMessage ) execute( Operation&& operation, const QString& failureMessage )
{ {
operation.setStatus( Operation::StatusRunning ); operation.setStatus( Operation::StatusRunning );

View File

@ -80,7 +80,7 @@ Partition* clonePartition( Device* device, Partition* partition );
* Otherwise returns an error using @p failureMessage as the primary part * Otherwise returns an error using @p failureMessage as the primary part
* of the error, and details obtained from the operation. * of the error, and details obtained from the operation.
*/ */
Calamares::JobResult execute( Operation& operation, const QString& failureMessage ); Calamares::JobResult execute( Operation&& operation, const QString& failureMessage );
} // namespace KPMHelpers } // namespace KPMHelpers

View File

@ -275,9 +275,9 @@ CreatePartitionJob::exec()
return createZfs( m_partition, m_device ); return createZfs( m_partition, m_device );
} }
NewOperation op( *m_device, m_partition );
return KPMHelpers::execute( return KPMHelpers::execute(
op, tr( "The installer failed to create partition on disk '%1'." ).arg( m_device->name() ) ); NewOperation( *m_device, m_partition ),
tr( "The installer failed to create partition on disk '%1'." ).arg( m_device->name() ) );
} }
void void

View File

@ -98,8 +98,7 @@ DeletePartitionJob::exec()
return removePartition( m_partition ); return removePartition( m_partition );
} }
DeleteOperation op( *m_device, m_partition ); return KPMHelpers::execute( DeleteOperation( *m_device, m_partition ),
return KPMHelpers::execute( op,
tr( "The installer failed to delete partition %1." ).arg( m_partition->devicePath() ) ); tr( "The installer failed to delete partition %1." ).arg( m_partition->devicePath() ) );
} }