Fix issue with splitting being allowed when it shouldn't be.

KPM docs misreport Partition::available to be in sectors, when it's
actually in bytes. Because of this, available space estimates were
completely off and resizing was allowed even when there's no room to
do it. This used to put the resize widget in all sorts of weird,
visually broken states.
CAL-188 #comment Does this still happen with current master?
This commit is contained in:
Teo Mrnjavac 2015-03-25 12:49:45 +01:00
parent 7fe49decd1
commit 75f4f0fa04

View File

@ -354,13 +354,16 @@ PartitionViewStep::canBeResized( const QString& partitionPath )
->value( "requiredStorageGB" )
.toDouble( &ok );
qint64 availableStorageB = candidate->available() * dev->logicalSectorSize();
qint64 availableStorageB = candidate->available();
// We require a little more for partitioning overhead and swap file
// TODO: maybe make this configurable?
qint64 requiredStorageB = ( requiredStorageGB + 0.1 + 2.0 ) * 1024 * 1024 * 1024;
cDebug() << "Required storage B:" << requiredStorageB;
cDebug() << "Available storage B:" << availableStorageB;
cDebug() << "Required storage B:" << requiredStorageB
<< QString( "(%1GB)" ).arg( requiredStorageB / 1024 / 1024 / 1024 );
cDebug() << "Available storage B:" << availableStorageB
<< QString( "(%1GB)" ).arg( availableStorageB / 1024 / 1024 / 1024 );
if ( ok &&
availableStorageB > requiredStorageB )
{