Skip to content

Commit

Permalink
[nemo-systemsettings] Expose deviceName from the PartitiionModel. Con…
Browse files Browse the repository at this point in the history
…tributes to JB#39820
  • Loading branch information
rainemak committed Feb 6, 2018
1 parent 0c30346 commit 7e5b5d3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/partition.cpp
Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions src/partition.h
Expand Up @@ -82,6 +82,7 @@ class SYSTEMSETTINGS_EXPORT Partition
StorageType storageType() const;

QString devicePath() const;
QString deviceName() const;
QString mountPath() const;

QString filesystemType() const;
Expand Down
6 changes: 5 additions & 1 deletion src/partitionmodel.cpp
Expand Up @@ -128,6 +128,7 @@ QHash<int, QByteArray> PartitionModel::roleNames() const
{ StorageTypeRole, "storageType" },
{ FilesystemTypeRole, "filesystemType" },
{ DevicePathRole, "devicePath" },
{ DeviceNameRole, "deviceName" },
{ MountPathRole, "mountPath" },
{ BytesAvailableRole, "bytesAvailable" },
{ BytesTotalRole, "bytesTotal" },
Expand Down Expand Up @@ -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:
Expand All @@ -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;
}
}
Expand Down
1 change: 1 addition & 0 deletions src/partitionmodel.h
Expand Up @@ -53,6 +53,7 @@ class SYSTEMSETTINGS_EXPORT PartitionModel : public QAbstractListModel
StorageTypeRole,
FilesystemTypeRole,
DevicePathRole,
DeviceNameRole,
MountPathRole,
BytesAvailableRole,
BytesTotalRole,
Expand Down

0 comments on commit 7e5b5d3

Please sign in to comment.