diff --git a/src/scriptengines/qml/plasmoid/appletloader.cpp b/src/scriptengines/qml/plasmoid/appletloader.cpp index e1dc2c73c..7bd378337 100644 --- a/src/scriptengines/qml/plasmoid/appletloader.cpp +++ b/src/scriptengines/qml/plasmoid/appletloader.cpp @@ -164,6 +164,26 @@ void AppletLoader::init() } +Plasma::Package AppletLoader::appletPackage() const +{ + return m_appletPackage; +} + +void AppletLoader::setAppletPackage(const Plasma::Package &package) +{ + m_appletPackage = package; +} + +Plasma::Package AppletLoader::coronaPackage() const +{ + return m_coronaPackage; +} + +void AppletLoader::setCoronaPackage(const Plasma::Package &package) +{ + m_coronaPackage = package; +} + int AppletLoader::switchWidth() const { return m_switchWidth; diff --git a/src/scriptengines/qml/plasmoid/appletloader.h b/src/scriptengines/qml/plasmoid/appletloader.h index 38e6f1c3f..211c18fe8 100644 --- a/src/scriptengines/qml/plasmoid/appletloader.h +++ b/src/scriptengines/qml/plasmoid/appletloader.h @@ -39,6 +39,7 @@ namespace KDeclarative { } + class AppletLoader : public QQuickItem { Q_OBJECT @@ -71,8 +72,23 @@ public: AppletLoader(Plasma::Applet *applet, QQuickItem *parent = 0); ~AppletLoader(); +////API NOT SUPPOSED TO BE USED BY QML Plasma::Applet *applet() const; + //Make the constructor lighter and delay the actual instantiation of the qml in the applet + virtual void init(); + + Plasma::Package appletPackage() const; + void setAppletPackage(const Plasma::Package &package); + + Plasma::Package coronaPackage() const; + void setCoronaPackage(const Plasma::Package &package); + + QObject *compactRepresentationItem(); + QObject *fullRepresentationItem(); + QObject *compactRepresentationExpanderItem(); + +////PROPERTY ACCESSORS int switchWidth() const; void setSwitchWidth(int width); @@ -93,13 +109,10 @@ public: QQmlComponent *compactRepresentationExpander(); void setCompactRepresentationExpander(QQmlComponent *component); - QObject *compactRepresentationItem(); - QObject *fullRepresentationItem(); - QObject *compactRepresentationExpanderItem(); - - //Reimplemented - virtual void init(); + bool isExpanded() const; + void setExpanded(bool expanded); +////NEEDED BY QML TO CREATE ATTACHED PROPERTIES static AppletLoader *qmlAttachedProperties(QObject *object) { //at the moment of the attached object creation, the root item is the only one that hasn't a parent @@ -111,13 +124,13 @@ public: } } - bool isExpanded() const; - void setExpanded(bool expanded); Q_SIGNALS: void switchWidthChanged(int width); void switchHeightChanged(int height); + void expandedChanged(bool expanded); + void compactRepresentationChanged(QQmlComponent *compactRepresentation); void fullRepresentationChanged(QQmlComponent *fullRepresentation); void preferredRepresentationChanged(QQmlComponent *preferredRepresentation); @@ -128,8 +141,6 @@ Q_SIGNALS: void fullRepresentationItemChanged(QObject *fullRepresentationItem); void compactRepresentationExpanderItemChanged(QObject *compactRepresentationExpanderItem); - void expandedChanged(bool expanded); - protected: KDeclarative::QmlObject *qmlObject(); void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);