rpms/kdelibs/F-9 kdelibs-4.0.5-iconload.patch, NONE, 1.1 kdelibs.spec, 1.323, 1.324

Than Ngo (than) fedora-extras-commits at redhat.com
Sun Jun 1 14:31:58 UTC 2008


Author: than

Update of /cvs/extras/rpms/kdelibs/F-9
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv844

Modified Files:
	kdelibs.spec 
Added Files:
	kdelibs-4.0.5-iconload.patch 
Log Message:
- backport patch from 4.1 branch to fix inherit issue in iconload, #448536


kdelibs-4.0.5-iconload.patch:

--- NEW FILE kdelibs-4.0.5-iconload.patch ---
diff -Nur kdelibs-4.0.5.orig/kdeui/icons/kiconloader.cpp kdelibs-4.0.5/kdeui/icons/kiconloader.cpp
--- kdelibs-4.0.5.orig/kdeui/icons/kiconloader.cpp	2008-05-01 12:16:34.000000000 +0200
+++ kdelibs-4.0.5/kdeui/icons/kiconloader.cpp	2008-06-01 16:26:38.000000000 +0200
@@ -168,14 +168,29 @@
     void addAppThemes(const QString& appname);
 
     /**
-     * Adds all themes that are part of this node and the themes
-     * below (the fallbacks of the theme) in the tree.
      * @internal
+     * Adds all themes that are part of this node and the themes
+     * below (the fallbacks of the theme) into the tree.
      */
     void addBaseThemes(KIconThemeNode *node, const QString &appname);
 
     /**
      * @internal
+     * Recursively adds all themes that are specified in the "Inherits"
+     * property of the given theme into the tree.
+     */
+    void addInheritedThemes(KIconThemeNode *node, const QString &appname);
+
+    /**
+     * @internal
+     * Creates a KIconThemeNode out of a theme name, and adds this theme
+     * as well as all its inherited themes into the tree. Themes that already
+     * exist in the tree will be ignored and not added twice.
+     */
+    void addThemeByName(const QString &themename, const QString &appname);
+
+    /**
+     * @internal
      * return the path for the unknown icon in that size
      */
     QString unknownIconPath( int size ) const;
@@ -434,8 +449,8 @@
         }
     }
     mpThemeRoot = new KIconThemeNode(def);
+    mThemesInTree.append(def->internalName());
     links.append(mpThemeRoot);
-    mThemesInTree += KIconTheme::current();
     addBaseThemes(mpThemeRoot, appname);
 
     // Insert application specific themes at the top.
