Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[storage] If there is only one internal storage don't avoid dividing …
…the mass storage to user and system parts. Contributes to JB#5771
  • Loading branch information
Joona Petrell committed Mar 23, 2016
1 parent e9ff598 commit 649caed
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions src/aboutsettings.cpp
Expand Up @@ -332,32 +332,31 @@ void AboutSettings::refreshStorageModels()
m_internalStorage.clear();
m_externalStorage.clear();

int internalPartitionCount = 0;
foreach (const StorageInfo &info, devices) {
if (!info.external) {
QVariantMap row;
internalPartitionCount++;
}
}

foreach (const StorageInfo &info, devices) {
QVariantMap row;
row[QStringLiteral("mounted")] = info.mounted;
row[QStringLiteral("path")] = info.mountPath;
row[QStringLiteral("available")] = info.availableDiskSpace;
row[QStringLiteral("total")] = info.totalDiskSpace;
row[QStringLiteral("filesystem")] = info.filesystem;
row[QStringLiteral("devicePath")] = info.devicePath;

row[QStringLiteral("storageType")] = info.mountPath == QLatin1String("/")
? QStringLiteral("system")
: QStringLiteral("user");
if (!info.external) {
row[QStringLiteral("storageType")] = internalPartitionCount == 1 ? QStringLiteral("mass")
: info.mountPath == QLatin1String("/") ? QStringLiteral("system")
: QStringLiteral("user");

row[QStringLiteral("path")] = info.mountPath;
row[QStringLiteral("mounted")] = info.mounted;
row[QStringLiteral("available")] = info.availableDiskSpace;
row[QStringLiteral("total")] = info.totalDiskSpace;
row[QStringLiteral("filesystem")] = info.filesystem;
row[QStringLiteral("devicePath")] = info.devicePath;

m_internalStorage << QVariant(row);
} else {
QVariantMap row;

row[QStringLiteral("storageType")] = QStringLiteral("card");
row[QStringLiteral("mounted")] = info.mounted;
row[QStringLiteral("path")] = info.mountPath;
row[QStringLiteral("available")] = info.availableDiskSpace;
row[QStringLiteral("total")] = info.totalDiskSpace;
row[QStringLiteral("filesystem")] = info.filesystem;
row[QStringLiteral("devicePath")] = info.devicePath;

m_externalStorage << QVariant(row);
}
Expand Down

0 comments on commit 649caed

Please sign in to comment.