Crude way to distinguish extended from primary partitions + show partition size

This commit is contained in:
Aurélien Gâteau 2014-07-01 16:29:26 +02:00
parent cdfb890e17
commit 5eafb9538e

View File

@ -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" );
}
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;
}
return partition->partitionPath() + " " + partition->fileSystem().name() + " " + partition->mountPoint();
default:
return QVariant();
}