a property in Applet to tell if the user is configuring

pure model, doesn't actually carry the config dialog, but serves as bookkeeping
This commit is contained in:
Marco Martin 2013-08-20 18:17:20 +02:00
parent 98612b983d
commit 590cb7baa7
4 changed files with 36 additions and 6 deletions

View File

@ -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) {

View File

@ -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
/**

View File

@ -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;

View File

@ -116,6 +116,7 @@ public:
bool started : 1;
bool globalShortcutEnabled : 1;
bool uiReady : 1;
bool userConfiguring : 1;
};
} // Plasma namespace