Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apply svgiconengine patch to kiconthemes package #20721

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 20 additions & 3 deletions mingw-w64-kiconthemes/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ depends=(
"${MINGW_PACKAGE_PREFIX}-kwidgetsaddons"
"${MINGW_PACKAGE_PREFIX}-qt6-base"
"${MINGW_PACKAGE_PREFIX}-qt6-svg"
"${MINGW_PACKAGE_PREFIX}-breeze-icons"
)
makedepends=(
"${MINGW_PACKAGE_PREFIX}-cc"
Expand All @@ -34,15 +35,31 @@ makedepends=(
"${MINGW_PACKAGE_PREFIX}-qt6-tools"
)
optdepends=(
"${MINGW_PACKAGE_PREFIX}-breeze-icons: fallback icon theme"
"${MINGW_PACKAGE_PREFIX}-qt6-declarative: QML bindings"
)
groups=("${MINGW_PACKAGE_PREFIX}-kf6")
source=("https://download.kde.org/stable/frameworks/${pkgver%.*}/${_realname}-${pkgver}.tar.xz"{,.sig})
source=("https://download.kde.org/stable/frameworks/${pkgver%.*}/${_realname}-${pkgver}.tar.xz"{,.sig}
"kiconthemes-6.1.0-20240415.diff" "svgiconengine.diff")
sha256sums=('79ce77701d4194796e2c255008f19071460aa03ff208a2117fc4e4c9310c3402'
'SKIP')
'SKIP' 'SKIP' 'SKIP')
validpgpkeys=('E0A3EB202F8E57528E13E72FD7574483BB57B18D') # Jonathan Esk-Riddell <jr@jriddell.org>

apply_patch_with_msg() {
for _fname in "$@"
do
msg2 "Applying ${_fname}"
patch -Nbp1 -i "${srcdir}"/${_fname}
done
}

prepare() {
cd ${_realname}-${pkgver}

apply_patch_with_msg \
kiconthemes-6.1.0-20240415.diff \
svgiconengine.diff
}

build() {
declare -a _extra_config
if check_option "debug" "n"; then
Expand Down
14 changes: 14 additions & 0 deletions mingw-w64-kiconthemes/kiconthemes-6.1.0-20240415.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff -Nrub -x '*~' -x '*\.rej' -x '*\.orig' -x '*\.o' -x '*\.pyc' -x CMakeLists.txt.user kiconthemes-6.1.0.orig/src/kicontheme.cpp kiconthemes-6.1.0/src/kicontheme.cpp
--- kiconthemes-6.1.0.orig/src/kicontheme.cpp 2024-04-05 12:56:43.000000000 +0200
+++ kiconthemes-6.1.0/src/kicontheme.cpp 2024-04-15 11:51:58.968290800 +0200
@@ -45,8 +45,8 @@
// For this reason we use AppDataLocation: BINDIR/data on Windows, Resources on OS X
void initRCCIconTheme()
{
-#ifdef WITH_BREEZEICONS
- BreezeIcons::initIcons()
+#ifdef WITH_BREEZEICONS_LIB
+ BreezeIcons::initIcons();
#else
const QString iconThemeRcc = QStandardPaths::locate(QStandardPaths::AppDataLocation, QStringLiteral("icontheme.rcc"));
if (!iconThemeRcc.isEmpty()) {
77 changes: 77 additions & 0 deletions mingw-w64-kiconthemes/svgiconengine.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
diff --git a/src/kiconengineplugin.json b/src/kiconengineplugin.json
index bc09e41..a5b4228 100644
--- a/src/kiconengineplugin.json
+++ b/src/kiconengineplugin.json
@@ -1,4 +1,4 @@
{
- "Keys": [ "KIconEngine" ]
+ "Keys": [ "KIconEngine", "svg", "svgz", "svg.gz" ]
}

diff --git a/src/kiconloader.cpp b/src/kiconloader.cpp
index 3cebfc6..0eded28 100644
--- a/src/kiconloader.cpp
+++ b/src/kiconloader.cpp
@@ -147,6 +147,8 @@ QString KIconThemeNode::findIcon(const QString &name, int size, KIconLoader::Mat
extern KICONTHEMES_EXPORT int kiconloader_ms_between_checks;
KICONTHEMES_EXPORT int kiconloader_ms_between_checks = 5000;

+extern void initRCCIconTheme();
+
class KIconLoaderGlobalData : public QObject
{
Q_OBJECT
@@ -154,6 +156,16 @@ class KIconLoaderGlobalData : public QObject
public:
KIconLoaderGlobalData()
{
+ // ensure we load rcc files for application bundles (+ setup their theme)
+ initRCCIconTheme();
+
+ // Set the icon theme fallback to breeze
+ // Most of our apps use "lots" of icons that most of the times
+ // are only available with breeze, we still honour the user icon
+ // theme but if the icon is not found there, we go to breeze
+ // since it's almost sure it'll be there
+ QIcon::setFallbackThemeName(QStringLiteral("breeze"));
+
const QStringList genericIconsFiles = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("mime/generic-icons"));
// qCDebug(KICONTHEMES) << genericIconsFiles;
for (const QString &file : genericIconsFiles) {
diff --git a/src/kicontheme.cpp b/src/kicontheme.cpp
index 4eee2ff..e94f10c 100644
--- a/src/kicontheme.cpp
+++ b/src/kicontheme.cpp
@@ -61,32 +61,7 @@ void initRCCIconTheme()
}
}
}
-Q_COREAPP_STARTUP_FUNCTION(initRCCIconTheme)
-
-// Makes sure the icon theme fallback is set to breeze or one of its
-// variants. Most of our apps use "lots" of icons that most of the times
-// are only available with breeze, we still honour the user icon theme
-// but if the icon is not found there, we go to breeze since it's almost
-// sure it'll be there
-static void setBreezeFallback()
-{
- if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) {
- const QVariant themeHint = theme->themeHint(QPlatformTheme::SystemIconFallbackThemeName);
- if (themeHint.isValid()) {
- const QString iconTheme = themeHint.toString();
- if (iconTheme.contains(QStringLiteral("breeze"), Qt::CaseInsensitive)) {
- QIcon::setFallbackThemeName(iconTheme);
- return;
- }
- }
- }

- QIcon::setFallbackThemeName(QStringLiteral("breeze"));
-}
-
-#ifndef Q_OS_ANDROID
-Q_COREAPP_STARTUP_FUNCTION(setBreezeFallback)
-#endif
class KIconThemeDir;
class KIconThemePrivate
{