unbreak update() method
svn path=/trunk/KDE/kdebase/runtime/; revision=1217812
This commit is contained in:
parent
e22d1c5b2a
commit
906b55c050
@ -124,25 +124,21 @@ void AppletInterface::setConfigurationRequired(bool needsConfiguring, const QStr
|
|||||||
m_appletScriptEngine->setConfigurationRequired(needsConfiguring, reason);
|
m_appletScriptEngine->setConfigurationRequired(needsConfiguring, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_JS_SCRIPTENGINE
|
void JsAppletInterface::update(const QRectF &rect)
|
||||||
|
|
||||||
void AppletInterface::update(const QRectF &rect)
|
|
||||||
{
|
{
|
||||||
applet()->update(rect);
|
applet()->update(rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
QGraphicsLayout *AppletInterface::layout() const
|
QGraphicsLayout *JsAppletInterface::layout() const
|
||||||
{
|
{
|
||||||
return applet()->layout();
|
return applet()->layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppletInterface::setLayout(QGraphicsLayout *layout)
|
void JsAppletInterface::setLayout(QGraphicsLayout *layout)
|
||||||
{
|
{
|
||||||
applet()->setLayout(layout);
|
applet()->setLayout(layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QString AppletInterface::activeConfig() const
|
QString AppletInterface::activeConfig() const
|
||||||
{
|
{
|
||||||
return m_currentConfig.isEmpty() ? "main" : m_currentConfig;
|
return m_currentConfig.isEmpty() ? "main" : m_currentConfig;
|
||||||
@ -379,7 +375,7 @@ void AppletInterface::gc()
|
|||||||
|
|
||||||
|
|
||||||
PopupAppletInterface::PopupAppletInterface(AbstractJsAppletScript *parent)
|
PopupAppletInterface::PopupAppletInterface(AbstractJsAppletScript *parent)
|
||||||
: AppletInterface(parent)
|
: POPUPAPPLETSUPERCLASS(parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,10 +76,6 @@ class AppletInterface : public QObject
|
|||||||
Q_PROPERTY(int apiVersion READ apiVersion CONSTANT)
|
Q_PROPERTY(int apiVersion READ apiVersion CONSTANT)
|
||||||
Q_PROPERTY(QRectF rect READ rect)
|
Q_PROPERTY(QRectF rect READ rect)
|
||||||
Q_PROPERTY(QSizeF size READ size)
|
Q_PROPERTY(QSizeF size READ size)
|
||||||
#ifdef USE_JS_SCRIPTENGINE
|
|
||||||
Q_PROPERTY(QGraphicsLayout *layout WRITE setLayout READ layout)
|
|
||||||
Q_PROPERTY(QObject *sender READ sender)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AppletInterface(AbstractJsAppletScript *parent);
|
AppletInterface(AbstractJsAppletScript *parent);
|
||||||
@ -276,12 +272,6 @@ enum IntervalAlignment {
|
|||||||
|
|
||||||
Q_INVOKABLE Plasma::Extender *extender() const;
|
Q_INVOKABLE Plasma::Extender *extender() const;
|
||||||
|
|
||||||
#ifdef USE_JS_SCRIPTENGINE
|
|
||||||
Q_INVOKABLE void update(const QRectF &rect = QRectF());
|
|
||||||
QGraphicsLayout *layout() const;
|
|
||||||
void setLayout(QGraphicsLayout *);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Plasma::DataEngine *dataEngine(const QString &name);
|
Plasma::DataEngine *dataEngine(const QString &name);
|
||||||
|
|
||||||
QList<QAction*> contextualActions() const;
|
QList<QAction*> contextualActions() const;
|
||||||
@ -311,7 +301,29 @@ private:
|
|||||||
QMap<QString, Plasma::ConfigLoader*> m_configs;
|
QMap<QString, Plasma::ConfigLoader*> m_configs;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PopupAppletInterface : public AppletInterface
|
class JsAppletInterface : public AppletInterface
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_PROPERTY(QGraphicsLayout *layout WRITE setLayout READ layout)
|
||||||
|
Q_PROPERTY(QObject *sender READ sender)
|
||||||
|
|
||||||
|
public:
|
||||||
|
JsAppletInterface(AbstractJsAppletScript *parent)
|
||||||
|
: AppletInterface(parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_INVOKABLE void update(const QRectF &rect = QRectF());
|
||||||
|
QGraphicsLayout *layout() const;
|
||||||
|
void setLayout(QGraphicsLayout *);
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef USE_JS_SCRIPTENGINE
|
||||||
|
#define POPUPAPPLETSUPERCLASS JsAppletInterface
|
||||||
|
#else
|
||||||
|
#define POPUPAPPLETSUPERCLASS AppletInterface
|
||||||
|
#endif
|
||||||
|
class PopupAppletInterface : public POPUPAPPLETSUPERCLASS
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(QIcon popupIcon READ popupIcon WRITE setPopupIcon)
|
Q_PROPERTY(QIcon popupIcon READ popupIcon WRITE setPopupIcon)
|
||||||
|
@ -55,6 +55,8 @@
|
|||||||
#include <Plasma/Svg>
|
#include <Plasma/Svg>
|
||||||
#include <Plasma/VideoWidget>
|
#include <Plasma/VideoWidget>
|
||||||
|
|
||||||
|
#define USE_JS_SCRIPTENGINE
|
||||||
|
|
||||||
#include "appletauthorization.h"
|
#include "appletauthorization.h"
|
||||||
#include "appletinterface.h"
|
#include "appletinterface.h"
|
||||||
#include "scriptenv.h"
|
#include "scriptenv.h"
|
||||||
@ -511,8 +513,8 @@ void SimpleJavaScriptApplet::setupObjects()
|
|||||||
|
|
||||||
// Expose applet interface
|
// Expose applet interface
|
||||||
const bool isPopupApplet = qobject_cast<Plasma::PopupApplet *>(applet());
|
const bool isPopupApplet = qobject_cast<Plasma::PopupApplet *>(applet());
|
||||||
m_interface = isPopupApplet ? new PopupAppletInterface(this) : new AppletInterface(this);
|
m_interface = isPopupApplet ? new PopupAppletInterface(this) : new JsAppletInterface(this);
|
||||||
m_self = m_engine->newQObject(m_interface);
|
m_self = m_engine->newQObject(m_interface, QScriptEngine::QtOwnership, QScriptEngine::ExcludeDeleteLater);
|
||||||
m_env->addMainObjectProperties(m_self);
|
m_env->addMainObjectProperties(m_self);
|
||||||
m_self.setScope(global);
|
m_self.setScope(global);
|
||||||
global.setProperty("plasmoid", m_self);
|
global.setProperty("plasmoid", m_self);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user