don't show categories with no visible items in them
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=738621
This commit is contained in:
parent
07e9e1d3e3
commit
71b89ebb5f
@ -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"))) {
|
||||
|
3
applet.h
3
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
|
||||
|
Loading…
Reference in New Issue
Block a user