* register the url class
* make sure all widgets always have a parent! svn path=/trunk/KDE/kdebase/workspace/plasma/scriptengines/javascript/; revision=960160
This commit is contained in:
parent
79317e3470
commit
f9657ce683
@ -55,6 +55,7 @@ Q_SCRIPT_DECLARE_QMETAOBJECT(AppletInterface, SimpleJavaScriptApplet*)
|
||||
QScriptValue constructPainterClass(QScriptEngine *engine);
|
||||
QScriptValue constructGraphicsItemClass(QScriptEngine *engine);
|
||||
QScriptValue constructLinearLayoutClass(QScriptEngine *engine);
|
||||
QScriptValue constructKUrlClass(QScriptEngine *engine);
|
||||
QScriptValue constructTimerClass(QScriptEngine *engine);
|
||||
QScriptValue constructFontClass(QScriptEngine *engine);
|
||||
QScriptValue constructQRectFClass(QScriptEngine *engine);
|
||||
@ -476,6 +477,7 @@ void SimpleJavaScriptApplet::setupObjects()
|
||||
global.setProperty("QSizeF", constructQSizeFClass(m_engine));
|
||||
global.setProperty("QPoint", constructQPointClass(m_engine));
|
||||
global.setProperty("LinearLayout", constructLinearLayoutClass(m_engine));
|
||||
global.setProperty("Url", constructKUrlClass(m_engine));
|
||||
|
||||
installWidgets(m_engine);
|
||||
}
|
||||
@ -704,6 +706,23 @@ QScriptValue SimpleJavaScriptApplet::createWidget(QScriptContext *context, QScri
|
||||
}
|
||||
}
|
||||
|
||||
if (!parent) {
|
||||
QScriptValue appletValue = engine->globalObject().property("plasmoid");
|
||||
//kDebug() << "appletValue is " << appletValue.toString();
|
||||
|
||||
QObject *appletObject = appletValue.toQObject();
|
||||
if (!appletObject) {
|
||||
return context->throwError(i18n("Could not extract the AppletObject"));
|
||||
}
|
||||
|
||||
AppletInterface *interface = qobject_cast<AppletInterface*>(appletObject);
|
||||
if (!interface) {
|
||||
return context->throwError(i18n("Could not extract the Applet"));
|
||||
}
|
||||
|
||||
parent = interface->applet();
|
||||
}
|
||||
|
||||
QString self = context->callee().property("functionName").toString();
|
||||
if (!s_widgetLoader) {
|
||||
s_widgetLoader = new UiLoader;
|
||||
|
Loading…
x
Reference in New Issue
Block a user