Allow setting flags when creating a partition.

This commit is contained in:
Teo Mrnjavac 2016-03-04 19:11:31 +01:00
parent 4b185ddb16
commit c233fb3b2d
2 changed files with 28 additions and 14 deletions

View File

@ -1,7 +1,7 @@
/* === This file is part of Calamares - <http://github.com/calamares> === /* === This file is part of Calamares - <http://github.com/calamares> ===
* *
* Copyright 2014, Aurélien Gâteau <agateau@kde.org> * Copyright 2014, Aurélien Gâteau <agateau@kde.org>
* Copyright 2015, Teo Mrnjavac <teo@kde.org> * Copyright 2015-2016, Teo Mrnjavac <teo@kde.org>
* *
* Calamares is free software: you can redistribute it and/or modify * Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -105,7 +105,13 @@ findPartitions( const QList< Device* >& devices,
Partition* Partition*
createNewPartition( PartitionNode* parent, const Device& device, const PartitionRole& role, FileSystem::Type fsType, qint64 firstSector, qint64 lastSector ) createNewPartition( PartitionNode* parent,
const Device& device,
const PartitionRole& role,
FileSystem::Type fsType,
qint64 firstSector,
qint64 lastSector,
PartitionTable::Flags flags )
{ {
FileSystem* fs = FileSystemFactory::create( fsType, firstSector, lastSector ); FileSystem* fs = FileSystemFactory::create( fsType, firstSector, lastSector );
return new Partition( return new Partition(
@ -117,7 +123,7 @@ createNewPartition( PartitionNode* parent, const Device& device, const Partition
PartitionTable::FlagNone /* availableFlags */, PartitionTable::FlagNone /* availableFlags */,
QString() /* mountPoint */, QString() /* mountPoint */,
false /* mounted */, false /* mounted */,
PartitionTable::FlagNone /* activeFlags */, flags /* activeFlags */,
Partition::StateNew Partition::StateNew
); );
} }
@ -131,13 +137,14 @@ clonePartition( Device* device, Partition* partition )
partition->firstSector(), partition->firstSector(),
partition->lastSector() partition->lastSector()
); );
return new Partition( return new Partition( partition->parent(),
partition->parent(), *device,
*device, partition->roles(),
partition->roles(), fs,
fs, fs->firstSector(), fs->lastSector(), fs->firstSector(),
partition->partitionPath() fs->lastSector(),
); partition->partitionPath(),
partition->activeFlags() );
} }

View File

@ -1,7 +1,7 @@
/* === This file is part of Calamares - <http://github.com/calamares> === /* === This file is part of Calamares - <http://github.com/calamares> ===
* *
* Copyright 2014, Aurélien Gâteau <agateau@kde.org> * Copyright 2014, Aurélien Gâteau <agateau@kde.org>
* Copyright 2015, Teo Mrnjavac <teo@kde.org> * Copyright 2015-2016, Teo Mrnjavac <teo@kde.org>
* *
* Calamares is free software: you can redistribute it and/or modify * Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -20,6 +20,7 @@
#define KPMHELPERS_H #define KPMHELPERS_H
// KPMcore // KPMcore
#include <kpmcore/core/partitiontable.h>
#include <kpmcore/fs/filesystem.h> #include <kpmcore/fs/filesystem.h>
// Qt // Qt
@ -82,7 +83,13 @@ QList< Partition* > findPartitions( const QList< Device* >& devices,
* Helper function to create a new Partition object (does not create anything * Helper function to create a new Partition object (does not create anything
* on the disk) associated with a FileSystem. * on the disk) associated with a FileSystem.
*/ */
Partition* createNewPartition( PartitionNode* parent, const Device& device, const PartitionRole& role, FileSystem::Type fsType, qint64 firstSector, qint64 lastSector ); Partition* createNewPartition( PartitionNode* parent,
const Device& device,
const PartitionRole& role,
FileSystem::Type fsType,
qint64 firstSector,
qint64 lastSector,
PartitionTable::Flags flags = PartitionTable::FlagNone );
Partition* clonePartition( Device* device, Partition* partition ); Partition* clonePartition( Device* device, Partition* partition );