From 5eafb9538e30370a019d2a903cce42727ed953ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20G=C3=A2teau?= Date: Tue, 1 Jul 2014 16:29:26 +0200 Subject: [PATCH] Crude way to distinguish extended from primary partitions + show partition size --- src/modules/partition/PartitionModel.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/modules/partition/PartitionModel.cpp b/src/modules/partition/PartitionModel.cpp index 3884d9eaa..9eb761395 100644 --- a/src/modules/partition/PartitionModel.cpp +++ b/src/modules/partition/PartitionModel.cpp @@ -69,11 +69,21 @@ PartitionModel::data( const QModelIndex& index, int role ) const switch ( role ) { case Qt::DisplayRole: + { + QString text = partition->roles().has( PartitionRole::Logical ) + ? QStringLiteral( " " ) : QStringLiteral(); if ( PMUtils::isPartitionFreeSpace( partition ) ) { - return tr( "Free Space" ); + text += tr( "Free Space" ); } - return partition->partitionPath() + " " + partition->fileSystem().name() + " " + partition->mountPoint(); + else + { + text += partition->partitionPath() + " " + partition->fileSystem().name() + " " + partition->mountPoint(); + } + qint64 size = ( partition->lastSector() - partition->firstSector() + 1 ) * m_device->logicalSectorSize(); + text += tr( " (%1 MB)" ).arg( size / 1024 / 1024 ); + return text; + } default: return QVariant(); }