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