now in javascript you can access the applet arguments with
startupArguments svn path=/trunk/KDE/kdebase/workspace/plasma/scriptengines/javascript/; revision=923312
This commit is contained in:
parent
ee8f42c665
commit
1f34041d86
@ -176,7 +176,7 @@ KSharedPtr<UiLoader> SimpleJavaScriptApplet::s_widgetLoader;
|
||||
SimpleJavaScriptApplet::SimpleJavaScriptApplet(QObject *parent, const QVariantList &args)
|
||||
: Plasma::AppletScript(parent)
|
||||
{
|
||||
//kDebug() << "Script applet launched, args" << args;
|
||||
// kDebug() << "Script applet launched, args" << applet()->startupArguments();
|
||||
|
||||
m_engine = new QScriptEngine(this);
|
||||
importExtensions();
|
||||
@ -382,6 +382,14 @@ void SimpleJavaScriptApplet::setupObjects()
|
||||
m_self.setScope(global);
|
||||
global.setProperty("plasmoid", m_self);
|
||||
|
||||
QScriptValue args = m_engine->newArray();
|
||||
int i = 0;
|
||||
foreach (QVariant arg, applet()->startupArguments()) {
|
||||
args.setProperty(i, variant2ScriptValue(m_engine, arg));
|
||||
++i;
|
||||
}
|
||||
global.setProperty("startupArguments", args);
|
||||
|
||||
//manually create enum values. ugh
|
||||
QMetaObject meta = AppletInterface::staticMetaObject;
|
||||
for (int i=0; i < meta.enumeratorCount(); ++i) {
|
||||
|
Loading…
Reference in New Issue
Block a user