activities()

svn path=/trunk/KDE/kdebase/workspace/; revision=1119754
This commit is contained in:
Aaron J. Seigo 2010-04-27 19:52:56 +00:00 committed by Marco Martin
parent 62af47f1de
commit 7d27adbe34
2 changed files with 21 additions and 0 deletions

View File

@ -188,6 +188,25 @@ QScriptValue ScriptEngine::panelById(QScriptContext *context, QScriptEngine *eng
return engine->undefinedValue();
}
QScriptValue ScriptEngine::activities(QScriptContext *context, QScriptEngine *engine)
{
Q_UNUSED(context)
QScriptValue panels = engine->newArray();
ScriptEngine *env = envFor(engine);
int count = 0;
foreach (Plasma::Containment *c, env->m_corona->containments()) {
if (!isPanel(c)) {
panels.setProperty(count, env->wrap(c));
++count;
}
}
panels.setProperty("length", count);
return panels;
}
QScriptValue ScriptEngine::panels(QScriptContext *context, QScriptEngine *engine)
{
Q_UNUSED(context)
@ -294,6 +313,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("activities", newFunction(ScriptEngine::activities));
m_scriptSelf.setProperty("activityById", newFunction(ScriptEngine::activityById));
m_scriptSelf.setProperty("activityForScreen", newFunction(ScriptEngine::activityForScreen));
m_scriptSelf.setProperty("panelById", newFunction(ScriptEngine::panelById));

View File

@ -64,6 +64,7 @@ private:
// containment accessors
static QScriptValue newActivity(QScriptContext *context, QScriptEngine *engine);
static QScriptValue newPanel(QScriptContext *context, QScriptEngine *engine);
static QScriptValue activities(QScriptContext *context, QScriptEngine *engine);
static QScriptValue activityById(QScriptContext *context, QScriptEngine *engine);
static QScriptValue activityForScreen(QScriptContext *context, QScriptEngine *engine);
static QScriptValue panelById(QScriptContext *context, QScriptEngine *engine);