diff --git a/applet.cpp b/applet.cpp index 67c7020c7..e4bbef8d4 100644 --- a/applet.cpp +++ b/applet.cpp @@ -1022,7 +1022,7 @@ KPluginInfo::List Applet::knownAppletsForMimetype(const QString &mimetype) return KPluginInfo::fromServices(offers); } -QStringList Applet::knownCategories(const QString &parentApp) +QStringList Applet::knownCategories(const QString &parentApp, bool visibleOnly) { QString constraint = "exist [X-KDE-PluginInfo-Category]"; @@ -1034,8 +1034,13 @@ QStringList Applet::knownCategories(const QString &parentApp) KService::List offers = KServiceTypeTrader::self()->query("Plasma/Applet", constraint); QStringList categories; - foreach (KService::Ptr applet, offers) { + foreach (const KService::Ptr applet, offers) { QString appletCategory = applet->property("X-KDE-PluginInfo-Category").toString(); + if (visibleOnly && applet->property("NoDisplay").toBool()) { + // we don't want to show the hidden category + continue; + } + //kDebug() << " and we have " << appletCategory; if (appletCategory.isEmpty()) { if (!categories.contains(i18n("Miscellaneous"))) { diff --git a/applet.h b/applet.h index 71ff8f35d..74bced14e 100644 --- a/applet.h +++ b/applet.h @@ -270,8 +270,9 @@ class PLASMA_EXPORT Applet : public Widget * list containing only applets not specifically * registered to an application. * @return list of categories + * @param visibleOnly true if it should only return applets that are marked as visible */ - static QStringList knownCategories(const QString &parentApp = QString()); + static QStringList knownCategories(const QString &parentApp = QString(), bool visibleOnly = true); /** * @return true if this plasmoid provides a GUI configuration