Changeset View
Changeset View
Standalone View
Standalone View
solid-device-automounter/kcm/DeviceModel.cpp
Show All 20 Lines | |||||
21 | #include "DeviceModel.h" | 21 | #include "DeviceModel.h" | ||
22 | 22 | | |||
23 | #include <QIcon> | 23 | #include <QIcon> | ||
24 | 24 | | |||
25 | #include <KLocalizedString> | 25 | #include <KLocalizedString> | ||
26 | #include <Solid/DeviceNotifier> | 26 | #include <Solid/DeviceNotifier> | ||
27 | #include <Solid/Device> | 27 | #include <Solid/Device> | ||
28 | #include <Solid/StorageVolume> | 28 | #include <Solid/StorageVolume> | ||
29 | #include <Solid/StorageAccess> | ||||
29 | 30 | | |||
30 | #include "AutomounterSettings.h" | 31 | #include "AutomounterSettings.h" | ||
31 | 32 | | |||
32 | DeviceModel::DeviceModel(QObject *parent) | 33 | DeviceModel::DeviceModel(QObject *parent) | ||
33 | : QAbstractItemModel(parent) | 34 | : QAbstractItemModel(parent) | ||
34 | { | 35 | { | ||
35 | reload(); | 36 | reload(); | ||
36 | 37 | | |||
▲ Show 20 Lines • Show All 72 Lines • ▼ Show 20 Line(s) | 109 | if (!m_loginForced.contains(udi)) { | |||
109 | m_loginForced[udi] = AutomounterSettings::deviceAutomountIsForced(udi, AutomounterSettings::Login); | 110 | m_loginForced[udi] = AutomounterSettings::deviceAutomountIsForced(udi, AutomounterSettings::Login); | ||
110 | } | 111 | } | ||
111 | if (!m_attachedForced.contains(udi)) { | 112 | if (!m_attachedForced.contains(udi)) { | ||
112 | m_loginForced[udi] = AutomounterSettings::deviceAutomountIsForced(udi, AutomounterSettings::Attach); | 113 | m_loginForced[udi] = AutomounterSettings::deviceAutomountIsForced(udi, AutomounterSettings::Attach); | ||
113 | } | 114 | } | ||
114 | 115 | | |||
115 | const Solid::Device dev(udi); | 116 | const Solid::Device dev(udi); | ||
116 | if (dev.isValid()) { | 117 | if (dev.isValid()) { | ||
118 | if (dev.is<Solid::StorageAccess>()) { | ||||
119 | const Solid::StorageAccess *access = dev.as<Solid::StorageAccess>(); | ||||
broulik: Do we want to add items that are *not* a `StorageAccess`?
Shouldn't this be more like
```
if… | |||||
I needed to add the not mounted storage access as storage access ignores not mounted system meven: I needed to add the not mounted storage access as storage access ignores not mounted system | |||||
120 | if (!access->isIgnored() || !access->isAccessible()) { | ||||
117 | beginInsertRows(index(0, 0), m_attached.size(), m_attached.size()); | 121 | beginInsertRows(index(0, 0), m_attached.size(), m_attached.size()); | ||
118 | m_attached << udi; | 122 | m_attached << udi; | ||
123 | endInsertRows(); | ||||
124 | } | ||||
125 | } | ||||
119 | } else { | 126 | } else { | ||
120 | beginInsertRows(index(1, 0), m_disconnected.size(), m_disconnected.size()); | 127 | beginInsertRows(index(1, 0), m_disconnected.size(), m_disconnected.size()); | ||
121 | m_disconnected << udi; | 128 | m_disconnected << udi; | ||
122 | } | | |||
123 | | ||||
124 | endInsertRows(); | 129 | endInsertRows(); | ||
125 | } | 130 | } | ||
131 | } | ||||
126 | 132 | | |||
127 | void DeviceModel::reload() | 133 | void DeviceModel::reload() | ||
128 | { | 134 | { | ||
129 | beginResetModel(); | 135 | beginResetModel(); | ||
130 | m_loginForced.clear(); | 136 | m_loginForced.clear(); | ||
131 | m_attachedForced.clear(); | 137 | m_attachedForced.clear(); | ||
132 | m_attached.clear(); | 138 | m_attached.clear(); | ||
133 | m_disconnected.clear(); | 139 | m_disconnected.clear(); | ||
▲ Show 20 Lines • Show All 197 Lines • Show Last 20 Lines |
Do we want to add items that are *not* a StorageAccess?
Shouldn't this be more like