Skip to content

Commit

Permalink
[storage] Expose partition model as its own role. Contributes to JB#3…
Browse files Browse the repository at this point in the history
…6373
  • Loading branch information
Joona Petrell committed Dec 9, 2016
1 parent 39d7065 commit 254ef0d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/partitionmodel.cpp
Expand Up @@ -131,7 +131,8 @@ QHash<int, QByteArray> PartitionModel::roleNames() const
{ MountPathRole, "mountPath" },
{ BytesAvailableRole, "bytesAvailable" },
{ BytesTotalRole, "bytesTotal" },
{ BytesFreeRole, "bytesFree" }
{ BytesFreeRole, "bytesFree" },
{ PartitionModelRole, "partitionModel" }
};

return roleNames;
Expand Down Expand Up @@ -172,6 +173,8 @@ QVariant PartitionModel::data(const QModelIndex &index, int role) const
return partition.bytesTotal();
case BytesFreeRole:
return partition.bytesFree();
case PartitionModelRole:
return QVariant::fromValue(static_cast<QObject*>(const_cast<PartitionModel*>((this))));
default:
return QVariant();
}
Expand Down
1 change: 1 addition & 0 deletions src/partitionmodel.h
Expand Up @@ -57,6 +57,7 @@ class SYSTEMSETTINGS_EXPORT PartitionModel : public QAbstractListModel
BytesAvailableRole,
BytesTotalRole,
BytesFreeRole,
PartitionModelRole
};

enum Status {
Expand Down
2 changes: 1 addition & 1 deletion tests/ut_diskusage.cpp
Expand Up @@ -52,7 +52,7 @@ static QVariantMap g_mocked_apkd_size;


/* Mocked implementations of size calculation functions */
quint64 DiskUsageWorker::calculateSize(QString directory, QString *expandedPath, bool androidHomeExists)
quint64 DiskUsageWorker::calculateSize(QString directory, QString *expandedPath, bool)
{
if (expandedPath) {
*expandedPath = directory;
Expand Down

0 comments on commit 254ef0d

Please sign in to comment.