if no parent is given, make the applet the parent of the svgs
svn path=/trunk/KDE/kdebase/workspace/plasma/scriptengines/javascript/; revision=906379
This commit is contained in:
parent
3394124002
commit
f50517cb87
@ -575,8 +575,23 @@ QScriptValue SimpleJavaScriptApplet::newPlasmaSvg(QScriptContext *context, QScri
|
|||||||
parent = qscriptvalue_cast<QObject *>(context->argument(1));
|
parent = qscriptvalue_cast<QObject *>(context->argument(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool parentedToApplet = false;
|
||||||
|
if (!parent) {
|
||||||
|
QScriptValue appletValue = engine->globalObject().property("plasmoid");
|
||||||
|
//kDebug() << "appletValue is " << appletValue.toString();
|
||||||
|
|
||||||
|
QObject *appletObject = appletValue.toQObject();
|
||||||
|
if (appletObject) {
|
||||||
|
AppletInterface *interface = qobject_cast<AppletInterface*>(appletObject);
|
||||||
|
if (interface) {
|
||||||
|
parentedToApplet = true;
|
||||||
|
parent = interface->applet();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Svg *svg = new Svg(parent);
|
Svg *svg = new Svg(parent);
|
||||||
svg->setImagePath(findSvg(engine, filename));
|
svg->setImagePath(parentedToApplet ? filename : findSvg(engine, filename));
|
||||||
return engine->newQObject(svg);
|
return engine->newQObject(svg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -593,8 +608,23 @@ QScriptValue SimpleJavaScriptApplet::newPlasmaFrameSvg(QScriptContext *context,
|
|||||||
parent = qscriptvalue_cast<QObject *>(context->argument(1));
|
parent = qscriptvalue_cast<QObject *>(context->argument(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool parentedToApplet = false;
|
||||||
|
if (!parent) {
|
||||||
|
QScriptValue appletValue = engine->globalObject().property("plasmoid");
|
||||||
|
//kDebug() << "appletValue is " << appletValue.toString();
|
||||||
|
|
||||||
|
QObject *appletObject = appletValue.toQObject();
|
||||||
|
if (appletObject) {
|
||||||
|
AppletInterface *interface = qobject_cast<AppletInterface*>(appletObject);
|
||||||
|
if (interface) {
|
||||||
|
parentedToApplet = true;
|
||||||
|
parent = interface->applet();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
FrameSvg *frameSvg = new FrameSvg(parent);
|
FrameSvg *frameSvg = new FrameSvg(parent);
|
||||||
frameSvg->setImagePath(findSvg(engine, filename));
|
frameSvg->setImagePath(parentedToApplet ? filename : findSvg(engine, filename));
|
||||||
return engine->newQObject(frameSvg);
|
return engine->newQObject(frameSvg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user