[partition] Use lvalue-overload of execute() convenience
- These jobs may take a long time, and report progress; we need the operation around to be able to connect the signals and slots
This commit is contained in:
parent
6680584724
commit
fdf0f208f0
@ -11,9 +11,10 @@
|
|||||||
|
|
||||||
#include "ResizePartitionJob.h"
|
#include "ResizePartitionJob.h"
|
||||||
|
|
||||||
|
#include "core/KPMHelpers.h"
|
||||||
|
|
||||||
#include "utils/Units.h"
|
#include "utils/Units.h"
|
||||||
|
|
||||||
// KPMcore
|
|
||||||
#include <kpmcore/core/device.h>
|
#include <kpmcore/core/device.h>
|
||||||
#include <kpmcore/ops/resizeoperation.h>
|
#include <kpmcore/ops/resizeoperation.h>
|
||||||
#include <kpmcore/util/report.h>
|
#include <kpmcore/util/report.h>
|
||||||
@ -66,23 +67,16 @@ ResizePartitionJob::prettyStatusMessage() const
|
|||||||
Calamares::JobResult
|
Calamares::JobResult
|
||||||
ResizePartitionJob::exec()
|
ResizePartitionJob::exec()
|
||||||
{
|
{
|
||||||
Report report( nullptr );
|
|
||||||
// Restore partition sectors that were modified for preview
|
// Restore partition sectors that were modified for preview
|
||||||
m_partition->setFirstSector( m_oldFirstSector );
|
m_partition->setFirstSector( m_oldFirstSector );
|
||||||
m_partition->setLastSector( m_oldLastSector );
|
m_partition->setLastSector( m_oldLastSector );
|
||||||
|
|
||||||
ResizeOperation op( *m_device, *m_partition, m_newFirstSector, m_newLastSector );
|
ResizeOperation op( *m_device, *m_partition, m_newFirstSector, m_newLastSector );
|
||||||
op.setStatus( Operation::StatusRunning );
|
|
||||||
connect( &op, &Operation::progress, this, &ResizePartitionJob::iprogress );
|
connect( &op, &Operation::progress, this, &ResizePartitionJob::iprogress );
|
||||||
|
return KPMHelpers::execute( op,
|
||||||
QString errorMessage = tr( "The installer failed to resize partition %1 on disk '%2'." )
|
tr( "The installer failed to resize partition %1 on disk '%2'." )
|
||||||
.arg( m_partition->partitionPath() )
|
.arg( m_partition->partitionPath() )
|
||||||
.arg( m_device->name() );
|
.arg( m_device->name() ) );
|
||||||
if ( op.execute( report ) )
|
|
||||||
{
|
|
||||||
return Calamares::JobResult::ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Calamares::JobResult::error( errorMessage, report.toText() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -13,6 +13,8 @@
|
|||||||
|
|
||||||
#include "SetPartitionFlagsJob.h"
|
#include "SetPartitionFlagsJob.h"
|
||||||
|
|
||||||
|
#include "core/KPMHelpers.h"
|
||||||
|
|
||||||
#include "partition/FileSystem.h"
|
#include "partition/FileSystem.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
#include "utils/Units.h"
|
#include "utils/Units.h"
|
||||||
@ -148,17 +150,8 @@ SetPartFlagsJob::exec()
|
|||||||
cDebug() << "Setting flags on" << m_device->deviceNode() << "partition" << partition()->deviceNode()
|
cDebug() << "Setting flags on" << m_device->deviceNode() << "partition" << partition()->deviceNode()
|
||||||
<< Logger::DebugList( flagsList );
|
<< Logger::DebugList( flagsList );
|
||||||
|
|
||||||
Report report( nullptr );
|
|
||||||
SetPartFlagsOperation op( *m_device, *partition(), m_flags );
|
SetPartFlagsOperation op( *m_device, *partition(), m_flags );
|
||||||
op.setStatus( Operation::StatusRunning );
|
|
||||||
connect( &op, &Operation::progress, this, &SetPartFlagsJob::iprogress );
|
connect( &op, &Operation::progress, this, &SetPartFlagsJob::iprogress );
|
||||||
|
return KPMHelpers::execute(
|
||||||
QString errorMessage
|
op, tr( "The installer failed to set flags on partition %1." ).arg( m_partition->partitionPath() ) );
|
||||||
= tr( "The installer failed to set flags on partition %1." ).arg( m_partition->partitionPath() );
|
|
||||||
if ( op.execute( report ) )
|
|
||||||
{
|
|
||||||
return Calamares::JobResult::ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Calamares::JobResult::error( errorMessage, report.toText() );
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user