make sure start and end are aligned when updating a partition's length

svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=1119081
This commit is contained in:
Volker Lanz 2010-04-26 14:14:14 +00:00
parent 42cc630639
commit 1322c015e0
2 changed files with 22 additions and 10 deletions

4
TODO
View File

@ -20,10 +20,6 @@ Bugs to fix for 1.1:
* Make sure progress dialog when scanning is hidden even if there are no devices
to scan.
* when changing the file system in the new dialog so that the length is
changed, make sure last sector is aligned if align is on and last sector was
aligned before
===============================================================================
For releases after 1.1:

View File

@ -429,10 +429,18 @@ bool PartResizerWidget::updateLength(qint64 newLength)
if (tmp != 0)
{
partition().setLastSector(partition().lastSector() + tmp);
partition().fileSystem().setLastSector(partition().lastSector() + tmp);
qint64 newLastSector = partition().lastSector() + tmp;
emit lastSectorChanged(partition().lastSector());
if (align())
newLastSector = PartitionAlignment::alignedLastSector(device(), partition(), newLastSector, minimumLastSector(align()), maximumLastSector(align()), minimumLength(), maximumLength());
if (newLastSector != partition().lastSector())
{
partition().setLastSector(newLastSector);
partition().fileSystem().setLastSector(newLastSector);
emit lastSectorChanged(partition().lastSector());
}
}
tmp = qMin(delta, partition().firstSector() - minimumFirstSector(align()));
@ -440,10 +448,18 @@ bool PartResizerWidget::updateLength(qint64 newLength)
if (tmp != 0)
{
partition().setFirstSector(partition().firstSector() - tmp);
partition().fileSystem().setFirstSector(partition().firstSector() - tmp);
qint64 newFirstSector = partition().firstSector() - tmp;
emit firstSectorChanged(partition().firstSector());
if (align())
newFirstSector = PartitionAlignment::alignedFirstSector(device(), partition(), newFirstSector, minimumFirstSector(align()), maximumFirstSector(align()), minimumLength(), maximumLength());
if (newFirstSector != partition().firstSector())
{
partition().setFirstSector(newFirstSector);
partition().fileSystem().setFirstSector(newFirstSector);
emit firstSectorChanged(partition().firstSector());
}
}
if (partition().length() != oldLength)