applets property as a list of plasmoid objects

This commit is contained in:
Marco Martin 2013-02-15 14:07:35 +01:00
parent 4049c092be
commit 065078b9c3
2 changed files with 10 additions and 10 deletions

View File

@ -55,15 +55,9 @@ ContainmentInterface::ContainmentInterface(DeclarativeAppletScript *parent)
loadWallpaper();
}
QVariantList ContainmentInterface::applets()
QList <QObject *> 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<QObject *>();
m_appletInterfaces.removeAll(appletGraphicObject);
emit appletRemoved(appletGraphicObject);
emit appletsChanged();
}
void ContainmentInterface::loadWallpaper()

View File

@ -30,7 +30,7 @@ class QmlObject;
class ContainmentInterface : public AppletInterface
{
Q_OBJECT
Q_PROPERTY(QVariantList applets READ applets)
Q_PROPERTY(QList <QObject *> 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<Plasma::Containment *>(m_appletScriptEngine->applet()); }
QVariantList applets();
QList<QObject *> 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<QObject *> m_appletInterfaces;
};
#endif