make sure to not emit immutabilityChanged at startup

if the immutability doesn't actuall change at startup,
don't emit immutabilityChanged even tough each applet needs
one ImmutableConstraint at start to correctly initialize
stuff

Change-Id: Id1fd40ffd62c09a2b092d13d7fb4c556cfb34994
This commit is contained in:
Marco Martin 2015-03-17 19:13:28 +01:00
parent 117898f4ed
commit fac1100fff
3 changed files with 8 additions and 1 deletions

View File

@ -521,7 +521,12 @@ void Applet::flushPendingConstraintsEvents()
action->setEnabled(canConfig);
}
emit immutabilityChanged(immutability());
//an immutable constraint will alwasy happen at startup
//make sure don't emit a change signal for nothing
if (d->oldImmutability != immutability()) {
emit immutabilityChanged(immutability());
}
d->oldImmutability = immutability();
}
// now take care of constraints in special subclass: Contaiment

View File

@ -53,6 +53,7 @@ AppletPrivate::AppletPrivate(KService::Ptr service, const KPluginInfo *info, int
: appletId(uniqueID),
q(applet),
immutability(Types::Mutable),
oldImmutability(Types::Mutable),
appletDescription(info ? *info : KPluginInfo(service)),
icon(appletDescription.isValid() ? appletDescription.icon() : QString()),
mainConfig(0),

View File

@ -81,6 +81,7 @@ public:
// applet attributes
Types::ImmutabilityType immutability;
Types::ImmutabilityType oldImmutability;
QString launchErrorMessage;
// applet info we keep around in case its needed