Move ReplacePartition operation to PartitionActions.
This commit is contained in:
parent
f267410dbb
commit
8a6dcfbe2f
@ -28,6 +28,7 @@
|
||||
#include "GlobalStorage.h"
|
||||
|
||||
#include <kpmcore/core/device.h>
|
||||
#include <kpmcore/core/partition.h>
|
||||
|
||||
#include <QDir>
|
||||
|
||||
@ -195,4 +196,25 @@ doAutopartition( PartitionCoreModule* core, Device* dev )
|
||||
core->dumpQueue();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
doReplacePartition( PartitionCoreModule* core, Device* dev, Partition* partition )
|
||||
{
|
||||
|
||||
Partition* newPartition = KPMHelpers::createNewPartition(
|
||||
partition->parent(),
|
||||
*dev,
|
||||
partition->roles(),
|
||||
FileSystem::Ext4,
|
||||
partition->firstSector(),
|
||||
partition->lastSector() );
|
||||
PartitionInfo::setMountPoint( newPartition, "/" );
|
||||
PartitionInfo::setFormat( newPartition, true );
|
||||
|
||||
core->deletePartition( dev, partition );
|
||||
core->createPartition( dev, newPartition );
|
||||
|
||||
core->dumpQueue();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -21,10 +21,12 @@
|
||||
|
||||
class PartitionCoreModule;
|
||||
class Device;
|
||||
class Partition;
|
||||
|
||||
namespace PartitionActions
|
||||
{
|
||||
void doAutopartition( PartitionCoreModule* core, Device* dev );
|
||||
void doReplacePartition( PartitionCoreModule* core, Device* dev, Partition* partition );
|
||||
}
|
||||
|
||||
#endif // PARTITIONACTIONS_H
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "core/KPMHelpers.h"
|
||||
#include "core/PartitionInfo.h"
|
||||
#include "core/DeviceModel.h"
|
||||
#include "core/PartitionActions.h"
|
||||
|
||||
#include "JobQueue.h"
|
||||
#include "GlobalStorage.h"
|
||||
@ -109,18 +110,8 @@ ReplacePage::applyChanges()
|
||||
if ( partition )
|
||||
{
|
||||
Device* dev = model->device();
|
||||
Partition* newPartition = KPMHelpers::createNewPartition(
|
||||
partition->parent(),
|
||||
*dev,
|
||||
partition->roles(),
|
||||
FileSystem::Ext4,
|
||||
partition->firstSector(),
|
||||
partition->lastSector() );
|
||||
PartitionInfo::setMountPoint( newPartition, "/" );
|
||||
PartitionInfo::setFormat( newPartition, true );
|
||||
|
||||
m_core->deletePartition( dev, partition );
|
||||
m_core->createPartition( dev, newPartition );
|
||||
PartitionActions::doReplacePartition( m_core, dev, partition );
|
||||
|
||||
if ( m_isEfi )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user