make it possible to add custom (e.g. application specific) applet categories
CCMAIL:oszkar.ambrus@deri.org svn path=/trunk/KDE/kdelibs/; revision=969430
This commit is contained in:
parent
0b8924ce20
commit
09e4b24817
13
applet.cpp
13
applet.cpp
@ -1584,7 +1584,7 @@ QSet<QString> AppletPrivate::knownCategories()
|
||||
{
|
||||
// this is to trick the tranlsation tools into making the correct
|
||||
// strings for translation
|
||||
QSet<QString> categories;
|
||||
QSet<QString> categories = s_customCategories;
|
||||
categories << QString(I18N_NOOP("Accessibility")).toLower()
|
||||
<< QString(I18N_NOOP("Application Launchers")).toLower()
|
||||
<< QString(I18N_NOOP("Astronomy")).toLower()
|
||||
@ -1829,6 +1829,16 @@ QStringList Applet::listCategories(const QString &parentApp, bool visibleOnly)
|
||||
return categories;
|
||||
}
|
||||
|
||||
void Applet::setCustomCategories(const QStringList &categories)
|
||||
{
|
||||
AppletPrivate::s_customCategories = QSet<QString>::fromList(categories);
|
||||
}
|
||||
|
||||
QStringList Applet::customCategories()
|
||||
{
|
||||
return AppletPrivate::s_customCategories.toList();
|
||||
}
|
||||
|
||||
Applet::Applet(const QString &packagePath, uint appletId, const QVariantList &args)
|
||||
: QGraphicsWidget(0),
|
||||
d(new AppletPrivate(KService::Ptr(new KService(packagePath + "/metadata.desktop")), appletId, this))
|
||||
@ -2421,6 +2431,7 @@ uint AppletPrivate::s_maxAppletId = 0;
|
||||
int AppletPrivate::s_maxZValue = 0;
|
||||
int AppletPrivate::s_minZValue = 0;
|
||||
PackageStructure::Ptr AppletPrivate::packageStructure(0);
|
||||
QSet<QString> AppletPrivate::s_customCategories;
|
||||
|
||||
AppletOverlayWidget::AppletOverlayWidget(QGraphicsWidget *parent)
|
||||
: QGraphicsWidget(parent),
|
||||
|
17
applet.h
17
applet.h
@ -296,8 +296,7 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
|
||||
static KPluginInfo::List listAppletInfoForMimetype(const QString &mimetype);
|
||||
|
||||
/**
|
||||
* Returns a list of all the categories used by
|
||||
* installed applets.
|
||||
* Returns a list of all the categories used by installed applets.
|
||||
*
|
||||
* @param parentApp the application to filter applets on. Uses the
|
||||
* X-KDE-ParentApp entry (if any) in the plugin info.
|
||||
@ -310,6 +309,20 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
|
||||
static QStringList listCategories(const QString &parentApp = QString(),
|
||||
bool visibleOnly = true);
|
||||
|
||||
/**
|
||||
* Sets the list of custom categories that are used in addition to the default
|
||||
* set of categories known to libplasma for Applets.
|
||||
* @arg categories a list of categories
|
||||
* @since 4.3
|
||||
*/
|
||||
void setCustomCategories(const QStringList &categories);
|
||||
|
||||
/**
|
||||
* @return the list of custom categories known to libplasma
|
||||
* @since 4.3
|
||||
*/
|
||||
QStringList customCategories();
|
||||
|
||||
/**
|
||||
* Attempts to load an apppet from a package
|
||||
*
|
||||
|
@ -104,6 +104,7 @@ public:
|
||||
static int s_maxZValue;
|
||||
static int s_minZValue;
|
||||
static PackageStructure::Ptr packageStructure;
|
||||
static QSet<QString> s_customCategories;
|
||||
|
||||
//TODO: examine the usage of memory here; there's a pretty large
|
||||
// number of members at this point.
|
||||
|
Loading…
Reference in New Issue
Block a user