add the last missing piece: KPluginInfo::List listToolBoxInfo

svn path=/trunk/KDE/kdelibs/; revision=1157557
This commit is contained in:
Marco Martin 2010-07-31 15:24:19 +00:00
parent 72a06cdd14
commit 6162c8af99
2 changed files with 36 additions and 0 deletions

View File

@ -76,6 +76,26 @@ AbstractToolBox *AbstractToolBox::load(const QString &name, const QVariantList &
}
}
KPluginInfo::List AbstractToolBox::listToolBoxInfo(const QString
&parentApp)
{
KPluginInfo::List list;
if (parentApp.isEmpty() || parentApp == KGlobal::mainComponent().componentName()) {
list = KPluginInfo::List();
}
QString constraint;
if (parentApp.isEmpty()) {
constraint.append("not exist [X-KDE-ParentApp]");
} else {
constraint.append("[X-KDE-ParentApp] == '").append(parentApp).append("'");
}
KService::List offers = KServiceTypeTrader::self()->query("Plasma/ToolBox", constraint);
return list + KPluginInfo::fromServices(offers);
}
Containment *AbstractToolBox::containment() const
{
return d->containment;

View File

@ -23,6 +23,8 @@
#include <QGraphicsWidget>
#include <QGraphicsItem>
#include <kplugininfo.h>
#include "plasma/plasma_export.h"
class QAction;
@ -66,6 +68,20 @@ public:
*/
static AbstractToolBox *load(const QString &name, const QVariantList &args=QVariantList(), Plasma::Containment *containment=0);
/**
* Returns a list of all installed ToolBox plugins
*
* @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.
*
* @since 4.6
*/
static KPluginInfo::List listToolBoxInfo(const QString
&parentApp = QString());
/**
* create a toolbox tool from the given action
* @p action the action to associate the tool with