diff --git a/scriptengines/qml/plasmoid/appletinterface.cpp b/scriptengines/qml/plasmoid/appletinterface.cpp index b44b536bb..ccc5f6c41 100644 --- a/scriptengines/qml/plasmoid/appletinterface.cpp +++ b/scriptengines/qml/plasmoid/appletinterface.cpp @@ -24,6 +24,8 @@ #include #include #include +#include +#include #include #include #include @@ -46,6 +48,7 @@ AppletInterface::AppletInterface(AbstractJsAppletScript *parent) m_appletScriptEngine(parent), m_actionSignals(0) { + qmlRegisterType(); connect(this, SIGNAL(releaseVisualFocus()), applet(), SIGNAL(releaseVisualFocus())); connect(this, SIGNAL(configNeedsSaving()), applet(), SIGNAL(configNeedsSaving())); connect(applet(), SIGNAL(immutabilityChanged(Plasma::ImmutabilityType)), this, SIGNAL(immutableChanged())); @@ -388,6 +391,7 @@ ContainmentInterface::ContainmentInterface(AbstractJsAppletScript *parent) : APPLETSUPERCLASS(parent), m_movableApplets(true) { + qmlRegisterType(); connect(containment(), SIGNAL(appletRemoved(Plasma::Applet *)), this, SLOT(appletRemovedForward(Plasma::Applet *))); connect(containment(), SIGNAL(appletAdded(Plasma::Applet *, const QPointF &)), this, SLOT(appletAddedForward(Plasma::Applet *, const QPointF &))); diff --git a/scriptengines/qml/plasmoid/declarativeappletscript.cpp b/scriptengines/qml/plasmoid/declarativeappletscript.cpp index 3e4dd079f..bbffb78ea 100644 --- a/scriptengines/qml/plasmoid/declarativeappletscript.cpp +++ b/scriptengines/qml/plasmoid/declarativeappletscript.cpp @@ -278,6 +278,8 @@ ScriptEnv *DeclarativeAppletScript::scriptEnv() void DeclarativeAppletScript::setupObjects() { + m_qmlObject->engine()->rootContext()->setContextProperty("plasmoid", m_interface); + #if 0 TODO: make this work with QQmlEngine m_engine = m_qmlObject->scriptEngine(); diff --git a/shell/desktopcorona.cpp b/shell/desktopcorona.cpp index dd65873a2..46044a1a0 100644 --- a/shell/desktopcorona.cpp +++ b/shell/desktopcorona.cpp @@ -53,9 +53,9 @@ void DesktopCorona::loadDefaultLayout() Plasma::Containment *cont = addContainment("org.kde.testcontainment"); cont->setScreen(0); qDebug() << containmentForScreen(0); - //Plasma::Applet *appl = cont->addApplet("foo"); + Plasma::Applet *appl = cont->addApplet("foo"); qDebug() << "Containment:" << cont << cont->name(); - //qDebug() << "Applet:" << appl->name() << appl; + qDebug() << "Applet:" << appl->name() << appl; } void DesktopCorona::checkScreens(bool signalWhenExists) diff --git a/shell/qmlpackages/desktop/contents/ui/main.qml b/shell/qmlpackages/desktop/contents/ui/main.qml index e6c71b91b..72d65bdbb 100644 --- a/shell/qmlpackages/desktop/contents/ui/main.qml +++ b/shell/qmlpackages/desktop/contents/ui/main.qml @@ -36,5 +36,7 @@ Rectangle { containment.anchors.fill = root } - Component.onCompleted: print("View QML loaded") + Component.onCompleted: { + print("View QML loaded") + } } diff --git a/shell/testcontainment/contents/ui/main.qml b/shell/testcontainment/contents/ui/main.qml index f10c90d86..dfc432904 100644 --- a/shell/testcontainment/contents/ui/main.qml +++ b/shell/testcontainment/contents/ui/main.qml @@ -55,10 +55,15 @@ Rectangle { //Behavior on y { PropertyAnimation { easing.type: Easing.OutElastic; duration: 800 } } Behavior on height { PropertyAnimation { easing.type: Easing.InOutDouble; duration: 300 } } - Text { - id: txt - text: "Click or Drag"; + Column { anchors.centerIn: parent + Text { + id: txt + text: "Click or Drag"; + } + Text { + text: plasmoid + } } PlasmaCore.SvgItem { svg: actionssvg @@ -88,5 +93,11 @@ Rectangle { Rectangle { color: "white"; opacity: 0.2; anchors.fill: parent; } } - Component.onCompleted: print("Test Containment loaded") + Component.onCompleted: { + print("Test Containment loaded") + print(plasmoid) + for (var i in plasmoid) { + print(i+" "+plasmoid[i]) + } + } } \ No newline at end of file diff --git a/shell/view.cpp b/shell/view.cpp index e3f62183f..c83eb76db 100644 --- a/shell/view.cpp +++ b/shell/view.cpp @@ -20,6 +20,7 @@ #include #include +#include #include #include "plasma/pluginloader.h" @@ -35,7 +36,7 @@ View::View(QWindow *parent) setResizeMode(View::SizeRootObjectToView); setSource(QUrl::fromLocalFile(m_package.filePath("mainscript"))); - show(); + show();rootContext()->setContextProperty("plasmoid", this); } View::~View()