Backport systemsettings-icons patch to fix icons in System Settings

This commit is contained in:
Andrey Bondrov 2016-04-26 00:29:50 +10:00
parent 35e5e702ef
commit 80de4e31e5
2 changed files with 55 additions and 1 deletions

View file

@ -0,0 +1,48 @@
From: David Edmundson <kde@davidedmundson.co.uk>
Date: Wed, 01 Oct 2014 13:23:12 +0000
Subject: Pass icons by data instead of path
X-Git-Tag: v5.1.0
X-Git-Url: http://quickgit.kde.org/?p=systemsettings.git&a=commitdiff&h=b872365e3104aaaaf9d3fdb40820db321cfe58d0
---
Pass icons by data instead of path
This fixes issues if the icon is an SVG
BUG: 337138
(this commit backported to KDE4 by this patch)
---
diff -urN kde-workspace-4.11.22/systemsettings/classic/CategoryList.cpp kde-workspace-4.11.22-patched/systemsettings/classic/CategoryList.cpp
--- kde-workspace-4.11.22/systemsettings/classic/CategoryList.cpp 2015-08-12 17:03:15.000000000 +1000
+++ kde-workspace-4.11.22-patched/systemsettings/classic/CategoryList.cpp 2016-04-26 00:11:03.831685517 +1000
@@ -24,6 +24,8 @@
#include <QFile>
#include <QModelIndex>
#include <QTextStream>
+#include <QIcon>
+#include <QBuffer>
#include <KDebug>
#include <KLocale>
@@ -110,7 +112,19 @@
const QString szName = childItem->name();
const QString szComment = childItem->service()->comment();
content += szLink + szName + "</a></td><td class=\"kc_rightcol\">" + szLink + szComment + "</a>";
- content = content.arg( iconL->iconPath(childItem->service()->icon(), - KIconLoader::SizeSmallMedium ) );
+
+ //passing just the path is insufficient as some icon sets (breeze) only provide SVGs
+ //instead pass data inline
+
+ QIcon icon = QIcon::fromTheme(childItem->service()->icon());
+ QImage image(icon.pixmap(24).toImage()); //icons are hardcoded to size 24 above
+ QByteArray byteArray;
+ QBuffer buffer(&byteArray);
+ image.save(&buffer, "PNG"); // writes the image in PNG format inside the buffer
+ QString iconBase64 = QString::fromLatin1(byteArray.toBase64().data());
+
+ content = content.arg("data:image/png;base64," + iconBase64);
+
d->itemMap.insert( link.url(), childIndex );
content += "</td></tr>\n";
}

View file

@ -13,7 +13,7 @@
Summary: KDE 4 application workspace components
Name: kdebase4-workspace
Version: 4.11.22
Release: 3
Release: 4
Epoch: 2
License: GPLv2+
Group: Graphical desktop/KDE
@ -80,6 +80,8 @@ Patch22: kde-workspace-4.11.13-fix-translation-strings.patch
Patch23: kde-workspace-4.11.15-cursor_rus.patch
# See https://bugs.kde.org/show_bug.cgi?id=340915
Patch24: kde-workspace-4.11.20-kwin-activation.patch
# Backported from Plasma 5 branch
Patch25: kde-workspace-4.11.22-systemsettings-icons.patch
Patch26: kdebase-workspace-4.11.0-simpleapplet-defaults.patch
# Make it possible to set wallpaper via dbus
# See https://bugs.kde.org/show_bug.cgi?id=217950
@ -1641,6 +1643,7 @@ tar xf %{SOURCE6}
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
%patch50 -p1
@ -1758,6 +1761,9 @@ for f in %{buildroot}%{_kde_applicationsdir}/*.desktop ; do
done
%changelog
* Mon Apr 25 2016 Andrey Bondrov <andrey.bondrov@rosalab.ru> 2:4.11.22-4
- Backport systemsettings-icons patch to fix icons in System Settings
* Mon Jan 11 2016 Andrey Bondrov <andrey.bondrov@rosalab.ru> 2:4.11.22-3
- Add kwin-activation patch to fix issues with applications focus at startup