From 75f4f0fa0474dbcc1d1b4086ec0daa84b0484607 Mon Sep 17 00:00:00 2001 From: Teo Mrnjavac Date: Wed, 25 Mar 2015 12:49:45 +0100 Subject: [PATCH] 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? --- src/modules/partition/gui/PartitionViewStep.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/modules/partition/gui/PartitionViewStep.cpp b/src/modules/partition/gui/PartitionViewStep.cpp index a5a449cc3..3ea35bffc 100644 --- a/src/modules/partition/gui/PartitionViewStep.cpp +++ b/src/modules/partition/gui/PartitionViewStep.cpp @@ -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 ) {