diff --git a/src/partition.cpp b/src/partition.cpp index d8653d6..b71edbe 100644 --- a/src/partition.cpp +++ b/src/partition.cpp @@ -189,6 +189,11 @@ QString Partition::devicePath() const return d ? d->devicePath : QString(); } +QString Partition::deviceName() const +{ + return d ? d->deviceName : QString(); +} + QString Partition::mountPath() const { return d ? d->mountPath : QString(); diff --git a/src/partition.h b/src/partition.h index 0f0b81c..e8c4bf9 100644 --- a/src/partition.h +++ b/src/partition.h @@ -82,6 +82,7 @@ class SYSTEMSETTINGS_EXPORT Partition StorageType storageType() const; QString devicePath() const; + QString deviceName() const; QString mountPath() const; QString filesystemType() const; diff --git a/src/partitionmodel.cpp b/src/partitionmodel.cpp index 3c62bb7..69789f6 100644 --- a/src/partitionmodel.cpp +++ b/src/partitionmodel.cpp @@ -128,6 +128,7 @@ QHash PartitionModel::roleNames() const { StorageTypeRole, "storageType" }, { FilesystemTypeRole, "filesystemType" }, { DevicePathRole, "devicePath" }, + { DeviceNameRole, "deviceName" }, { MountPathRole, "mountPath" }, { BytesAvailableRole, "bytesAvailable" }, { BytesTotalRole, "bytesTotal" }, @@ -165,6 +166,8 @@ QVariant PartitionModel::data(const QModelIndex &index, int role) const return partition.filesystemType(); case DevicePathRole: return partition.devicePath(); + case DeviceNameRole: + return partition.deviceName(); case MountPathRole: return partition.mountPath(); case BytesAvailableRole: @@ -185,7 +188,8 @@ void PartitionModel::partitionChanged(const Partition &partition) { for (int i = 0; i < m_partitions.count(); ++i) { if (m_partitions.at(i) == partition) { - emit dataChanged(createIndex(i, 0), createIndex(i, 0)); + QModelIndex index = createIndex(i, 0); + emit dataChanged(index, index); return; } } diff --git a/src/partitionmodel.h b/src/partitionmodel.h index c4748f3..dceb7f7 100644 --- a/src/partitionmodel.h +++ b/src/partitionmodel.h @@ -53,6 +53,7 @@ class SYSTEMSETTINGS_EXPORT PartitionModel : public QAbstractListModel StorageTypeRole, FilesystemTypeRole, DevicePathRole, + DeviceNameRole, MountPathRole, BytesAvailableRole, BytesTotalRole,