From 34a21dc5ef7963de2b99fd3c56b9ffa686e1ee20 Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Fri, 13 Nov 2009 22:04:16 +0000 Subject: [PATCH] add layout property svn path=/trunk/KDE/kdebase/runtime/; revision=1048748 --- scriptengines/javascript/appletinterface.cpp | 11 ++++++---- scriptengines/javascript/appletinterface.h | 21 ++++++++++++++------ 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/scriptengines/javascript/appletinterface.cpp b/scriptengines/javascript/appletinterface.cpp index a9d293ce9..1ca9ce41e 100644 --- a/scriptengines/javascript/appletinterface.cpp +++ b/scriptengines/javascript/appletinterface.cpp @@ -31,8 +31,6 @@ #include #include -#include "simplejavascriptapplet.h" - AppletInterface::AppletInterface(SimpleJavaScriptApplet *parent) : QObject(parent), m_appletScriptEngine(parent), @@ -290,9 +288,14 @@ void AppletInterface::dataUpdated(QString source, Plasma::DataEngine::Data data) m_appletScriptEngine->dataUpdated(source, data); } -Plasma::Applet *AppletInterface::applet() const +QGraphicsLayout *AppletInterface::layout() const { - return m_appletScriptEngine->applet(); + return applet()->layout(); +} + +void AppletInterface::setLayout(QGraphicsLayout *layout) +{ + applet()->setLayout(layout); } #include "appletinterface.moc" diff --git a/scriptengines/javascript/appletinterface.h b/scriptengines/javascript/appletinterface.h index 1f7e49dbb..3fe47f287 100644 --- a/scriptengines/javascript/appletinterface.h +++ b/scriptengines/javascript/appletinterface.h @@ -28,6 +28,8 @@ #include #include +#include "simplejavascriptapplet.h" + class QAction; class SimpleJavaScriptApplet; class QSignalMapper; @@ -51,9 +53,15 @@ class AppletInterface : public QObject Q_ENUMS(QtCorner) Q_ENUMS(QtSizePolicy) Q_ENUMS(QtAlignment) + Q_PROPERTY(AspectRatioMode aspectRatioMode READ aspectRatioMode WRITE setAspectRatioMode) + Q_PROPERTY(FormFactor formFactor READ formFactor) + Q_PROPERTY(Location location READ location) + Q_PROPERTY(QString currentActivity READ currentActivity) + Q_PROPERTY(bool shouldConserveResources READ shouldConserveResources) Q_PROPERTY(QString activeConfig WRITE setActiveConfig READ activeConfig) Q_PROPERTY(bool busy WRITE setBusy READ isBusy) Q_PROPERTY(BackgroundHints backgroundHints WRITE setBackgroundHints READ backgroundHints) + Q_PROPERTY(QGraphicsLayout *layout WRITE setLayout READ layout) public: AppletInterface(SimpleJavaScriptApplet *parent); @@ -157,15 +165,13 @@ enum QtAlignment { Q_INVOKABLE FormFactor formFactor() const; - Q_INVOKABLE Location location() const; - - Q_INVOKABLE QString currentActivity() const; + Location location() const; + QString currentActivity() const; + bool shouldConserveResources() const; Q_INVOKABLE AspectRatioMode aspectRatioMode() const; - Q_INVOKABLE void setAspectRatioMode(AspectRatioMode mode); - Q_INVOKABLE bool shouldConserveResources() const; Q_INVOKABLE void setFailedToLaunch(bool failed, const QString &reason = QString()); @@ -209,7 +215,10 @@ enum QtAlignment { const Plasma::Package *package() const; QList contextualActions() const; - Plasma::Applet *applet() const; + QGraphicsLayout *layout() const; + void setLayout(QGraphicsLayout *); + + inline Plasma::Applet *applet() const { return m_appletScriptEngine->applet(); } Q_SIGNALS: void releaseVisualFocus();