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