From a81c44d37627aa1c9fec61da17ace46d21ef108d Mon Sep 17 00:00:00 2001 From: Aaron Seigo Date: Fri, 9 Nov 2012 17:33:35 +0100 Subject: [PATCH] properties++ --- containmentactions.cpp | 7 ++++--- containmentactions.h | 15 +++++++++++---- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/containmentactions.cpp b/containmentactions.cpp index 08381fdf2..632fe8b55 100644 --- a/containmentactions.cpp +++ b/containmentactions.cpp @@ -141,7 +141,6 @@ void ContainmentActions::contextEvent(QEvent *event) QList ContainmentActions::contextualActions() { - //empty list return QList(); } @@ -157,8 +156,10 @@ bool ContainmentActions::configurationRequired() const void ContainmentActions::setConfigurationRequired(bool needsConfig) { - //TODO: reason? - d->needsConfig = needsConfig; + if (d->needsConfig != needsConfig) { + d->needsConfig = needsConfig; + emit configurationRequiredChanged(); + } } QString ContainmentActions::eventToString(QEvent *event) diff --git a/containmentactions.h b/containmentactions.h index 798617d9d..24eb7ca20 100644 --- a/containmentactions.h +++ b/containmentactions.h @@ -54,9 +54,10 @@ class ContainmentActionsPrivate; class PLASMA_EXPORT ContainmentActions : public QObject { Q_OBJECT - Q_PROPERTY(QString name READ name) - Q_PROPERTY(QString pluginName READ pluginName) - Q_PROPERTY(QString icon READ icon) + Q_PROPERTY(QString name READ name CONSTANT) + Q_PROPERTY(QString pluginName READ pluginName CONSTANT) + Q_PROPERTY(QString icon READ icon CONSTANT) + Q_PROPERTY(bool configurationRequired READ configurationRequired NOTIFY configurationRequiredChanged) public: /** @@ -126,7 +127,7 @@ class PLASMA_EXPORT ContainmentActions : public QObject * for example, when right-clicking an applet, the "Activity Options" submenu is populated * with this. */ - virtual QList contextualActions(); + Q_INVOKABLE virtual QList contextualActions(); /** * Loads the given DataEngine @@ -166,6 +167,12 @@ class PLASMA_EXPORT ContainmentActions : public QObject */ void setContainment(Containment *newContainment); + Q_SIGNALS: + /** + * Emitted when @see configurationRequired() changes + */ + void configurationRequiredChanged(); + protected: /** * This constructor is to be used with the plugin loading systems