Changeset View
Changeset View
Standalone View
Standalone View
solid-device-automounter/kcm/DeviceAutomounterKCM.cpp
Show First 20 Lines • Show All 84 Lines • ▼ Show 20 Line(s) | |||||
85 | 85 | | |||
86 | DeviceAutomounterKCM::~DeviceAutomounterKCM() | 86 | DeviceAutomounterKCM::~DeviceAutomounterKCM() | ||
87 | { | 87 | { | ||
88 | saveLayout(); | 88 | saveLayout(); | ||
89 | } | 89 | } | ||
90 | 90 | | |||
91 | void DeviceAutomounterKCM::updateForgetDeviceButton() | 91 | void DeviceAutomounterKCM::updateForgetDeviceButton() | ||
92 | { | 92 | { | ||
93 | foreach (const QModelIndex &idx, deviceView->selectionModel()->selectedIndexes()) { | 93 | const auto selectedIndex = deviceView->selectionModel()->selectedIndexes(); | ||
94 | for (const QModelIndex &idx : selectedIndex) { | ||||
94 | if (idx.data(DeviceModel::TypeRole) == DeviceModel::Detatched) { | 95 | if (idx.data(DeviceModel::TypeRole) == DeviceModel::Detatched) { | ||
95 | forgetDevice->setEnabled(true); | 96 | forgetDevice->setEnabled(true); | ||
96 | return; | 97 | return; | ||
97 | } | 98 | } | ||
98 | } | 99 | } | ||
99 | forgetDevice->setEnabled(false); | 100 | forgetDevice->setEnabled(false); | ||
100 | } | 101 | } | ||
101 | 102 | | |||
▲ Show 20 Lines • Show All 65 Lines • ▼ Show 20 Line(s) | 155 | for (int j = 0; j < m_devices->rowCount(idx); ++j) { | |||
167 | if (dev.data(Qt::CheckStateRole).toInt() == Qt::Checked) { | 168 | if (dev.data(Qt::CheckStateRole).toInt() == Qt::Checked) { | ||
168 | AutomounterSettings::deviceSettings(device).writeEntry("ForceAttachAutomount", true); | 169 | AutomounterSettings::deviceSettings(device).writeEntry("ForceAttachAutomount", true); | ||
169 | } else { | 170 | } else { | ||
170 | AutomounterSettings::deviceSettings(device).writeEntry("ForceAttachAutomount", false); | 171 | AutomounterSettings::deviceSettings(device).writeEntry("ForceAttachAutomount", false); | ||
171 | } | 172 | } | ||
172 | } | 173 | } | ||
173 | } | 174 | } | ||
174 | 175 | | |||
175 | foreach (const QString &possibleDevice, AutomounterSettings::knownDevices()) { | 176 | const auto knownDevices = AutomounterSettings::knownDevices(); | ||
177 | for (const QString &possibleDevice : knownDevices) { | ||||
176 | if (!validDevices.contains(possibleDevice)) { | 178 | if (!validDevices.contains(possibleDevice)) { | ||
177 | AutomounterSettings::deviceSettings(possibleDevice).deleteGroup(); | 179 | AutomounterSettings::deviceSettings(possibleDevice).deleteGroup(); | ||
178 | } | 180 | } | ||
179 | } | 181 | } | ||
180 | 182 | | |||
181 | AutomounterSettings::self()->save(); | 183 | AutomounterSettings::self()->save(); | ||
182 | 184 | | |||
183 | // Now tell kded to automatically load the module if loaded | 185 | // Now tell kded to automatically load the module if loaded | ||
▲ Show 20 Lines • Show All 54 Lines • Show Last 20 Lines |