From 174114f09c55036f4d607e78fe1c3735e2c6d58d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20G=C3=A2teau?= Date: Tue, 15 Jul 2014 17:33:16 +0200 Subject: [PATCH] Add IsNewPartition role --- src/modules/partition/PartitionModel.cpp | 4 +++- src/modules/partition/PartitionModel.h | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/modules/partition/PartitionModel.cpp b/src/modules/partition/PartitionModel.cpp index 8730102f4..3348f670b 100644 --- a/src/modules/partition/PartitionModel.cpp +++ b/src/modules/partition/PartitionModel.cpp @@ -92,7 +92,7 @@ PartitionModel::data( const QModelIndex& index, int role ) const return prefix + tr( "Free Space" ); else { - return prefix + ( partition->partitionPath().isEmpty() + return prefix + ( PMUtils::isPartitionNew( partition ) ? tr( "New partition" ) : partition->partitionPath() ); } @@ -112,6 +112,8 @@ PartitionModel::data( const QModelIndex& index, int role ) const cDebug() << "Unknown column" << col; return QVariant(); } + case IsNewPartitionRole: + return PMUtils::isPartitionNew( partition ); default: return QVariant(); } diff --git a/src/modules/partition/PartitionModel.h b/src/modules/partition/PartitionModel.h index 36f4be037..edbe3a645 100644 --- a/src/modules/partition/PartitionModel.h +++ b/src/modules/partition/PartitionModel.h @@ -46,6 +46,11 @@ public: LastColumn = SizeColumn + 1 }; + enum + { + IsNewPartitionRole = Qt::UserRole + }; + PartitionModel( QObject* parent = 0 ); /** * device and infoForPartitions must remain alive for the life of