diff --git a/dataenginemanager.cpp b/dataenginemanager.cpp index 9bf78d43b..59098074e 100644 --- a/dataenginemanager.cpp +++ b/dataenginemanager.cpp @@ -165,10 +165,19 @@ void DataEngineManager::unloadEngine(const QString &name) } } -QStringList DataEngineManager::listAllEngines() +QStringList DataEngineManager::listAllEngines(const QString &parentApp) { + QString constraint; + + if (parentApp.isEmpty()) { + constraint.append("not exist [X-KDE-ParentApp]"); + } else { + constraint.append("[X-KDE-ParentApp] == '").append(parentApp).append("'"); + } + + KService::List offers = KServiceTypeTrader::self()->query("Plasma/DataEngine", constraint); + QStringList engines; - KService::List offers = KServiceTypeTrader::self()->query("Plasma/DataEngine"); foreach (const KService::Ptr &service, offers) { QString name = service->property("X-KDE-PluginInfo-Name").toString(); if (!name.isEmpty()) { diff --git a/dataenginemanager.h b/dataenginemanager.h index 3519cc510..56dc5ba7b 100644 --- a/dataenginemanager.h +++ b/dataenginemanager.h @@ -72,9 +72,15 @@ class PLASMA_EXPORT DataEngineManager: public QObject void unloadEngine(const QString &name); /** - * Returns a listing of all known engines by name + * @return a listing of all known engines by name + * + * @param parentApp the application to filter applets on. Uses the + * X-KDE-ParentApp entry (if any) in the plugin info. + * The default value of QString() will result in a + * list containing only applets not specifically + * registered to an application. */ - static QStringList listAllEngines(); + static QStringList listAllEngines(const QString &parentApp = QString()); private: /**