add activities() to the script engine
This commit is contained in:
parent
5cfa48062e
commit
144026951e
@ -181,6 +181,13 @@ QScriptValue ScriptEngine::setCurrentActivity(QScriptContext *context, QScriptEn
|
|||||||
return QScriptValue(task.result());
|
return QScriptValue(task.result());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QScriptValue ScriptEngine::activities(QScriptContext *context, QScriptEngine *engine)
|
||||||
|
{
|
||||||
|
KActivities::Consumer consumer;
|
||||||
|
|
||||||
|
return qScriptValueFromSequence(engine, consumer.activities());
|
||||||
|
}
|
||||||
|
|
||||||
QScriptValue ScriptEngine::newPanel(QScriptContext *context, QScriptEngine *engine)
|
QScriptValue ScriptEngine::newPanel(QScriptContext *context, QScriptEngine *engine)
|
||||||
{
|
{
|
||||||
return createContainment("Panel", "org.kde.panel", context, engine);
|
return createContainment("Panel", "org.kde.panel", context, engine);
|
||||||
@ -679,6 +686,7 @@ void ScriptEngine::setupEngine()
|
|||||||
m_scriptSelf.setProperty("QRectF", constructQRectFClass(this));
|
m_scriptSelf.setProperty("QRectF", constructQRectFClass(this));
|
||||||
m_scriptSelf.setProperty("createActivity", newFunction(ScriptEngine::createActivity));
|
m_scriptSelf.setProperty("createActivity", newFunction(ScriptEngine::createActivity));
|
||||||
m_scriptSelf.setProperty("setCurrentActivity", newFunction(ScriptEngine::setCurrentActivity));
|
m_scriptSelf.setProperty("setCurrentActivity", newFunction(ScriptEngine::setCurrentActivity));
|
||||||
|
m_scriptSelf.setProperty("activities", newFunction(ScriptEngine::activities));
|
||||||
m_scriptSelf.setProperty("Panel", newFunction(ScriptEngine::newPanel, newObject()));
|
m_scriptSelf.setProperty("Panel", newFunction(ScriptEngine::newPanel, newObject()));
|
||||||
m_scriptSelf.setProperty("desktopsForActivity", newFunction(ScriptEngine::desktopsForActivity));
|
m_scriptSelf.setProperty("desktopsForActivity", newFunction(ScriptEngine::desktopsForActivity));
|
||||||
m_scriptSelf.setProperty("desktops", newFunction(ScriptEngine::desktops));
|
m_scriptSelf.setProperty("desktops", newFunction(ScriptEngine::desktops));
|
||||||
|
@ -71,6 +71,7 @@ private:
|
|||||||
static QStringList availableContainments(const QString &type);
|
static QStringList availableContainments(const QString &type);
|
||||||
static QScriptValue createActivity(QScriptContext *context, QScriptEngine *engine);
|
static QScriptValue createActivity(QScriptContext *context, QScriptEngine *engine);
|
||||||
static QScriptValue setCurrentActivity(QScriptContext *context, QScriptEngine *engine);
|
static QScriptValue setCurrentActivity(QScriptContext *context, QScriptEngine *engine);
|
||||||
|
static QScriptValue activities(QScriptContext *context, QScriptEngine *engine);
|
||||||
static QScriptValue newPanel(QScriptContext *context, QScriptEngine *engine);
|
static QScriptValue newPanel(QScriptContext *context, QScriptEngine *engine);
|
||||||
static QScriptValue desktopsForActivity(QScriptContext *context, QScriptEngine *engine);
|
static QScriptValue desktopsForActivity(QScriptContext *context, QScriptEngine *engine);
|
||||||
static QScriptValue desktops(QScriptContext *context, QScriptEngine *engine);
|
static QScriptValue desktops(QScriptContext *context, QScriptEngine *engine);
|
||||||
|
Loading…
Reference in New Issue
Block a user