plasma: drop unused category exclusion feature

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2024-04-11 06:06:33 +03:00
parent a5d1ca3b17
commit 851e7ec05c
4 changed files with 4 additions and 18 deletions

View file

@ -1993,12 +1993,6 @@ QStringList Applet::listCategories(const QString &parentApp, bool visibleOnly)
QString constraint = AppletPrivate::parentAppConstraint(parentApp); QString constraint = AppletPrivate::parentAppConstraint(parentApp);
constraint.append(" and exist [X-KDE-PluginInfo-Category]"); constraint.append(" and exist [X-KDE-PluginInfo-Category]");
KConfigGroup group(KGlobal::config(), "General");
const QStringList excluded = group.readEntry("ExcludeCategories", QStringList());
foreach (const QString &category, excluded) {
constraint.append(" and [X-KDE-PluginInfo-Category] != '").append(category).append("'");
}
KService::List offers = KServiceTypeTrader::self()->query("Plasma/Applet", constraint); KService::List offers = KServiceTypeTrader::self()->query("Plasma/Applet", constraint);
QStringList categories; QStringList categories;
@ -2006,11 +2000,11 @@ QStringList Applet::listCategories(const QString &parentApp, bool visibleOnly)
foreach (const KService::Ptr &applet, offers) { foreach (const KService::Ptr &applet, offers) {
QString appletCategory = applet->property("X-KDE-PluginInfo-Category").toString(); QString appletCategory = applet->property("X-KDE-PluginInfo-Category").toString();
if (visibleOnly && applet->noDisplay()) { if (visibleOnly && applet->noDisplay()) {
// we don't want to show the hidden category // don't want to show the hidden category
continue; continue;
} }
//kDebug() << " and we have " << appletCategory; // kDebug() << " and have " << appletCategory;
if (!appletCategory.isEmpty() && !known.contains(appletCategory.toLower())) { if (!appletCategory.isEmpty() && !known.contains(appletCategory.toLower())) {
kDebug() << "Unknown category: " << applet->name() << "says it is in the" kDebug() << "Unknown category: " << applet->name() << "says it is in the"
<< appletCategory << "category which is unknown to us"; << appletCategory << "category which is unknown to us";

View file

@ -229,7 +229,6 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
/** /**
* Returns a list of all known applets. * Returns a list of all known applets.
* This may skip applets based on ExcludeCategories in the application's config.
* *
* @param category Only applets matchin this category will be returned. * @param category Only applets matchin this category will be returned.
* Useful in conjunction with knownCategories. * Useful in conjunction with knownCategories.

View file

@ -93,14 +93,8 @@ KPluginInfo::List PluginLoader::listAppletInfo(const QString &category, const QS
{ {
QString constraint = AppletPrivate::parentAppConstraint(parentApp); QString constraint = AppletPrivate::parentAppConstraint(parentApp);
//note: constraint guaranteed non-empty from here down if (!category.isEmpty()) {
if (category.isEmpty()) { //use all but the excluded categories // specific category
KConfigGroup group(KGlobal::config(), "General");
QStringList excluded = group.readEntry("ExcludeCategories", QStringList());
foreach (const QString &category, excluded) {
constraint.append(" and [X-KDE-PluginInfo-Category] != '").append(category).append("'");
}
} else { //specific category (this could be an excluded one - is that bad?)
constraint.append(" and [X-KDE-PluginInfo-Category] == '").append(category).append("'"); constraint.append(" and [X-KDE-PluginInfo-Category] == '").append(category).append("'");
if (category == "Miscellaneous") { if (category == "Miscellaneous") {
constraint.append(" or (not exist [X-KDE-PluginInfo-Category] or [X-KDE-PluginInfo-Category] == '')"); constraint.append(" or (not exist [X-KDE-PluginInfo-Category] or [X-KDE-PluginInfo-Category] == '')");

View file

@ -68,7 +68,6 @@ public:
/** /**
* Returns a list of all known applets. * Returns a list of all known applets.
* This may skip applets based on security settings and ExcludeCategories in the application's config.
* *
* @param category Only applets matchin this category will be returned. * @param category Only applets matchin this category will be returned.
* Useful in conjunction with knownCategories. * Useful in conjunction with knownCategories.