diff --git a/src/plasma/pluginloader.h b/src/plasma/pluginloader.h --- a/src/plasma/pluginloader.h +++ b/src/plasma/pluginloader.h @@ -82,8 +82,7 @@ * @param parentApp the application to filter dataengines 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 dataengines not specifically - * registered to an application. + * list of all dataengines. */ static QStringList listAllEngines(const QString &parentApp = QString()); @@ -93,8 +92,7 @@ * @param parentApp the application to filter dataengines 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 dataengines not specifically - * registered to an application. + * list of all dataengines. * @return list of dataengines **/ static KPluginInfo::List listEngineInfo(const QString &parentApp = QString()); @@ -110,8 +108,7 @@ * @param parentApp the application to filter dataengines 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 dataengines not specifically - * registered to an application. + * list of all dataengines in specified categories. * @return list of dataengines * @since 4.3 **/ @@ -169,8 +166,7 @@ * @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. + * list of all applets in specified category. * @return list of applets * * @deprecated use listAppletMetaData. Doesn't support metadata.json packages. @@ -190,8 +186,7 @@ * @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. + * list of all applets in specified categories. * @return list of applets * * @since 5.28 @@ -236,8 +231,7 @@ * @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. + * list of all Applets. * @return list of categories * @param visibleOnly true if it should only return applets that are marked as visible */ @@ -277,8 +271,7 @@ * @param parentApp the application to filter containments 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 containments not specifically - * registered to an application. + * list of all containments. * @return list of containments **/ static KPluginInfo::List listContainments(const QString &category = QString(), @@ -299,8 +292,7 @@ * @param parentApp the application to filter containments 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 containments not specifically - * registered to an application. + * list of all containments, matching categories/type. * @return list of containments **/ static KPluginInfo::List listContainmentsOfType(const QString &type, @@ -325,8 +317,7 @@ * @param parentApp the application to filter dataengines 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 dataengines not specifically - * registered to an application. + * list of all dataengines * @return list of dataengines **/ KPluginInfo::List listDataEngineInfo(const QString &parentApp = QString()); @@ -337,8 +328,7 @@ * @param parentApp the application to filter ContainmentActions 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 ContainmentActions not specifically - * registered to an application. + * list of all ContainmentActions. * @return list of ContainmentActions **/ KPluginInfo::List listContainmentActionsInfo(const QString &parentApp); diff --git a/src/plasma/pluginloader.cpp b/src/plasma/pluginloader.cpp --- a/src/plasma/pluginloader.cpp +++ b/src/plasma/pluginloader.cpp @@ -58,7 +58,6 @@ } static QSet knownCategories(); - static QString parentAppConstraint(const QString &parentApp = QString()); static QSet s_customCategories; QHash > structures; @@ -119,21 +118,6 @@ return categories; } -QString PluginLoaderPrivate::parentAppConstraint(const QString &parentApp) -{ - if (parentApp.isEmpty()) { - QCoreApplication *app = QCoreApplication::instance(); - if (!app) { - return QString(); - } - - return QStringLiteral("((not exist [X-KDE-ParentApp] or [X-KDE-ParentApp] == '') or [X-KDE-ParentApp] == '%1')") - .arg(app->applicationName()); - } - - return QStringLiteral("[X-KDE-ParentApp] == '%1'").arg(parentApp); -} - PluginLoader::PluginLoader() : d(new PluginLoaderPrivate) { @@ -535,17 +519,17 @@ filter = [excluded, parentApp](const KPluginMetaData &md) -> bool { const QString pa = md.value(QStringLiteral("X-KDE-ParentApp")); - return (pa.isEmpty() || pa == parentApp) && !excluded.contains(md.category()); + return (parentApp.isEmpty() || pa == parentApp) && !excluded.contains(md.category()); }; } else { //specific category (this could be an excluded one - is that bad?) filter = [category, parentApp](const KPluginMetaData &md) -> bool { const QString pa = md.value(QStringLiteral("X-KDE-ParentApp")); if (category == QLatin1String("Miscellaneous")) { - return (pa.isEmpty() || pa == parentApp) && (md.category() == category || md.category().isEmpty()); + return (parentApp.isEmpty() || pa == parentApp) && (md.category() == category || md.category().isEmpty()); } else { - return (pa.isEmpty() || pa == parentApp) && md.category() == category; + return (parentApp.isEmpty() || pa == parentApp) && md.category() == category; } }; } @@ -600,7 +584,7 @@ auto filter = [&parentApp](const KPluginMetaData &md) -> bool { const QString pa = md.value(QStringLiteral("X-KDE-ParentApp")); - return (pa.isEmpty() || pa == parentApp) && !KPluginMetaData::readStringList(md.rawData(), QStringLiteral("X-Plasma-DropUrlPatterns")).isEmpty(); + return (parentApp.isEmpty() || pa == parentApp) && !KPluginMetaData::readStringList(md.rawData(), QStringLiteral("X-Plasma-DropUrlPatterns")).isEmpty(); }; const QList allApplets = KPackage::PackageLoader::self()->findPackages(QStringLiteral("Plasma/Applet"), QString(), filter); @@ -634,7 +618,7 @@ auto filter = [&parentApp, &excluded, visibleOnly](const KPluginMetaData &md) -> bool { const QString pa = md.value(QStringLiteral("X-KDE-ParentApp")); - return (pa.isEmpty() || pa == parentApp) + return (parentApp.isEmpty() || pa == parentApp) && (excluded.isEmpty() || excluded.contains(md.value(QStringLiteral("X-KDE-PluginInfo-Category")))) && (!visibleOnly || !md.isHidden()); }; @@ -695,8 +679,7 @@ if (!md.serviceTypes().contains(QStringLiteral("Plasma/Containment"))) { return false; } - const QString pa = md.value(QStringLiteral("X-KDE-ParentApp")); - if (!pa.isEmpty() && pa != parentApp) { + if (!parentApp.isEmpty() && md.value(QStringLiteral("X-KDE-ParentApp")) != parentApp) { return false; } @@ -749,9 +732,7 @@ } QString constraint; - if (parentApp.isEmpty()) { - constraint = QStringLiteral("not exist [X-KDE-ParentApp]"); - } else { + if (!parentApp.isEmpty()) { constraint = QLatin1String("[X-KDE-ParentApp] == '") + parentApp + QLatin1Char('\''); } @@ -768,9 +749,7 @@ } QString constraint; - if (parentApp.isEmpty()) { - constraint = QStringLiteral("not exist [X-KDE-ParentApp]"); - } else { + if (!parentApp.isEmpty()) { constraint = QLatin1String("[X-KDE-ParentApp] == '") + parentApp + QLatin1Char('\''); }