Changeset View
Changeset View
Standalone View
Standalone View
src/plasmaquick/configview.cpp
Show First 20 Lines • Show All 157 Lines • ▼ Show 20 Line(s) | 157 | kcms.erase(std::remove_if(kcms.begin(), kcms.end(), [](const QString &kcm) { | |||
---|---|---|---|---|---|
158 | return !KAuthorized::authorizeControlModule(kcm + QLatin1String(".desktop")); | 158 | return !KAuthorized::authorizeControlModule(kcm + QLatin1String(".desktop")); | ||
159 | }), kcms.end()); | 159 | }), kcms.end()); | ||
160 | 160 | | |||
161 | if (!kcms.isEmpty()) { | 161 | if (!kcms.isEmpty()) { | ||
162 | if (!configModel) { | 162 | if (!configModel) { | ||
163 | configModel = new ConfigModel(q); | 163 | configModel = new ConfigModel(q); | ||
164 | } | 164 | } | ||
165 | 165 | | |||
166 | foreach (const QString &kcm, kcms) { | 166 | for (const QString &kcm : qAsConst(kcms)) { | ||
167 | KPluginLoader loader(KPluginLoader::findPlugin(QLatin1String("kcms/") + kcm)); | 167 | KPluginLoader loader(KPluginLoader::findPlugin(QLatin1String("kcms/") + kcm)); | ||
168 | KPluginMetaData md(loader.fileName()); | 168 | KPluginMetaData md(loader.fileName()); | ||
169 | 169 | | |||
170 | if (!md.isValid()) { | 170 | if (!md.isValid()) { | ||
171 | qWarning() << "Could not find" << kcm << "specified in X-Plasma-ConfigPlugins"; | 171 | qWarning() << "Could not find" << kcm << "specified in X-Plasma-ConfigPlugins"; | ||
172 | continue; | 172 | continue; | ||
173 | } | 173 | } | ||
174 | 174 | | |||
▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Line(s) | 238 | if (applet) { | |||
241 | q->resize(cg.readEntry("DialogWidth", q->width()), cg.readEntry("DialogHeight", q->height())); | 241 | q->resize(cg.readEntry("DialogWidth", q->width()), cg.readEntry("DialogHeight", q->height())); | ||
242 | } | 242 | } | ||
243 | 243 | | |||
244 | //Extract the representation's Layout, if any | 244 | //Extract the representation's Layout, if any | ||
245 | QObject *layout = nullptr; | 245 | QObject *layout = nullptr; | ||
246 | 246 | | |||
247 | //Search a child that has the needed Layout properties | 247 | //Search a child that has the needed Layout properties | ||
248 | //HACK: here we are not type safe, but is the only way to access to a pointer of Layout | 248 | //HACK: here we are not type safe, but is the only way to access to a pointer of Layout | ||
249 | foreach (QObject *child, q->rootObject()->children()) { | 249 | const auto children = q->rootObject()->children(); | ||
250 | for (QObject *child : children) { | ||||
250 | //find for the needed property of Layout: minimum/maximum/preferred sizes and fillWidth/fillHeight | 251 | //find for the needed property of Layout: minimum/maximum/preferred sizes and fillWidth/fillHeight | ||
251 | if (child->property("minimumWidth").isValid() && child->property("minimumHeight").isValid() && | 252 | if (child->property("minimumWidth").isValid() && child->property("minimumHeight").isValid() && | ||
252 | child->property("preferredWidth").isValid() && child->property("preferredHeight").isValid() && | 253 | child->property("preferredWidth").isValid() && child->property("preferredHeight").isValid() && | ||
253 | child->property("maximumWidth").isValid() && child->property("maximumHeight").isValid() && | 254 | child->property("maximumWidth").isValid() && child->property("maximumHeight").isValid() && | ||
254 | child->property("fillWidth").isValid() && child->property("fillHeight").isValid() | 255 | child->property("fillWidth").isValid() && child->property("fillHeight").isValid() | ||
255 | ) { | 256 | ) { | ||
256 | layout = child; | 257 | layout = child; | ||
257 | break; | 258 | break; | ||
▲ Show 20 Lines • Show All 105 Lines • Show Last 20 Lines |