[partition] Apply custom partition layout for Erase and Replace choices

This patches add new methods to both PartitionLayout and
PartitionCoreModule classes which apply the partition layout to the
available drive space.

In addition, the partition creation code from PartitioinActions is
removed to call the newly created methods instead, thus applying the
custom partition layout when the "Erase whole disk" and "Replace
partition" choices are selected.

Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
This commit is contained in:
Arnaud Ferraris 2019-01-07 17:26:37 +01:00
parent f863912a2f
commit 0d284759f5
5 changed files with 138 additions and 63 deletions

View file

@ -787,6 +787,30 @@ PartitionCoreModule::initLayout( const QVariantList& config )
}
}
void
PartitionCoreModule::layoutApply( Device *dev,
qint64 firstSector,
qint64 lastSector,
QString luksPassphrase )
{
bool isEfi = PartUtils::isEfiSystem();
QList< Partition* > partList = m_partLayout->execute( dev, firstSector, lastSector, luksPassphrase );
foreach ( Partition *part, partList )
{
if ( part->mountPoint() == "/" )
{
createPartition( dev, part,
part->activeFlags() | ( isEfi ? PartitionTable::FlagNone : PartitionTable::FlagBoot )
);
}
else
{
createPartition( dev, part );
}
}
}
void
PartitionCoreModule::revert()
{