From 9fe0a6d34fd158af66440e3899048e115a1ff027 Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Tue, 27 Apr 2010 20:26:21 +0000 Subject: [PATCH] avialableWidgets svn path=/trunk/KDE/kdebase/workspace/; revision=1119853 --- scriptengine.cpp | 15 +++++++++++++++ scriptengine.h | 1 + 2 files changed, 16 insertions(+) diff --git a/scriptengine.cpp b/scriptengine.cpp index 42bfbe3f7..6d33c67cb 100644 --- a/scriptengine.cpp +++ b/scriptengine.cpp @@ -189,6 +189,20 @@ QScriptValue ScriptEngine::panelById(QScriptContext *context, QScriptEngine *eng return engine->undefinedValue(); } +QScriptValue ScriptEngine::availableWidgets(QScriptContext *context, QScriptEngine *engine) +{ + Q_UNUSED(context) + + QStringList widgets; + KPluginInfo::List info = Plasma::Applet::listAppletInfo(); + + foreach (const KPluginInfo &info, info) { + widgets.append(info.pluginName()); + } + + return qScriptValueFromValue(engine, widgets); +} + QScriptValue ScriptEngine::activities(QScriptContext *context, QScriptEngine *engine) { Q_UNUSED(context) @@ -314,6 +328,7 @@ void ScriptEngine::setupEngine() m_scriptSelf.setProperty("QRectF", constructQRectFClass(this)); m_scriptSelf.setProperty("Activity", newFunction(ScriptEngine::newActivity)); m_scriptSelf.setProperty("Panel", newFunction(ScriptEngine::newPanel)); + m_scriptSelf.setProperty("availableWidgets", newFunction(ScriptEngine::availableWidgets)); m_scriptSelf.setProperty("activities", newFunction(ScriptEngine::activities)); m_scriptSelf.setProperty("activityById", newFunction(ScriptEngine::activityById)); m_scriptSelf.setProperty("activityForScreen", newFunction(ScriptEngine::activityForScreen)); diff --git a/scriptengine.h b/scriptengine.h index d32c53bc9..5c57e03da 100644 --- a/scriptengine.h +++ b/scriptengine.h @@ -62,6 +62,7 @@ private: void setupEngine(); // containment accessors + static QScriptValue availableWidgets(QScriptContext *context, QScriptEngine *engine); static QScriptValue newActivity(QScriptContext *context, QScriptEngine *engine); static QScriptValue newPanel(QScriptContext *context, QScriptEngine *engine); static QScriptValue activities(QScriptContext *context, QScriptEngine *engine);