File fix-changing-icon-theme.patch of Package kiconthemes.6354

From 39e3815c6fc03fc0792e6a3c61245b09a75dfebc Mon Sep 17 00:00:00 2001
From: Michael Pyne <mpyne@kde.org>
Date: Tue, 20 Dec 2016 19:57:18 -0500
Subject: Inform QIconLoader also when the desktop icon theme is changed.

This change is needed because KIconTheme will defer to QIconLoader's
concept of the current icon theme in preference to our own global
config, if that current icon theme is set.

Qt normally leaves it unset but once it starts loading icons through our
platform plugin, it will remember which theme was in use.

This means when we change the configured icon theme, that we would
sometimes accidentally continue to load icons from the old icon theme
(the one remembered by Qt).

Thanks to Wolfgang Bauer for debugging the issue, narrowing the
potential causes of the bug was instrumental in fixing it!

BUG:365363
FIXED-IN:5.30
---
 src/kiconloader.cpp | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/kiconloader.cpp b/src/kiconloader.cpp
index 5315ea4..726b43f 100644
--- a/src/kiconloader.cpp
+++ b/src/kiconloader.cpp
@@ -541,7 +541,18 @@ void KIconLoaderPrivate::drawOverlays(const KIconLoader *iconLoader, KIconLoader
 
 void KIconLoaderPrivate::_k_refreshIcons(int group)
 {
-    KSharedConfig::openConfig()->reparseConfiguration();
+    KSharedConfig::Ptr sharedConfig = KSharedConfig::openConfig();
+    sharedConfig->reparseConfiguration();
+
+    const QString newThemeName = sharedConfig->group("Icons")
+                                               .readEntry("Theme", QString());
+    if (!newThemeName.isEmpty()) {
+        // If we're refreshing icons the Qt platform plugin has probably
+        // already cached the old theme, which will accidentally filter back
+        // into KIconTheme unless we reset it
+        QIcon::setThemeName(newThemeName);
+    }
+
     q->newIconLoader();
     mIconAvailability.clear();
     emit q->iconChanged(group);
-- 
cgit v0.11.2

openSUSE Build Service is sponsored by