From 590cb7baa7bd65e7c2e8745d9b52b8b0d443283f Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Tue, 20 Aug 2013 18:17:20 +0200 Subject: [PATCH] a property in Applet to tell if the user is configuring pure model, doesn't actually carry the config dialog, but serves as bookkeeping --- src/plasma/applet.cpp | 19 +++++++++++++++---- src/plasma/applet.h | 19 ++++++++++++++++++- src/plasma/private/applet_p.cpp | 3 ++- src/plasma/private/applet_p.h | 1 + 4 files changed, 36 insertions(+), 6 deletions(-) diff --git a/src/plasma/applet.cpp b/src/plasma/applet.cpp index 7b201504f..f1ae819e6 100644 --- a/src/plasma/applet.cpp +++ b/src/plasma/applet.cpp @@ -409,6 +409,21 @@ void Applet::setConfigurationRequired(bool needsConfig, const QString &reason) d->showConfigurationRequiredMessage(needsConfig, reason); } +bool Applet::isUserConfiguring() const +{ + return d->userConfiguring; +} + +void Applet::setUserConfiguring(bool configuring) +{ + if (configuring == d->userConfiguring) { + return; + } + + d->userConfiguring = configuring; + emit userConfiguringChanged(configuring); +} + Types::ItemStatus Applet::status() const { return d->itemStatus; @@ -465,10 +480,6 @@ void Applet::flushPendingConstraintsEvents() d->updateShortcuts(); Containment *cont = containment(); - Corona *corona = 0; - if (cont) { - corona = cont->corona(); - } } if (c & Plasma::Types::ImmutableConstraint) { diff --git a/src/plasma/applet.h b/src/plasma/applet.h index 7282274c2..8cdf99a6f 100644 --- a/src/plasma/applet.h +++ b/src/plasma/applet.h @@ -209,6 +209,18 @@ class PLASMA_EXPORT Applet : public QObject */ bool configurationRequired() const; + /** + * @return true when the configuration interface is being shown + * @since 4.5 + */ + bool isUserConfiguring() const; + + /** + * Tells the applet the user is configuring + * @param configuring true if the configuration ui is showing + */ + void setUserConfiguring(bool configuring); + //UTILS /** * Accessor for the associated Package object if any. @@ -376,6 +388,11 @@ class PLASMA_EXPORT Applet : public QObject */ void configNeedsSaving(); + /** + * emitted when the config ui appears or disappears + */ + void userConfiguringChanged(bool configuring); + //ACTIONS /** * Emitted when activation is requested due to, for example, a global @@ -389,7 +406,7 @@ class PLASMA_EXPORT Applet : public QObject * Emitted when the applet is deleted */ void appletDeleted(Plasma::Applet *applet); - + public Q_SLOTS: //BOOKKEEPING /** diff --git a/src/plasma/private/applet_p.cpp b/src/plasma/private/applet_p.cpp index 460a96ec4..b31acf0f2 100644 --- a/src/plasma/private/applet_p.cpp +++ b/src/plasma/private/applet_p.cpp @@ -68,7 +68,8 @@ AppletPrivate::AppletPrivate(KService::Ptr service, const KPluginInfo *info, int needsConfig(false), started(false), globalShortcutEnabled(false), - uiReady(false) + uiReady(false), + userConfiguring(false) { if (appletId == 0) { appletId = ++s_maxAppletId; diff --git a/src/plasma/private/applet_p.h b/src/plasma/private/applet_p.h index 4c27f1bae..859acc8cd 100644 --- a/src/plasma/private/applet_p.h +++ b/src/plasma/private/applet_p.h @@ -116,6 +116,7 @@ public: bool started : 1; bool globalShortcutEnabled : 1; bool uiReady : 1; + bool userConfiguring : 1; }; } // Plasma namespace