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

View File

@ -1,7 +1,7 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014, Aurélien Gâteau <agateau@kde.org>
* Copyright 2015, Teo Mrnjavac <teo@kde.org>
* Copyright 2014, Aurélien Gâteau <agateau@kde.org>
* Copyright 2015-2016, Teo Mrnjavac <teo@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -20,6 +20,7 @@
#define KPMHELPERS_H
// KPMcore
#include <kpmcore/core/partitiontable.h>
#include <kpmcore/fs/filesystem.h>
// Qt
@ -82,7 +83,13 @@ QList< Partition* > findPartitions( const QList< Device* >& devices,
* Helper function to create a new Partition object (does not create anything
* 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 );