@@ -503,44 +518,66 @@
 {
     initIconThemes();
 
-    if ( KIconTheme::current() != KIconTheme::defaultThemeName() )
-    {
-        KIconTheme *def = new KIconTheme(KIconTheme::current(), appname);
-        if (def->isValid())
-        {
-            KIconThemeNode* node = new KIconThemeNode(def);
-            links.append(node);
-            addBaseThemes(node, appname);
-        }
-        else
-            delete def;
+    KIconTheme *def = new KIconTheme(KIconTheme::current(), appname);
+    if (!def->isValid()) {
+        delete def;
+        def = new KIconTheme(KIconTheme::defaultThemeName(), appname);
     }
-
-    KIconTheme *def = new KIconTheme(KIconTheme::defaultThemeName(), appname);
     KIconThemeNode* node = new KIconThemeNode(def);
-    links.append(node);
+
+    if (!mThemesInTree.contains(node->theme->internalName())) {
+        mThemesInTree.append(node->theme->internalName());
+        links.append(node);
+    }
     addBaseThemes(node, appname);
 }
 
 void KIconLoaderPrivate::addBaseThemes(KIconThemeNode *node, const QString &appname)
 {
+    // Quote from the icon theme specification:
+    //   The lookup is done first in the current theme, and then recursively
+    //   in each of the current theme's parents, and finally in the
+    //   default theme called "hicolor" (implementations may add more
+    //   default themes before "hicolor", but "hicolor" must be last).
+    //
+    // So we first make sure that all inherited themes are added, then we
+    // add the KDE default theme as fallback for all icons that might not be
+    // present in an inherited theme, and hicolor goes last.
+
+    addInheritedThemes(node, appname);
+    addThemeByName(KIconTheme::defaultThemeName(), appname);
+    addThemeByName("hicolor", appname);
+}
+
+void KIconLoaderPrivate::addInheritedThemes(KIconThemeNode *node, const QString &appname)
+{
     QStringList lst = node->theme->inherits();
-    QStringList::ConstIterator it;
 
-    for (it=lst.begin(); it!=lst.end(); ++it)
-    {
-        if( mThemesInTree.contains(*it) && (*it) != "hicolor")
-            continue;
-        KIconTheme *theme = new KIconTheme(*it,appname);
-        if (!theme->isValid()) {
-            delete theme;
-            continue;
+    for (QStringList::ConstIterator it = lst.begin(); it != lst.end(); ++it) {
+        if ((*it) == "hicolor") {
+          // The icon theme spec says that "hicolor" must be the very last
+          // of all inherited themes, so don't add it here but at the very end
+          // of addBaseThemes().
+          continue;
         }
-        KIconThemeNode *n = new KIconThemeNode(theme);
-        mThemesInTree.append(*it);
-        addBaseThemes(n, appname);
-        links.append(n);
+        addThemeByName(*it, appname);
+    }
+}
+
+void KIconLoaderPrivate::addThemeByName(const QString &themename, const QString &appname)
+{
+    if (mThemesInTree.contains(themename)) {
+        return;
+    }
+    KIconTheme *theme = new KIconTheme(themename, appname);
+    if (!theme->isValid()) {
+        delete theme;
+        return;
     }
+    KIconThemeNode *n = new KIconThemeNode(theme);
+    mThemesInTree.append(themename);
+    links.append(n);
+    addInheritedThemes(n, appname);
 }
 
 void KIconLoader::addExtraDesktopThemes()
@@ -579,17 +616,14 @@
         }
     }
 
-    for (it=list.begin(); it!=list.end(); ++it)
+    for (it = list.begin(); it != list.end(); ++it)
     {
-        if ( d->mThemesInTree.contains(*it) )
-                continue;
-        if ( *it == QLatin1String("default.kde") ) continue;
-
-        KIconTheme *def = new KIconTheme( *it, "" );
-        KIconThemeNode* node = new KIconThemeNode(def);
-        d->mThemesInTree.append(*it);
-        d->links.append(node);
-        d->addBaseThemes(node, "" );
+        // Don't add the KDE defaults once more, we have them anyways.
+        if (*it == QLatin1String("default.kde")
+            || *it == QLatin1String("default.kde4")) {
+            continue;
+        }
+        d->addThemeByName(*it, "");
     }
 
     d->extraDesktopIconsLoaded=true;


Index: kdelibs.spec
===================================================================
RCS file: /cvs/extras/rpms/kdelibs/F-9/kdelibs.spec,v
retrieving revision 1.323
retrieving revision 1.324
diff -u -r1.323 -r1.324
--- kdelibs.spec	1 Jun 2008 12:09:02 -0000	1.323
+++ kdelibs.spec	1 Jun 2008 14:31:09 -0000	1.324
@@ -80,6 +80,7 @@
 
 ## upstream patches
 Patch100: kdelibs-4.0.4-khtml-stylesheet.patch
+Patch101: kdelibs-4.0.5-iconload.patch
 
 BuildRequires: qt4-devel >= 4.3.0
 Requires: qt4 >= %{_qt4_version} 
@@ -200,6 +201,7 @@
 
 # upstream patches
 %patch100 -p1 -b .khtml-stylesheet
+%patch101 -p1 -b .iconload
 
 %build
 
@@ -362,10 +364,11 @@
 %changelog
 * Sat May 31 2008 Than Ngo <than at redhat.com> 4.0.5-1
 - 4.0.5
+- backport patch from 4.1 branch to fix inherit issue in iconload, #448536
 
 * Fri May 30 2008 Than Ngo <than at redhat.com> 4.0.4-11
 - fix #447965, order issue in kde path, thanks to Kevin
-- backport patch to check html style version
+- backport patch from 4.1 branch to check html style version
 
 * Tue May 27 2008 Lukáš Tinkl <ltinkl at redhat.com> - 4.0.4-10
 - Fixes a crash when you are using two different protocols and move through the tree




More information about the fedora-extras-commits mailing list