getters and setters for packages

This commit is contained in:
Marco Martin 2014-02-05 13:51:41 +01:00
parent 74515ee2f5
commit 4a5c20f954
2 changed files with 41 additions and 10 deletions

View File

@ -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;

View File

@ -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);