revert upstream commit wrt icon inheritance, for now, to avoid regression (kde#317138)

This commit is contained in:
Rex Dieter 2013-04-16 13:30:06 -05:00
parent ee0ccd4dc6
commit c0f75e8d30
2 changed files with 66 additions and 1 deletions

View File

@ -33,7 +33,7 @@
Summary: KDE Libraries
Version: 4.10.2
Release: 1%{?dist}
Release: 2%{?dist}
Name: kdelibs
Epoch: 6
@ -156,6 +156,12 @@ Patch61: kdelibs-4.9.3-dot.patch
## upstream
# revert this fix for
#https://bugs.kde.org/315578
# for now, causes regression,
#https://bugs.kde.org/317138
Patch100: return-application-icons-properly.patch
## security fix
# Not Upstreamed? why not ? -- Rex
Patch200: kdelibs-4.10.0-CVE-2009-2702.patch
@ -344,6 +350,7 @@ sed -i -e "s|@@VERSION_RELEASE@@|%{version}-%{release}|" kio/kio/kprotocolmanage
%patch61 -p1 -b .dot
# upstream patches
%patch100 -p1 -R -b .return-application-icons-properly
# security fixes
%patch200 -p1 -b .CVE-2009-2702
@ -587,6 +594,9 @@ gtk-update-icon-cache %{_kde4_iconsdir}/hicolor &> /dev/null || :
%changelog
* Tue Apr 16 2013 Rex Dieter <rdieter@fedoraproject.org> 6:4.10.2-2
- revert upstream commit wrt icon inheritance, for now, to avoid regression (kde#317138)
* Sat Mar 30 2013 Rex Dieter <rdieter@fedoraproject.org> 6:4.10.2-1
- 4.10.2

View File

@ -0,0 +1,55 @@
From 613c951a1157df0d8a907a155a5eaa706816d5f9 Mon Sep 17 00:00:00 2001
From: Aaron Seigo <aseigo@kde.org>
Date: Thu, 21 Feb 2013 17:58:11 +0100
Subject: return application icons properly
BUG:315578
---
kdeui/icons/kiconloader.cpp | 31 ++++++++++++++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/kdeui/icons/kiconloader.cpp b/kdeui/icons/kiconloader.cpp
index f65e941..6fed667 100644
--- a/kdeui/icons/kiconloader.cpp
+++ b/kdeui/icons/kiconloader.cpp
@@ -909,7 +909,36 @@ K3Icon KIconLoaderPrivate::findMatchingIcon(const QString& name, int size) const
const char * const ext[4] = { ".png", ".svgz", ".svg", ".xpm" };
bool genericFallback = name.endsWith(QLatin1String("-x-generic"));
- foreach(KIconThemeNode *themeNode, links)
+ // Do two passes through themeNodes.
+ //
+ // The first pass looks for an exact match in each themeNode one after the other.
+ // If one is found and it is an app icon then return that icon.
+ //
+ // In the next pass (assuming the first pass failed), it looks for exact matches
+ // and then generic fallbacks in each themeNode one after the other
+ //
+ // The reasoning is that application icons should always match exactly, all other
+ // icons may fallback. Since we do not know what the context is here when we start
+ // looking for it, we can only go by the path found.
+ foreach (KIconThemeNode *themeNode, links) {
+ for (int i = 0 ; i < 4 ; i++) {
+ icon = themeNode->theme->iconPath(name + ext[i], size, KIconLoader::MatchExact);
+ if (icon.isValid()) {
+ break;
+ }
+
+ icon = themeNode->theme->iconPath(name + ext[i], size, KIconLoader::MatchBest);
+ if (icon.isValid()) {
+ break;
+ }
+ }
+
+ if (icon.isValid() && icon.path.contains("/apps/")) {
+ return icon;
+ }
+ }
+
+ foreach (KIconThemeNode *themeNode, links)
{
QString currentName = name;
--
1.8.1.4