diff --git a/src/scriptengines/qml/plasmoid/containmentinterface.cpp b/src/scriptengines/qml/plasmoid/containmentinterface.cpp index adb16b482..8d930328d 100644 --- a/src/scriptengines/qml/plasmoid/containmentinterface.cpp +++ b/src/scriptengines/qml/plasmoid/containmentinterface.cpp @@ -55,15 +55,9 @@ ContainmentInterface::ContainmentInterface(DeclarativeAppletScript *parent) loadWallpaper(); } -QVariantList ContainmentInterface::applets() +QList ContainmentInterface::applets() { - QVariantList list; - int i = 0; - foreach (Plasma::Applet *applet, containment()->applets()) { - list << QVariant::fromValue(applet); - ++i; - } - return list; + return m_appletInterfaces; } void ContainmentInterface::setDrawWallpaper(bool drawWallpaper) @@ -146,13 +140,17 @@ void ContainmentInterface::appletAddedForward(Plasma::Applet *applet, const QPoi } } + m_appletInterfaces << appletGraphicObject; emit appletAdded(appletGraphicObject, pos); + emit appletsChanged(); } void ContainmentInterface::appletRemovedForward(Plasma::Applet *applet) { QObject *appletGraphicObject = applet->property("graphicObject").value(); + m_appletInterfaces.removeAll(appletGraphicObject); emit appletRemoved(appletGraphicObject); + emit appletsChanged(); } void ContainmentInterface::loadWallpaper() diff --git a/src/scriptengines/qml/plasmoid/containmentinterface.h b/src/scriptengines/qml/plasmoid/containmentinterface.h index 5fb30e74e..413aca75e 100644 --- a/src/scriptengines/qml/plasmoid/containmentinterface.h +++ b/src/scriptengines/qml/plasmoid/containmentinterface.h @@ -30,7 +30,7 @@ class QmlObject; class ContainmentInterface : public AppletInterface { Q_OBJECT - Q_PROPERTY(QVariantList applets READ applets) + Q_PROPERTY(QList applets READ applets NOTIFY appletsChanged) Q_PROPERTY(bool drawWallpaper READ drawWallpaper WRITE setDrawWallpaper) Q_PROPERTY(Type containmentType READ containmentType WRITE setContainmentType) Q_PROPERTY(int screen READ screen NOTIFY screenChanged) @@ -50,7 +50,7 @@ public: inline Plasma::Containment *containment() const { return static_cast(m_appletScriptEngine->applet()); } - QVariantList applets(); + QList applets(); void setDrawWallpaper(bool drawWallpaper); bool drawWallpaper(); @@ -73,6 +73,7 @@ Q_SIGNALS: void screenChanged(); void activityIdChanged(); void availableScreenRegionChanged(); + void appletsChanged(); protected Q_SLOTS: void appletAddedForward(Plasma::Applet *applet, const QPointF &pos); @@ -81,6 +82,7 @@ protected Q_SLOTS: private: QmlObject *m_wallpaperQmlObject; + QList m_appletInterfaces; }; #endif