From e5351cdf3c0d3d548ed4f82456acb942fe960eef Mon Sep 17 00:00:00 2001 From: Caio Date: Thu, 7 Jun 2018 17:49:25 -0300 Subject: [PATCH] [partition] Don't show capacity of new LVM VGs in DeviceModel. --- src/modules/partition/core/DeviceModel.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/modules/partition/core/DeviceModel.cpp b/src/modules/partition/core/DeviceModel.cpp index 95d7ddb72..fe4f71b4f 100644 --- a/src/modules/partition/core/DeviceModel.cpp +++ b/src/modules/partition/core/DeviceModel.cpp @@ -79,10 +79,18 @@ DeviceModel::data( const QModelIndex& index, int role ) const if ( device->name().isEmpty() ) return device->deviceNode(); else - return tr( "%1 - %2 (%3)" ) - .arg( device->name() ) - .arg( KFormat().formatByteSize( device->capacity() ) ) - .arg( device->deviceNode() ); + { + if ( device->capacity() != 1 ) + return tr( "%1 - %2 (%3)" ) + .arg( device->name() ) + .arg( KFormat().formatByteSize( device->capacity() ) ) + .arg( device->deviceNode() ); + // Newly LVM VGs don't have capacity property yet (i.e. always has 1B capacity), so don't show it for a while + else + return tr( "%1 - (%2)" ) + .arg( device->name() ) + .arg( device->deviceNode() ); + } case Qt::DecorationRole: return CalamaresUtils::defaultPixmap( CalamaresUtils::PartitionDisk, CalamaresUtils::Original,