svn path=/trunk/KDE/kdebase/workspace/; revision=1119751
This commit is contained in:
Aaron J. Seigo 2010-04-27 19:44:53 +00:00 committed by Marco Martin
parent 2fb92df68c
commit 62af47f1de
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::panels(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::fileExists(QScriptContext *context, QScriptEngine *engine)
{
Q_UNUSED(engine)
@ -278,6 +297,7 @@ void ScriptEngine::setupEngine()
m_scriptSelf.setProperty("activityById", newFunction(ScriptEngine::activityById));
m_scriptSelf.setProperty("activityForScreen", newFunction(ScriptEngine::activityForScreen));
m_scriptSelf.setProperty("panelById", newFunction(ScriptEngine::panelById));
m_scriptSelf.setProperty("panels", newFunction(ScriptEngine::panels));
m_scriptSelf.setProperty("fileExists", newFunction(ScriptEngine::fileExists));
m_scriptSelf.setProperty("loadTemplate", newFunction(ScriptEngine::loadTemplate));
m_scriptSelf.setProperty("applicationVersion", KGlobal::mainComponent().aboutData()->version(), QScriptValue::ReadOnly | QScriptValue::Undeletable);

View File

@ -67,6 +67,7 @@ private:
static QScriptValue activityById(QScriptContext *context, QScriptEngine *engine);
static QScriptValue activityForScreen(QScriptContext *context, QScriptEngine *engine);
static QScriptValue panelById(QScriptContext *context, QScriptEngine *engine);
static QScriptValue panels(QScriptContext *context, QScriptEngine *engine);
static QScriptValue fileExists(QScriptContext *context, QScriptEngine *engine);
static QScriptValue loadTemplate(QScriptContext *context, QScriptEngine *engine);