Applet::category(appletName) moved in PluginLoader

Applet::category(QString) -> PluginLoader::appletCategory(QString)
This commit is contained in:
Marco Martin 2013-02-12 21:54:08 +01:00
parent 8cccff2b97
commit 4994f9e27a
4 changed files with 23 additions and 22 deletions

View File

@ -407,22 +407,6 @@ KPluginInfo Applet::pluginInfo() const
return d->appletDescription; return d->appletDescription;
} }
QString Applet::category(const QString &appletName)
{
if (appletName.isEmpty()) {
return QString();
}
const QString constraint = QString("[X-KDE-PluginInfo-Name] == '%1'").arg(appletName);
KService::List offers = KServiceTypeTrader::self()->query("Plasma/Applet", constraint);
if (offers.isEmpty()) {
return QString();
}
return offers.first()->property("X-KDE-PluginInfo-Category").toString();
}
ImmutabilityType Applet::immutability() const ImmutabilityType Applet::immutability() const
{ {
// if this object is itself system immutable, then just return that; it's the most // if this object is itself system immutable, then just return that; it's the most

View File

@ -284,12 +284,6 @@ class PLASMA_EXPORT Applet : public QObject
static Applet *loadPlasmoid(const QString &path, uint appletId = 0, static Applet *loadPlasmoid(const QString &path, uint appletId = 0,
const QVariantList &args = QVariantList()); const QVariantList &args = QVariantList());
/**
* Get the category of the given applet
*
* @param appletName the name of the applet
*/
static QString category(const QString &appletName);
/** /**
* Returns the icon related to this applet * Returns the icon related to this applet

View File

@ -509,6 +509,22 @@ QStringList PluginLoader::customAppletCategories() const
return AppletPrivate::s_customCategories.toList(); return AppletPrivate::s_customCategories.toList();
} }
QString PluginLoader::appletCategory(const QString& appletName)
{
if (appletName.isEmpty()) {
return QString();
}
const QString constraint = QString("[X-KDE-PluginInfo-Name] == '%1'").arg(appletName);
KService::List offers = KServiceTypeTrader::self()->query("Plasma/Applet", constraint);
if (offers.isEmpty()) {
return QString();
}
return offers.first()->property("X-KDE-PluginInfo-Category").toString();
}
KPluginInfo::List PluginLoader::listDataEngineInfo(const QString &parentApp) KPluginInfo::List PluginLoader::listDataEngineInfo(const QString &parentApp)
{ {

View File

@ -178,6 +178,13 @@ public:
*/ */
QStringList customAppletCategories() const; QStringList customAppletCategories() const;
/**
* Get the category of the given applet
*
* @param appletName the name of the applet
*/
QString appletCategory(const QString &appletName);
/** /**
* Returns a list of all known DataEngines. * Returns a list of all known DataEngines.
* *