aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJanne Heikkilä <janne.heikkila@symbio.com>2010-07-26 10:54:33 +0300
committerTomas Junnonen <tomas.junnonen@nokia.com>2010-07-26 14:00:15 +0300
commit84a20cfc9f55d4ea1b3af512033a70b2e4368612 (patch)
treec5a5fff0fd85e41d155ad668b54f8ba5bedd4fee
parent6848bbf5fed0ba4a947989bc27d6039d1d51dad0 (diff)
Fixes: NB#181556 - The spinner in theme applet does not disappear when the theme change finished
RevBy: Tomas Junnonen Details: Destroy pixmap resources and send ThemeChangeFinishedPacket also when the theme change timeout is encountered or when a blocking application is disconnected.
-rw-r--r--mthemedaemon/mthemedaemonserver.cpp62
-rw-r--r--mthemedaemon/mthemedaemonserver.h2
2 files changed, 35 insertions, 29 deletions
diff --git a/mthemedaemon/mthemedaemonserver.cpp b/mthemedaemon/mthemedaemonserver.cpp
index 7bd825d7..fa8c042a 100644
--- a/mthemedaemon/mthemedaemonserver.cpp
+++ b/mthemedaemon/mthemedaemonserver.cpp
@@ -145,11 +145,11 @@ void MThemeDaemonServer::clientDisconnected()
bool removed = clientsThatHaveNotYetAppliedThemeChange.removeOne(client);
delete client;
- // check if the delayed theme change has been request and whether we can complete it now
- if( removed && clientsThatHaveNotYetAppliedThemeChange.isEmpty() && delayedThemeChange ) {
- mWarning("MThemeDaemonServer") << "Start delayed theme change due to disconnection of last pending application.";
- delayedThemeChange = false;
- themeChanged();
+ // finalize the theme change now if the disconnected client was
+ //the last who had not replied to theme change request
+ if( removed && clientsThatHaveNotYetAppliedThemeChange.isEmpty() ) {
+ mWarning("MThemeDaemonServer") << "Finalize theme change due to disconnection of last pending application.";
+ finalizeThemeChange();
}
}
socket->deleteLater();
@@ -345,12 +345,8 @@ void MThemeDaemonServer::themeChangeTimeout()
clientsThatHaveNotYetAppliedThemeChange.clear();
}
- //if delayed theme change was requested, change it now
- if( delayedThemeChange ) {
- mWarning("MThemeDaemonServer") << "Start delayed theme change due to timeout.";
- delayedThemeChange = false;
- themeChanged();
- }
+ mWarning("MThemeDaemonServer") << "Finalize theme change due to timeout.";
+ finalizeThemeChange();
}
void MThemeDaemonServer::localeChanged()
@@ -493,24 +489,7 @@ void MThemeDaemonServer::themeChangeApplied(MThemeDaemonClient *client,
}
if(clientsThatHaveNotYetAppliedThemeChange.isEmpty()) {
- // all clients have applied the theme change, so we can now release the old pixmaps
- // and inform everyone that theme change has been completed
- qDeleteAll(pixmapsToDeleteWhenThemeChangeHasCompleted);
- pixmapsToDeleteWhenThemeChangeHasCompleted.clear();
-
- Packet themeChangeFinishedPacket(Packet::ThemeChangeCompletedPacket, 0);
-
- foreach(MThemeDaemonClient * c, registeredClients.values()) {
- client->themeChangeApplied();
- c->stream() << themeChangeFinishedPacket;
- }
-
- //if delayed theme change was requested, change it now
- if( delayedThemeChange ) {
- mWarning("MThemeDaemonServer") << "Start delayed theme change after receiving all the replies.";
- delayedThemeChange = false;
- themeChanged();
- }
+ finalizeThemeChange();
}
}
@@ -555,3 +534,28 @@ void MThemeDaemonServer::themeDaemonStatus(MThemeDaemonClient *client,
new ClientList(clientList));
}
+void MThemeDaemonServer::finalizeThemeChange()
+{
+ //make sure all the clients have applied to the theme change request
+ if( clientsThatHaveNotYetAppliedThemeChange.isEmpty() ) {
+
+ //release the old pixmaps
+ qDeleteAll(pixmapsToDeleteWhenThemeChangeHasCompleted);
+ pixmapsToDeleteWhenThemeChangeHasCompleted.clear();
+
+ //inform everyone that theme change has been completed
+ Packet themeChangeFinishedPacket(Packet::ThemeChangeCompletedPacket, 0);
+ foreach(MThemeDaemonClient * c, registeredClients.values()) {
+ c->themeChangeApplied();
+ c->stream() << themeChangeFinishedPacket;
+ }
+
+ //if another theme change was already requested, start the change now
+ if( delayedThemeChange ) {
+ mWarning("MThemeDaemonServer") << "Starting delayed theme change.";
+ delayedThemeChange = false;
+ themeChanged();
+ }
+ }
+}
+
diff --git a/mthemedaemon/mthemedaemonserver.h b/mthemedaemon/mthemedaemonserver.h
index 8114c1b8..aa24d900 100644
--- a/mthemedaemon/mthemedaemonserver.h
+++ b/mthemedaemon/mthemedaemonserver.h
@@ -71,6 +71,8 @@ private:
void themeDaemonStatus(MThemeDaemonClient *client, quint64 sequenceNumber) const;
+ void finalizeThemeChange();
+
private:
struct QueueItem
{