Specify type when creating a new partition.

This commit is contained in:
Teo Mrnjavac 2015-07-13 15:28:56 +02:00
parent 521d3efb39
commit 46946c7949
2 changed files with 8 additions and 2 deletions

View File

@ -119,11 +119,15 @@ bool NewOperation::canCreateNew(const Partition* p)
return p != NULL && p->roles().has(PartitionRole::Unallocated);
}
Partition* NewOperation::createNew(const Partition& cloneFrom)
Partition* NewOperation::createNew(const Partition& cloneFrom,
FileSystem::Type type)
{
Partition* p = new Partition(cloneFrom);
p->deleteFileSystem();
p->setFileSystem(FileSystemFactory::create(type,
p->firstSector(),
p->lastSector()));
p->setState(Partition::StateNew);
p->setPartitionPath(QString());

View File

@ -19,6 +19,7 @@
#define NEWOPERATION__H
#include "../fs/filesystem.h"
#include "../ops/operation.h"
#include "../util/libpartitionmanagerexport.h"
@ -60,7 +61,8 @@ class LIBKPMCORE_EXPORT NewOperation : public Operation
virtual bool targets(const Partition& p) const;
static bool canCreateNew(const Partition* p);
static Partition* createNew(const Partition& cloneFrom);
static Partition* createNew(const Partition& cloneFrom,
FileSystem::Type type);
protected:
Partition& newPartition() { return *m_NewPartition; }