From 0dda9c72eec9cd310422581c7b55121e9eb0db97 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Wed, 2 Mar 2011 14:41:38 +0100 Subject: [PATCH] bind screen() and Corona::screenGeometry() --- .../javascript/plasmoid/appletinterface.cpp | 15 +++++++++++++++ .../javascript/plasmoid/appletinterface.h | 4 ++++ 2 files changed, 19 insertions(+) diff --git a/scriptengines/javascript/plasmoid/appletinterface.cpp b/scriptengines/javascript/plasmoid/appletinterface.cpp index 2564cb8b0..97f070c1e 100644 --- a/scriptengines/javascript/plasmoid/appletinterface.cpp +++ b/scriptengines/javascript/plasmoid/appletinterface.cpp @@ -34,6 +34,7 @@ #include #include +#include #include #include @@ -473,6 +474,20 @@ void ContainmentInterface::setContainmentType(ContainmentInterface::Type type) m_appletScriptEngine->setContainmentType((Plasma::Containment::Type)type); } +int ContainmentInterface::screen() const +{ + return screen(); +} + +QRect ContainmentInterface::screenGeometry(int id) const +{ + if (containment()->corona()) { + return containment()->corona()->screenGeometry(id); + } else { + return QRect(); + } +} + void ContainmentInterface::appletAddedForward(Plasma::Applet *applet, const QPointF &pos) { emit appletAdded(applet, pos); diff --git a/scriptengines/javascript/plasmoid/appletinterface.h b/scriptengines/javascript/plasmoid/appletinterface.h index 51caf424c..0391c75b3 100644 --- a/scriptengines/javascript/plasmoid/appletinterface.h +++ b/scriptengines/javascript/plasmoid/appletinterface.h @@ -361,6 +361,7 @@ class ContainmentInterface : public APPLETSUPERCLASS Q_PROPERTY(QScriptValue applets READ applets) Q_PROPERTY(bool drawWallpaper READ drawWallpaper WRITE setDrawWallpaper) Q_PROPERTY(Type containmentType READ containmentType WRITE setContainmentType) + Q_PROPERTY(int screen READ screen) Q_ENUMS(Type) public: @@ -382,6 +383,9 @@ public: bool drawWallpaper(); Type containmentType() const; void setContainmentType(Type type); + int screen() const; + + Q_INVOKABLE QRect screenGeometry(int id) const; Q_SIGNALS: void appletAdded(QGraphicsWidget *applet, const QPointF &pos);