consider the case of one engine per applet

rest of fallback mechanism still to be implemented

Change-Id: I2889075d72c776fea4a7db7e9ea638697acd907f
This commit is contained in:
Marco Martin 2015-05-11 12:02:34 +02:00
parent ac2f76d9c8
commit 509c5da619

View File

@ -441,7 +441,7 @@ Plasma::Applet *AppletQuickItem::applet() const
void AppletQuickItem::init() void AppletQuickItem::init()
{ {
//FIXME: Plasmoid attached property should be fixed since can't be indexed by engine anymore //FIXME: Plasmoid attached property should be fixed since can't be indexed by engine anymore
if (0&&AppletQuickItemPrivate::s_rootObjects.contains(d->qmlObject->rootContext())) { if (AppletQuickItemPrivate::s_rootObjects.contains(d->qmlObject->rootContext())) {
return; return;
} }
@ -452,13 +452,14 @@ void AppletQuickItem::init()
//Initialize the main QML file //Initialize the main QML file
QQmlEngine *engine = d->qmlObject->engine(); QQmlEngine *engine = d->qmlObject->engine();
//TODO: fallback to one engine per applet //if the engine of the qmlObject is different from the static one, then we
/* //are using an old version of the api in which every applet had one engine
if (d->applet->package().isValid()) { //so initialize a private url interceptor
if (d->applet->package().isValid() && engine != AppletQuickItemPrivate::s_engine) {
PackageUrlInterceptor *interceptor = new PackageUrlInterceptor(engine, d->applet->package()); PackageUrlInterceptor *interceptor = new PackageUrlInterceptor(engine, d->applet->package());
interceptor->addAllowedPath(d->coronaPackage.path()); interceptor->addAllowedPath(d->coronaPackage.path());
engine->setUrlInterceptor(interceptor); engine->setUrlInterceptor(interceptor);
}*/ }
//Force QtQuickControls to use the "Plasma" style for this engine. //Force QtQuickControls to use the "Plasma" style for this engine.
//this way is possible to mix QtQuickControls and plasma components in applets //this way is possible to mix QtQuickControls and plasma components in applets