Changeset View
Changeset View
Standalone View
Standalone View
src/solid/devices/backends/fstab/fstabmanager.cpp
Show First 20 Lines • Show All 59 Lines • ▼ Show 20 Line(s) | 54 | { | |||
---|---|---|---|---|---|
60 | } | 60 | } | ||
61 | 61 | | |||
62 | return result; | 62 | return result; | ||
63 | } | 63 | } | ||
64 | 64 | | |||
65 | QStringList FstabManager::devicesFromQuery(const QString &parentUdi, | 65 | QStringList FstabManager::devicesFromQuery(const QString &parentUdi, | ||
66 | Solid::DeviceInterface::Type type) | 66 | Solid::DeviceInterface::Type type) | ||
67 | { | 67 | { | ||
68 | if (type == Solid::DeviceInterface::StorageAccess | 68 | if ((parentUdi == udiPrefix()) || parentUdi.isEmpty()) { | ||
69 | || type == Solid::DeviceInterface::NetworkShare) { | 69 | QStringList result; | ||
70 | if (parentUdi.isEmpty() || parentUdi == udiPrefix()) { | 70 | if (type == Solid::DeviceInterface::StorageAccess) { | ||
71 | QStringList list = allDevices(); | 71 | for (const QString &device : qAsConst(m_deviceList)) { | ||
72 | list.removeFirst(); | 72 | result << udiPrefix() + "/" + device; | ||
73 | return list; | 73 | } | ||
74 | return result; | ||||
75 | } else if (type == Solid::DeviceInterface::NetworkShare) { | ||||
76 | for (const QString &device : qAsConst(m_deviceList)) { | ||||
77 | result << udiPrefix() + "/" + device; | ||||
78 | } | ||||
79 | return result; | ||||
80 | } | ||||
74 | } else { | 81 | } else { | ||
75 | QStringList list; | 82 | if (type == Solid::DeviceInterface::StorageAccess || | ||
76 | list << parentUdi; | 83 | type == Solid::DeviceInterface::NetworkShare) { | ||
77 | return list; | 84 | return QStringList{parentUdi}; | ||
78 | } | 85 | } | ||
79 | } | 86 | } | ||
87 | | ||||
80 | return QStringList(); | 88 | return QStringList(); | ||
81 | } | 89 | } | ||
82 | 90 | | |||
83 | QObject *FstabManager::createDevice(const QString &udi) | 91 | QObject *FstabManager::createDevice(const QString &udi) | ||
84 | { | 92 | { | ||
85 | if (udi == udiPrefix()) { | 93 | if (udi == udiPrefix()) { | ||
86 | RootDevice *root = new RootDevice(FSTAB_UDI_PREFIX); | 94 | RootDevice *root = new RootDevice(FSTAB_UDI_PREFIX); | ||
87 | 95 | | |||
88 | root->setProduct(tr("Network Shares")); | 96 | root->setProduct(tr("Filesystem Volumes")); | ||
89 | root->setDescription(tr("NFS and SMB shares declared in your system")); | 97 | root->setDescription(tr("Mountable filesystems declared in your system")); | ||
90 | root->setIcon("folder-remote"); | 98 | root->setIcon("folder"); | ||
91 | 99 | | |||
92 | return root; | 100 | return root; | ||
93 | 101 | | |||
94 | } else { | 102 | } else { | ||
95 | // global device manager makes sure udi starts with udi prefix + '/' | 103 | // global device manager makes sure udi starts with udi prefix + '/' | ||
96 | QString internalName = udi.mid(udiPrefix().length() + 1, -1); | 104 | QString internalName = udi.mid(udiPrefix().length() + 1, -1); | ||
97 | if (!m_deviceList.contains(internalName)) { | 105 | if (!m_deviceList.contains(internalName)) { | ||
98 | return nullptr; | 106 | return nullptr; | ||
▲ Show 20 Lines • Show All 57 Lines • Show Last 20 Lines |