Changeset View
Changeset View
Standalone View
Standalone View
shell/scripting/scriptengine.cpp
Show First 20 Lines • Show All 305 Lines • ▼ Show 20 Line(s) | 305 | if (scripts.isEmpty()) { | |||
---|---|---|---|---|---|
306 | //qDebug() << "no update scripts"; | 306 | //qDebug() << "no update scripts"; | ||
307 | return scriptPaths; | 307 | return scriptPaths; | ||
308 | } | 308 | } | ||
309 | 309 | | |||
310 | KConfigGroup cg(KSharedConfig::openConfig(), "Updates"); | 310 | KConfigGroup cg(KSharedConfig::openConfig(), "Updates"); | ||
311 | QStringList performed = cg.readEntry("performed", QStringList()); | 311 | QStringList performed = cg.readEntry("performed", QStringList()); | ||
312 | const QString localXdgDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation); | 312 | const QString localXdgDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation); | ||
313 | 313 | | |||
314 | foreach (const QString &script, scripts) { | 314 | for (const QString &script : qAsConst(scripts)) { | ||
315 | if (performed.contains(script)) { | 315 | if (performed.contains(script)) { | ||
316 | continue; | 316 | continue; | ||
317 | } | 317 | } | ||
318 | 318 | | |||
319 | if (script.startsWith(localXdgDir)) { | 319 | if (script.startsWith(localXdgDir)) { | ||
320 | // qDebug() << "skipping user local script: " << script; | 320 | // qDebug() << "skipping user local script: " << script; | ||
321 | continue; | 321 | continue; | ||
322 | } | 322 | } | ||
Show All 32 Lines | 353 | if (act == id) { | |||
355 | break; | 355 | break; | ||
356 | } | 356 | } | ||
357 | } | 357 | } | ||
358 | 358 | | |||
359 | if (!found) { | 359 | if (!found) { | ||
360 | return result; | 360 | return result; | ||
361 | } | 361 | } | ||
362 | 362 | | |||
363 | foreach (Plasma::Containment *c, m_corona->containments()) { | 363 | const auto containments = m_corona->containments(); | ||
364 | for (Plasma::Containment *c : containments) { | ||||
364 | if (c->activity() == id && !isPanel(c)) { | 365 | if (c->activity() == id && !isPanel(c)) { | ||
365 | result << new Containment(c, this); | 366 | result << new Containment(c, this); | ||
366 | } | 367 | } | ||
367 | } | 368 | } | ||
368 | 369 | | |||
369 | if (result.count() == 0) { | 370 | if (result.count() == 0) { | ||
370 | // we have no desktops for this activity, so lets make them now | 371 | // we have no desktops for this activity, so lets make them now | ||
371 | // this can happen when the activity already exists but has never been activated | 372 | // this can happen when the activity already exists but has never been activated | ||
372 | // with the current shell package and layout.js is run to set up the shell for the | 373 | // with the current shell package and layout.js is run to set up the shell for the | ||
373 | // first time | 374 | // first time | ||
374 | ShellCorona *sc = qobject_cast<ShellCorona *>(m_corona); | 375 | ShellCorona *sc = qobject_cast<ShellCorona *>(m_corona); | ||
375 | StandaloneAppCorona *ac = qobject_cast<StandaloneAppCorona *>(m_corona); | 376 | StandaloneAppCorona *ac = qobject_cast<StandaloneAppCorona *>(m_corona); | ||
376 | if (sc) { | 377 | if (sc) { | ||
377 | foreach (int i, sc->screenIds()) { | 378 | const auto screenIds = sc->screenIds(); | ||
379 | for (int i : screenIds) { | ||||
378 | result << new Containment(sc->createContainmentForActivity(id, i), this); | 380 | result << new Containment(sc->createContainmentForActivity(id, i), this); | ||
379 | } | 381 | } | ||
380 | } else if (ac) { | 382 | } else if (ac) { | ||
381 | const int numScreens = m_corona->numScreens(); | 383 | const int numScreens = m_corona->numScreens(); | ||
382 | for (int i = 0; i < numScreens; ++i) { | 384 | for (int i = 0; i < numScreens; ++i) { | ||
383 | result << new Containment(ac->createContainmentForActivity(id, i), this); | 385 | result << new Containment(ac->createContainmentForActivity(id, i), this); | ||
384 | } | 386 | } | ||
385 | } | 387 | } | ||
386 | } | 388 | } | ||
387 | 389 | | |||
388 | return result; | 390 | return result; | ||
389 | } | 391 | } | ||
390 | 392 | | |||
391 | Plasma::Containment *ScriptEngine::createContainment(const QString &type, const QString &plugin) | 393 | Plasma::Containment *ScriptEngine::createContainment(const QString &type, const QString &plugin) | ||
392 | { | 394 | { | ||
393 | bool exists = false; | 395 | bool exists = false; | ||
394 | const KPluginInfo::List list = Plasma::PluginLoader::listContainmentsOfType(type); | 396 | const KPluginInfo::List list = Plasma::PluginLoader::listContainmentsOfType(type); | ||
395 | foreach (const KPluginInfo &info, list) { | 397 | for (const KPluginInfo &info : list) { | ||
396 | if (info.pluginName() == plugin) { | 398 | if (info.pluginName() == plugin) { | ||
397 | exists = true; | 399 | exists = true; | ||
398 | break; | 400 | break; | ||
399 | } | 401 | } | ||
400 | } | 402 | } | ||
401 | 403 | | |||
402 | if (!exists) { | 404 | if (!exists) { | ||
403 | return nullptr; | 405 | return nullptr; | ||
▲ Show 20 Lines • Show All 44 Lines • Show Last 20 Lines |