Changeset View
Changeset View
Standalone View
Standalone View
dataengines/share/shareengine.cpp
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Line(s) | |||||
44 | void ShareEngine::updatePlugins(const QStringList &changes) | 44 | void ShareEngine::updatePlugins(const QStringList &changes) | ||
45 | { | 45 | { | ||
46 | if (!changes.contains(QStringLiteral("services"))) { | 46 | if (!changes.contains(QStringLiteral("services"))) { | ||
47 | return; | 47 | return; | ||
48 | } | 48 | } | ||
49 | 49 | | |||
50 | removeAllSources(); | 50 | removeAllSources(); | ||
51 | 51 | | |||
52 | KService::List services = KServiceTypeTrader::self()->query(QStringLiteral("Plasma/ShareProvider")); | 52 | const KService::List services = KServiceTypeTrader::self()->query(QStringLiteral("Plasma/ShareProvider")); | ||
53 | QMultiMap<int, KService::Ptr> sortedServices; | 53 | QMultiMap<int, KService::Ptr> sortedServices; | ||
54 | foreach (KService::Ptr service, services) { | 54 | for (KService::Ptr service : services) { | ||
apol: const & | |||||
55 | sortedServices.insert(service->property(QStringLiteral("X-KDE-Priority")).toInt(), service); | 55 | sortedServices.insert(service->property(QStringLiteral("X-KDE-Priority")).toInt(), service); | ||
56 | } | 56 | } | ||
57 | 57 | | |||
58 | QMapIterator<int, KService::Ptr> it(sortedServices); | 58 | QMapIterator<int, KService::Ptr> it(sortedServices); | ||
59 | it.toBack(); | 59 | it.toBack(); | ||
60 | QHash<QString, QStringList> mimetypes; | 60 | QHash<QString, QStringList> mimetypes; | ||
61 | while (it.hasPrevious()) { | 61 | while (it.hasPrevious()) { | ||
62 | it.previous(); | 62 | it.previous(); | ||
Show All 11 Lines | |||||
74 | // create the list of providers | 74 | // create the list of providers | ||
75 | Plasma::DataEngine::Data data; | 75 | Plasma::DataEngine::Data data; | ||
76 | data.insert(QStringLiteral("Name"), service->name()); | 76 | data.insert(QStringLiteral("Name"), service->name()); | ||
77 | data.insert(QStringLiteral("Service Id"), service->storageId()); | 77 | data.insert(QStringLiteral("Service Id"), service->storageId()); | ||
78 | data.insert(QStringLiteral("Mimetypes"), pluginMimeTypes); | 78 | data.insert(QStringLiteral("Mimetypes"), pluginMimeTypes); | ||
79 | setData(pluginName, data); | 79 | setData(pluginName, data); | ||
80 | 80 | | |||
81 | // create the list of providers by type | 81 | // create the list of providers by type | ||
82 | foreach (const QString &pluginMimeType, pluginMimeTypes) { | 82 | for (const QString &pluginMimeType : qAsConst(pluginMimeTypes)) { | ||
83 | mimetypes[pluginMimeType].append(pluginName); | 83 | mimetypes[pluginMimeType].append(pluginName); | ||
84 | } | 84 | } | ||
85 | } | 85 | } | ||
86 | 86 | | |||
87 | 87 | | |||
88 | QHashIterator<QString, QStringList> it2(mimetypes); | 88 | QHashIterator<QString, QStringList> it2(mimetypes); | ||
89 | while (it2.hasNext()) { | 89 | while (it2.hasNext()) { | ||
90 | it2.next(); | 90 | it2.next(); | ||
Show All 30 Lines |
const &