Changeset View
Changeset View
Standalone View
Standalone View
libtaskmanager/tasktools.cpp
Show First 20 Lines • Show All 638 Lines • ▼ Show 20 Line(s) | 637 | } else if (application.compare(QLatin1String("filemanager"), Qt::CaseInsensitive) == 0) { | |||
---|---|---|---|---|---|
639 | 639 | | |||
640 | if (service) { | 640 | if (service) { | ||
641 | return service->storageId(); | 641 | return service->storageId(); | ||
642 | } | 642 | } | ||
643 | } else if (KService::Ptr service = KMimeTypeTrader::self()->preferredService(application)) { | 643 | } else if (KService::Ptr service = KMimeTypeTrader::self()->preferredService(application)) { | ||
644 | return service->storageId(); | 644 | return service->storageId(); | ||
645 | } else { | 645 | } else { | ||
646 | // Try the files in share/apps/kcm_componentchooser/*.desktop. | 646 | // Try the files in share/apps/kcm_componentchooser/*.desktop. | ||
647 | QStringList directories = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("kcm_componentchooser"), QStandardPaths::LocateDirectory); | 647 | const QStringList directories = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("kcm_componentchooser"), QStandardPaths::LocateDirectory); | ||
648 | QStringList services; | 648 | QStringList services; | ||
649 | 649 | | |||
650 | foreach(const QString& directory, directories) { | 650 | for (const QString& directory : directories) { | ||
651 | QDir dir(directory); | 651 | QDir dir(directory); | ||
652 | foreach(const QString& f, dir.entryList(QStringList("*.desktop"))) | 652 | const auto entries = dir.entryList(QStringList("*.desktop")); | ||
653 | for (const QString& f : entries) | ||||
653 | services += dir.absoluteFilePath(f); | 654 | services += dir.absoluteFilePath(f); | ||
654 | } | 655 | } | ||
655 | 656 | | |||
656 | foreach (const QString & service, services) { | 657 | for (const QString & service : qAsConst(services)) { | ||
657 | KConfig config(service, KConfig::SimpleConfig); | 658 | KConfig config(service, KConfig::SimpleConfig); | ||
658 | KConfigGroup cg = config.group(QByteArray()); | 659 | KConfigGroup cg = config.group(QByteArray()); | ||
659 | const QString type = cg.readEntry("valueName", QString()); | 660 | const QString type = cg.readEntry("valueName", QString()); | ||
660 | 661 | | |||
661 | if (type.compare(application, Qt::CaseInsensitive) == 0) { | 662 | if (type.compare(application, Qt::CaseInsensitive) == 0) { | ||
662 | KConfig store(cg.readPathEntry("storeInFile", QStringLiteral("null"))); | 663 | KConfig store(cg.readPathEntry("storeInFile", QStringLiteral("null"))); | ||
663 | KConfigGroup storeCg(&store, cg.readEntry("valueSection", QString())); | 664 | KConfigGroup storeCg(&store, cg.readEntry("valueSection", QString())); | ||
664 | const QString exec = storeCg.readPathEntry(cg.readEntry("valueName", "kcm_componenchooser_null"), | 665 | const QString exec = storeCg.readPathEntry(cg.readEntry("valueName", "kcm_componenchooser_null"), | ||
▲ Show 20 Lines • Show All 143 Lines • Show Last 20 Lines |