Commit 6d0f7413 authored by Nate Graham's avatar Nate Graham 🔩

Fix root disk icon change so that it doesn't erroneously change other icons

I committed D16653 too soon without enough testing, because it had the effect of applying the default `drive-harddisk` icon to more device types. Oops. Sorry about that. :(

This patch fixes the problem, and is better tested.

Test Plan:
Other device types are not affected:

Reviewers: bruns, broulik, davidedmundson

Reviewed By: broulik

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision:
parent 83a2de6d
......@@ -614,11 +614,8 @@ QString Device::icon() const
if (!iconName.isEmpty()) {
return iconName;
} else if (queryDeviceInterface(Solid::DeviceInterface::StorageAccess)) {
const UDisks2::StorageAccess accessIface(const_cast<Device *>(this));
if (accessIface.filePath() == QLatin1String("/")) {
return QStringLiteral("drive-harddisk-root");
} else if (isRoot()) {
return QStringLiteral("drive-harddisk-root");
} else if (isLoop()) {
const QString backingFile = prop("BackingFile").toString();
if (!backingFile.isEmpty()) {
......@@ -872,6 +869,15 @@ bool Device::isEncryptedCleartext() const
bool Device::isRoot() const
if (isStorageAccess()) {
const UDisks2::StorageAccess accessIface(const_cast<Device *>(this));
return accessIface.filePath() == QLatin1String("/");
return false;
bool Device::isSwap() const
return hasInterface(QStringLiteral(UD2_DBUS_INTERFACE_SWAP));
......@@ -81,6 +81,7 @@ public:
bool isMounted() const;
bool isEncryptedContainer() const;
bool isEncryptedCleartext() const;
bool isRoot() const;
bool isSwap() const;
bool isLoop() const;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment