Changeset View
Changeset View
Standalone View
Standalone View
kcms/kded/kcmkded.cpp
Show First 20 Lines • Show All 70 Lines • ▼ Show 20 Line(s) | 61 | { | |||
---|---|---|---|---|---|
71 | about->addAuthor(i18n("Daniel Molkentin"), QString(),QStringLiteral("molkentin@kde.org")); | 71 | about->addAuthor(i18n("Daniel Molkentin"), QString(),QStringLiteral("molkentin@kde.org")); | ||
72 | about->addAuthor(i18n("Kai Uwe Broulik"), QString(),QStringLiteral("kde@broulik.de")); | 72 | about->addAuthor(i18n("Kai Uwe Broulik"), QString(),QStringLiteral("kde@broulik.de")); | ||
73 | setAboutData(about); | 73 | setAboutData(about); | ||
74 | setButtons(Apply|Default|Help); | 74 | setButtons(Apply|Default|Help); | ||
75 | 75 | | |||
76 | m_filteredModel->setSourceModel(m_model); | 76 | m_filteredModel->setSourceModel(m_model); | ||
77 | 77 | | |||
78 | connect(m_model, &ModulesModel::autoloadedModulesChanged, this, [this] { | 78 | connect(m_model, &ModulesModel::autoloadedModulesChanged, this, [this] { | ||
79 | setNeedsSave(true); | 79 | setNeedsSave(m_model->needsSave()); | ||
80 | setRepresentsDefaults(m_model->representsDefault()); | ||||
80 | }); | 81 | }); | ||
81 | 82 | | |||
82 | connect(m_kdedWatcher, &QDBusServiceWatcher::serviceOwnerChanged, this, | 83 | connect(m_kdedWatcher, &QDBusServiceWatcher::serviceOwnerChanged, this, | ||
83 | [this](const QString &service, const QString &oldOwner, const QString &newOwner) { | 84 | [this](const QString &service, const QString &oldOwner, const QString &newOwner) { | ||
84 | Q_UNUSED(service) | 85 | Q_UNUSED(service) | ||
85 | Q_UNUSED(oldOwner) | 86 | Q_UNUSED(oldOwner) | ||
86 | setKdedRunning(!newOwner.isEmpty()); | 87 | setKdedRunning(!newOwner.isEmpty()); | ||
87 | }); | 88 | }); | ||
▲ Show 20 Lines • Show All 119 Lines • ▼ Show 20 Line(s) | 172 | { | |||
207 | }); | 208 | }); | ||
208 | } | 209 | } | ||
209 | 210 | | |||
210 | void KDEDConfig::load() | 211 | void KDEDConfig::load() | ||
211 | { | 212 | { | ||
212 | m_model->load(); | 213 | m_model->load(); | ||
213 | 214 | | |||
214 | setNeedsSave(false); | 215 | setNeedsSave(false); | ||
216 | setRepresentsDefaults(m_model->representsDefault()); | ||||
215 | } | 217 | } | ||
216 | 218 | | |||
217 | void KDEDConfig::save() | 219 | void KDEDConfig::save() | ||
218 | { | 220 | { | ||
219 | KConfig kdedrc(QStringLiteral("kded5rc"), KConfig::NoGlobals); | 221 | KConfig kdedrc(QStringLiteral("kded5rc"), KConfig::NoGlobals); | ||
220 | 222 | | |||
221 | for (int i = 0; i < m_model->rowCount(); ++i) { | 223 | for (int i = 0; i < m_model->rowCount(); ++i) { | ||
222 | const QModelIndex idx = m_model->index(i, 0); | 224 | const QModelIndex idx = m_model->index(i, 0); | ||
223 | 225 | | |||
224 | const auto type = static_cast<ModuleType>(idx.data(ModulesModel::TypeRole).toInt()); | 226 | const auto type = static_cast<ModuleType>(idx.data(ModulesModel::TypeRole).toInt()); | ||
225 | if (type != AutostartType) { | 227 | if (type != AutostartType) { | ||
226 | continue; | 228 | continue; | ||
227 | } | 229 | } | ||
228 | 230 | | |||
229 | const QString moduleName = idx.data(ModulesModel::ModuleNameRole).toString(); | 231 | const QString moduleName = idx.data(ModulesModel::ModuleNameRole).toString(); | ||
230 | 232 | | |||
231 | const bool autoloadEnabled = idx.data(ModulesModel::AutoloadEnabledRole).toBool(); | 233 | const bool autoloadEnabled = idx.data(ModulesModel::AutoloadEnabledRole).toBool(); | ||
232 | KConfigGroup cg(&kdedrc, QStringLiteral("Module-%1").arg(moduleName)); | 234 | KConfigGroup cg(&kdedrc, QStringLiteral("Module-%1").arg(moduleName)); | ||
ervin: Missing space after , | |||||
233 | cg.writeEntry("autoload", autoloadEnabled); | 235 | cg.writeEntry("autoload", autoloadEnabled); | ||
234 | } | 236 | } | ||
235 | 237 | | |||
236 | kdedrc.sync(); | 238 | kdedrc.sync(); | ||
237 | 239 | m_model->refreshAutoloadEnabledSavedState(); | |||
238 | setNeedsSave(false); | 240 | setNeedsSave(false); | ||
239 | 241 | | |||
240 | m_runningModulesBeforeReconfigure = m_model->runningModules(); | 242 | m_runningModulesBeforeReconfigure = m_model->runningModules(); | ||
241 | 243 | | |||
242 | // Is all of this really necessary? I would also think it to be fire and forget... | 244 | // Is all of this really necessary? I would also think it to be fire and forget... | ||
243 | // Only if changing autoload for a module may load/unload it, otherwise there's no point. | 245 | // Only if changing autoload for a module may load/unload it, otherwise there's no point. | ||
244 | // Autoload doesn't affect a running session and reloading the running modules is also useless then. | 246 | // Autoload doesn't affect a running session and reloading the running modules is also useless then. | ||
245 | auto call = m_kdedInterface->reconfigure(); | 247 | auto call = m_kdedInterface->reconfigure(); | ||
Show All 11 Lines | 249 | connect(callWatcher, &QDBusPendingCallWatcher::finished, this, [this](QDBusPendingCallWatcher *watcher) { | |||
257 | getModuleStatus(); | 259 | getModuleStatus(); | ||
258 | }); | 260 | }); | ||
259 | } | 261 | } | ||
260 | 262 | | |||
261 | void KDEDConfig::defaults() | 263 | void KDEDConfig::defaults() | ||
262 | { | 264 | { | ||
263 | for (int i = 0; i < m_model->rowCount(); ++i) { | 265 | for (int i = 0; i < m_model->rowCount(); ++i) { | ||
264 | const QModelIndex idx = m_model->index(i, 0); | 266 | const QModelIndex idx = m_model->index(i, 0); | ||
265 | if (m_model->setData(idx, true, ModulesModel::AutoloadEnabledRole)) { | 267 | m_model->setData(idx, true, ModulesModel::AutoloadEnabledRole); | ||
broulik: I think instead you could have the model refuse to `setData` when immutable | |||||
266 | setNeedsSave(true); | | |||
267 | } | | |||
268 | } | 268 | } | ||
269 | } | 269 | } | ||
270 | 270 | | |||
271 | #include "kcmkded.moc" | 271 | #include "kcmkded.moc" |
Missing space after ,