Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package kiconthemes for openSUSE:Factory checked in at 2022-10-11 18:00:00 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kiconthemes (Old) and /work/SRC/openSUSE:Factory/.kiconthemes.new.2275 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "kiconthemes" Tue Oct 11 18:00:00 2022 rev:113 rq:1009000 version:5.99.0 Changes: -------- --- /work/SRC/openSUSE:Factory/kiconthemes/kiconthemes.changes 2022-09-13 15:10:18.164796936 +0200 +++ /work/SRC/openSUSE:Factory/.kiconthemes.new.2275/kiconthemes.changes 2022-10-11 18:01:51.909727420 +0200 @@ -1,0 +2,12 @@ +Sat Oct 1 15:55:49 UTC 2022 - Christophe Giboudeaux <christo...@krop.fr> + +- Update to 5.99.0 + * New feature release + * For more details please see: + * https://kde.org/announcements/frameworks/5/5.99.0 +- Changes since 5.98.0: + * KIconEngine: Use QFileInfo::completeBaseName + * KIconEngine: Return actual icon name of loaded icon (kde#432293) + * Add dedicated kiconloader_p.h header for KIconLoaderPrivate + +------------------------------------------------------------------- Old: ---- kiconthemes-5.98.0.tar.xz kiconthemes-5.98.0.tar.xz.sig New: ---- kiconthemes-5.99.0.tar.xz kiconthemes-5.99.0.tar.xz.sig ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kiconthemes.spec ++++++ --- /var/tmp/diff_new_pack.hyRpwq/_old 2022-10-11 18:01:52.873728978 +0200 +++ /var/tmp/diff_new_pack.hyRpwq/_new 2022-10-11 18:01:52.877728984 +0200 @@ -17,14 +17,14 @@ %define lname libKF5IconThemes5 -%define _tar_path 5.98 +%define _tar_path 5.99 # Full KF5 version (e.g. 5.33.0) %{!?_kf5_version: %global _kf5_version %{version}} # Last major and minor KF5 version (e.g. 5.33) %{!?_kf5_bugfix_version: %define _kf5_bugfix_version %(echo %{_kf5_version} | awk -F. '{print $1"."$2}')} %bcond_without released Name: kiconthemes -Version: 5.98.0 +Version: 5.99.0 Release: 0 Summary: Icon GUI utilities License: LGPL-2.1-or-later AND GPL-2.0-or-later @@ -88,22 +88,19 @@ %build %cmake_kf5 -d build + %cmake_build %install %kf5_makeinstall -C build %fdupes %{buildroot} -%if %{with released} -%find_lang %{name}5 -%endif +%find_lang kiconthemes5 %post -n %{lname} -p /sbin/ldconfig %postun -n %{lname} -p /sbin/ldconfig -%if %{with released} -%files -n %{lname}-lang -f %{name}5.lang -%endif +%files -n %{lname}-lang -f kiconthemes5.lang %files -n %{lname} %license LICENSES/* ++++++ kiconthemes-5.98.0.tar.xz -> kiconthemes-5.99.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiconthemes-5.98.0/CMakeLists.txt new/kiconthemes-5.99.0/CMakeLists.txt --- old/kiconthemes-5.98.0/CMakeLists.txt 2022-09-05 14:07:56.000000000 +0200 +++ new/kiconthemes-5.99.0/CMakeLists.txt 2022-10-01 16:18:43.000000000 +0200 @@ -1,12 +1,12 @@ cmake_minimum_required(VERSION 3.16) -set(KF_VERSION "5.98.0") # handled by release scripts -set(KF_DEP_VERSION "5.98.0") # handled by release scripts +set(KF_VERSION "5.99.0") # handled by release scripts +set(KF_DEP_VERSION "5.99.0") # handled by release scripts project(KIconThemes VERSION ${KF_VERSION}) # ECM setup include(FeatureSummary) -find_package(ECM 5.98.0 NO_MODULE) +find_package(ECM 5.99.0 NO_MODULE) set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://commits.kde.org/extra-cmake-modules") feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiconthemes-5.98.0/autotests/kiconengine_unittest.cpp new/kiconthemes-5.99.0/autotests/kiconengine_unittest.cpp --- old/kiconthemes-5.98.0/autotests/kiconengine_unittest.cpp 2022-09-05 14:07:56.000000000 +0200 +++ new/kiconthemes-5.99.0/autotests/kiconengine_unittest.cpp 2022-10-01 16:18:43.000000000 +0200 @@ -43,6 +43,7 @@ QVERIFY(testIconsDir.mkpath(QStringLiteral("oxygen/22x22/apps"))); QVERIFY(QFile::copy(QStringLiteral(":/oxygen.theme"), testIconsDir.filePath(QStringLiteral("oxygen/index.theme")))); QVERIFY(QFile::copy(QStringLiteral(":/test-22x22.png"), testIconsDir.filePath(QStringLiteral("oxygen/22x22/apps/kde.png")))); + QVERIFY(QFile::copy(QStringLiteral(":/test-22x22.png"), testIconsDir.filePath(QStringLiteral("oxygen/22x22/apps/org.kde.testapp.png")))); QVERIFY(testIconsDir.mkpath(QStringLiteral("oxygen/22x22/actions"))); // we need the dir to exist since KIconThemes caches mDirs // Clear SHM cache @@ -63,6 +64,17 @@ QVERIFY2(icon.name().isEmpty(), qPrintable(icon.name())); } + void testFallbackIconName() + { + QIcon icon(new KIconEngine(QStringLiteral("kde-specific-icon"), KIconLoader::global())); + QVERIFY(!icon.isNull()); + QCOMPARE(icon.name(), QStringLiteral("kde")); + + QIcon icon2(new KIconEngine(QStringLiteral("org.kde.testapp-specific-icon"), KIconLoader::global())); + QVERIFY(!icon2.isNull()); + QCOMPARE(icon2.name(), QStringLiteral("org.kde.testapp")); + } + void testUnknownIconNotCached() // QIcon version of the test in kiconloader_unittest.cpp { // This is a test to ensure that "unknown" icons are cached as unknown diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiconthemes-5.98.0/po/cs/kiconthemes5.po new/kiconthemes-5.99.0/po/cs/kiconthemes5.po --- old/kiconthemes-5.98.0/po/cs/kiconthemes5.po 2022-09-05 14:07:56.000000000 +0200 +++ new/kiconthemes-5.99.0/po/cs/kiconthemes5.po 2022-10-01 16:18:43.000000000 +0200 @@ -21,11 +21,10 @@ "X-Generator: Lokalize 21.04.2\n" #: kiconbutton.cpp:82 -#, fuzzy, kde-format -#| msgid "Select Icon" +#, kde-format msgctxt "@info:tooltip" msgid "Select Icon???" -msgstr "Vybrat ikonu" +msgstr "" #: kicondialog.cpp:312 msgid "All" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiconthemes-5.98.0/po/is/kiconthemes5.po new/kiconthemes-5.99.0/po/is/kiconthemes5.po --- old/kiconthemes-5.98.0/po/is/kiconthemes5.po 2022-09-05 14:07:56.000000000 +0200 +++ new/kiconthemes-5.99.0/po/is/kiconthemes5.po 2022-10-01 16:18:43.000000000 +0200 @@ -9,20 +9,20 @@ # Svanur Palsson <sva...@tern.is>, 2004. # Arnar Leosson <leos...@frisurf.no>, 2004, 2005. # Arnar Le??sson <leos...@frisurf.no>, 2005. -# Sveinn ?? Felli <svei...@nett.is>, 2008, 2009, 2010, 2011, 2012. +# Sveinn ?? Felli <svei...@nett.is>, 2008, 2009, 2010, 2011, 2012, 2022. msgid "" msgstr "" "Project-Id-Version: kio4\n" "Report-Msgid-Bugs-To: https://bugs.kde.org\n" "POT-Creation-Date: 2022-08-09 00:42+0000\n" -"PO-Revision-Date: 2012-09-07 08:43+0000\n" -"Last-Translator: Sveinn ?? Felli <svei...@nett.is>\n" -"Language-Team: Icelandic <kde-...@molar.is>\n" +"PO-Revision-Date: 2022-09-21 19:58+0000\n" +"Last-Translator: Sveinn ?? Felli <s...@fellsnet.is>\n" +"Language-Team: Icelandic\n" "Language: is\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Lokalize 1.5\n" +"X-Generator: Lokalize 21.12.3\n" "Plural-Forms: Plural-Forms: nplurals=2; plural=n != 1;\n" "\n" "\n" @@ -32,15 +32,14 @@ "\n" #: kiconbutton.cpp:82 -#, fuzzy, kde-format -#| msgid "Select Icon" +#, kde-format msgctxt "@info:tooltip" msgid "Select Icon???" -msgstr "Veldu t??knmynd" +msgstr "Veldu t??knmynd???" #: kicondialog.cpp:312 msgid "All" -msgstr "" +msgstr "Allt" #: kicondialog.cpp:313 msgid "Actions" @@ -68,7 +67,7 @@ #: kicondialog.cpp:319 msgid "Mimetypes" -msgstr "MIME-t??g" +msgstr "MIME-tegundir" #: kicondialog.cpp:320 msgid "Places" @@ -79,28 +78,25 @@ msgstr "Sta??a" #: kicondialog.cpp:345 -#, fuzzy, kde-format -#| msgctxt "@item:inmenu" -#| msgid "Other" +#, kde-format msgctxt "Other icons" msgid "Other" msgstr "Anna??" #: kicondialog.cpp:392 -#, fuzzy, kde-format -#| msgid "&Browse..." +#, kde-format msgid "Browse???" -msgstr "&Velja..." +msgstr "Fletta???" #: kicondialog.cpp:594 #, kde-format msgid "No icons matching the search" -msgstr "" +msgstr "Engar t??knmyndir samsvara ??essari leit" #: kicondialog.cpp:596 #, kde-format msgid "No icons in this category" -msgstr "" +msgstr "Engar t??knmyndir ?? ??essum flokki" #. i18n: ectx: property (windowTitle), widget (QWidget, IconDialog) #: kicondialog.cpp:676 kicondialog.ui:14 @@ -109,21 +105,21 @@ msgstr "Veldu t??knmynd" #: kicondialog.cpp:676 -#, fuzzy, kde-format -#| msgid "*.png *.xpm *.svg *.svgz|Icon Files (*.png *.xpm *.svg *.svgz)" +#, kde-format msgid "" "*.ico *.png *.xpm *.svg *.svgz|Icon Files (*.ico *.png *.xpm *.svg *.svgz)" -msgstr "*.png *.xpm *.svg *.svgz|t??knmyndaskr??r (*.png *.xpm *.svg *.svgz)" +msgstr "" +"*.ico *.png *.xpm *.svg *.svgz|t??knmyndaskr??r (*.ico *.png *.xpm *.svg *." +"svgz)" #. i18n: ectx: property (accessibleName), widget (QComboBox, contextCombo) #: kicondialog.ui:24 #, kde-format msgid "Icon category" -msgstr "" +msgstr "T??knmyndaflokkur" #. i18n: ectx: property (placeholderText), widget (QLineEdit, searchLine) #: kicondialog.ui:44 -#, fuzzy, kde-format -#| msgid "Select Icon" +#, kde-format msgid "Search Icons..." -msgstr "Veldu t??knmynd" +msgstr "Leita a?? t??knmyndum..." diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiconthemes-5.98.0/po/ka/kiconthemes5.po new/kiconthemes-5.99.0/po/ka/kiconthemes5.po --- old/kiconthemes-5.98.0/po/ka/kiconthemes5.po 2022-09-05 14:07:56.000000000 +0200 +++ new/kiconthemes-5.99.0/po/ka/kiconthemes5.po 2022-10-01 16:18:43.000000000 +0200 @@ -15,7 +15,7 @@ "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: Poedit 3.1.1\n" #: kiconbutton.cpp:82 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiconthemes-5.98.0/po/sv/kiconthemes5.po new/kiconthemes-5.99.0/po/sv/kiconthemes5.po --- old/kiconthemes-5.98.0/po/sv/kiconthemes5.po 2022-09-05 14:07:56.000000000 +0200 +++ new/kiconthemes-5.99.0/po/sv/kiconthemes5.po 2022-10-01 16:18:43.000000000 +0200 @@ -8,14 +8,14 @@ # Mattias Newzella <newze...@linux.nu>, 2000, 2001, 2002,2003, 2004, 2005. # Stefan Asserh??ll <stefan.asserh...@bredband.net>, 2002. # Stefan Asserh??ll <stefan.asserh...@bredband.net>, 2004, 2005, 2006, 2007, 2008, 2009, 2010. -# Stefan Asserhall <stefan.asserh...@bredband.net>, 2010, 2011, 2012, 2016, 2018, 2021. +# Stefan Asserhall <stefan.asserh...@bredband.net>, 2010, 2011, 2012, 2016, 2018, 2021, 2022. # Arve Eriksson <031299...@telia.com>, 2011. msgid "" msgstr "" "Project-Id-Version: kio4\n" "Report-Msgid-Bugs-To: https://bugs.kde.org\n" "POT-Creation-Date: 2022-08-09 00:42+0000\n" -"PO-Revision-Date: 2021-07-07 14:59+0200\n" +"PO-Revision-Date: 2022-09-24 16:18+0200\n" "Last-Translator: Stefan Asserh??ll <stefan.asserh...@bredband.net>\n" "Language-Team: Swedish <kde-i18n-...@kde.org>\n" "Language: sv\n" @@ -26,11 +26,10 @@ "Plural-Forms: nplurals=2; plural=n != 1;\n" #: kiconbutton.cpp:82 -#, fuzzy, kde-format -#| msgid "Select Icon" +#, kde-format msgctxt "@info:tooltip" msgid "Select Icon???" -msgstr "V??lj ikon" +msgstr "V??lj ikon???" #: kicondialog.cpp:312 msgid "All" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiconthemes-5.98.0/po/zh_CN/kiconthemes5.po new/kiconthemes-5.99.0/po/zh_CN/kiconthemes5.po --- old/kiconthemes-5.98.0/po/zh_CN/kiconthemes5.po 2022-09-05 14:07:56.000000000 +0200 +++ new/kiconthemes-5.99.0/po/zh_CN/kiconthemes5.po 2022-10-01 16:18:43.000000000 +0200 @@ -3,7 +3,7 @@ "Project-Id-Version: kdeorg\n" "Report-Msgid-Bugs-To: https://bugs.kde.org\n" "POT-Creation-Date: 2022-08-09 00:42+0000\n" -"PO-Revision-Date: 2022-08-20 14:17\n" +"PO-Revision-Date: 2022-09-20 01:55\n" "Last-Translator: \n" "Language-Team: Chinese Simplified\n" "Language: zh_CN\n" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiconthemes-5.98.0/src/CMakeLists.txt new/kiconthemes-5.99.0/src/CMakeLists.txt --- old/kiconthemes-5.98.0/src/CMakeLists.txt 2022-09-05 14:07:56.000000000 +0200 +++ new/kiconthemes-5.99.0/src/CMakeLists.txt 2022-10-01 16:18:43.000000000 +0200 @@ -87,7 +87,7 @@ REQUIRED_HEADERS KIconThemes_HEADERS ) -install(TARGETS KF5IconThemes EXPORT KF5IconThemesTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS}) +install(TARGETS KF5IconThemes EXPORT KF5IconThemesTargets ${KF_INSTALL_TARGETS_DEFAULT_ARGS}) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kiconthemes_export.h diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiconthemes-5.98.0/src/kiconengine.cpp new/kiconthemes-5.99.0/src/kiconengine.cpp --- old/kiconthemes-5.98.0/src/kiconengine.cpp 2022-09-05 14:07:56.000000000 +0200 +++ new/kiconthemes-5.99.0/src/kiconengine.cpp 2022-10-01 16:18:43.000000000 +0200 @@ -7,10 +7,12 @@ #include "kiconengine.h" +#include "kiconloader_p.h" #include <kiconloader.h> #include "kiconcolors.h" #include <KIconTheme> +#include <QFileInfo> #include <QPainter> #include <qscopeguard.h> @@ -20,24 +22,25 @@ QPointer<KIconLoader> mIconLoader; bool mCustomColors = false; KIconColors mColors; + QString mActualIconName; }; KIconEngine::KIconEngine(const QString &iconName, KIconLoader *iconLoader, const QStringList &overlays) : mIconName(iconName) , mOverlays(overlays) - , d(new KIconEnginePrivate{iconLoader, false, {}}) + , d(new KIconEnginePrivate{iconLoader, false, {}, {}}) { } KIconEngine::KIconEngine(const QString &iconName, KIconLoader *iconLoader) : mIconName(iconName) - , d(new KIconEnginePrivate{iconLoader, false, {}}) + , d(new KIconEnginePrivate{iconLoader, false, {}, {}}) { } KIconEngine::KIconEngine(const QString &iconName, const KIconColors &colors, KIconLoader *iconLoader) : mIconName(iconName) - , d(new KIconEnginePrivate{iconLoader, true, colors}) + , d(new KIconEnginePrivate{iconLoader, true, colors, {}}) { } @@ -99,6 +102,8 @@ const QSize scaledSize = size / scale; + QString iconPath; + const int kstate = qIconModeToKIconState(mode); QPixmap pix = d->mIconLoader->loadScaledIcon(mIconName, KIconLoader::Desktop, @@ -106,10 +111,14 @@ scaledSize, kstate, mOverlays, - nullptr, + &iconPath, false, d->mCustomColors ? std::make_optional(d->mColors) : std::nullopt); + if (!iconPath.isEmpty() && !d->mActualIconName.isEmpty()) { + d->mActualIconName = QFileInfo(iconPath).completeBaseName(); + } + if (pix.size() == size) { return pix; } @@ -139,10 +148,21 @@ QString KIconEngine::iconName() const #endif { - if (!d->mIconLoader || !d->mIconLoader->hasIcon(mIconName)) { + if (!d->mActualIconName.isEmpty()) { + return d->mActualIconName; + } + + if (!d->mIconLoader) { return QString(); } - return mIconName; + + const QString iconPath = KIconLoaderPrivate::get(d->mIconLoader)->preferredIconPath(mIconName); + if (iconPath.isEmpty()) { + return QString(); + } + + d->mActualIconName = QFileInfo(iconPath).completeBaseName(); + return d->mActualIconName; } Q_GLOBAL_STATIC_WITH_ARGS(QList<QSize>, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiconthemes-5.98.0/src/kiconloader.cpp new/kiconthemes-5.99.0/src/kiconloader.cpp --- old/kiconthemes-5.98.0/src/kiconloader.cpp 2022-09-05 14:07:56.000000000 +0200 +++ new/kiconthemes-5.99.0/src/kiconloader.cpp 2022-10-01 16:18:43.000000000 +0200 @@ -11,6 +11,7 @@ */ #include "kiconloader.h" +#include "kiconloader_p.h" // kdecore #include <KConfigGroup> @@ -38,7 +39,6 @@ #include <QBuffer> #include <QByteArray> -#include <QCache> #include <QDataStream> #include <QDir> #include <QElapsedTimer> @@ -68,14 +68,6 @@ } /** - * Holds a QPixmap for this process, along with its associated path on disk. - */ -struct PixmapWithPath { - QPixmap pixmap; - QString path; -}; - -/** * Function to convert an uint32_t to AARRGGBB hex values. * * W A R N I N G ! @@ -152,12 +144,6 @@ return theme->iconPath(name, size, match); } -/*** KIconGroup: Icon type description. ***/ - -struct KIconGroup { - int size; -}; - extern KICONTHEMES_EXPORT int kiconloader_ms_between_checks; KICONTHEMES_EXPORT int kiconloader_ms_between_checks = 5000; @@ -242,215 +228,42 @@ Q_GLOBAL_STATIC(KIconLoaderGlobalData, s_globalData) -/*** d pointer for KIconLoader. ***/ -class KIconLoaderPrivate +KIconLoaderPrivate::KIconLoaderPrivate(const QString &_appname, const QStringList &extraSearchPaths, KIconLoader *qq) + : q(qq) + , m_appname(_appname) { -public: - KIconLoaderPrivate(const QString &_appname, const QStringList &extraSearchPaths, KIconLoader *qq) - : q(qq) - , m_appname(_appname) - { - q->connect(s_globalData, &KIconLoaderGlobalData::iconChanged, q, [this](int group) { - _k_refreshIcons(group); - }); - init(m_appname, extraSearchPaths); - } - - ~KIconLoaderPrivate() - { - clear(); - } - - void clear() - { - /* antlarr: There's no need to delete d->mpThemeRoot as it's already - deleted when the elements of d->links are deleted */ - qDeleteAll(links); - delete[] mpGroups; - delete mIconCache; - mpGroups = nullptr; - mIconCache = nullptr; - mPixmapCache.clear(); - m_appname.clear(); - searchPaths.clear(); - links.clear(); - mIconThemeInited = false; - mThemesInTree.clear(); - } - - /** - * @internal - */ - void init(const QString &_appname, const QStringList &extraSearchPaths = QStringList()); - - /** - * @internal - */ - void initIconThemes(); - - /** - * @internal - * tries to find an icon with the name. It tries some extension and - * match strategies - */ - QString findMatchingIcon(const QString &name, int size, qreal scale) const; - - /** - * @internal - * tries to find an icon with the name. - * This is one layer above findMatchingIcon -- it also implements generic fallbacks - * such as generic icons for mimetypes. - */ - QString findMatchingIconWithGenericFallbacks(const QString &name, int size, qreal scale) const; - - /** - * @internal - * Adds themes installed in the application's directory. - **/ - void addAppThemes(const QString &appname, const QString &themeBaseDir = QString()); - - /** - * @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); - - /** - * Adds all the default themes from other desktops at the end of - * the list of icon themes. - */ - void addExtraDesktopThemes(); - - /** - * @internal - * return the path for the unknown icon in that size - */ - QString unknownIconPath(int size, qreal scale) const; - - /** - * Checks if name ends in one of the supported icon formats (i.e. .png) - * and returns the name without the extension if it does. - */ - QString removeIconExtension(const QString &name) const; - - /** - * @internal - * Used with KIconLoader::loadIcon to convert the given name, size, group, - * and icon state information to valid states. All parameters except the - * name can be modified as well to be valid. - */ - void normalizeIconMetadata(KIconLoader::Group &group, QSize &size, int &state) const; - - /** - * @internal - * Used with KIconLoader::loadIcon to get a base key name from the given - * icon metadata. Ensure the metadata is normalized first. - */ - QString makeCacheKey(const QString &name, - KIconLoader::Group group, - const QStringList &overlays, - const QSize &size, - qreal scale, - int state, - const KIconColors &colors) const; - - /** - * @internal - * If the icon is an SVG file, process it generating a stylesheet - * following the current color scheme. in this case the icon can use named colors - * as text color, background color, highlight color, positive/neutral/negative color - * @see KColorScheme - */ - QByteArray processSvg(const QString &path, KIconLoader::States state, const KIconColors &colors) const; - - /** - * @internal - * Creates the QImage for @p path, using SVG rendering as appropriate. - * @p size is only used for scalable images, but if non-zero non-scalable - * images will be resized anyways. - */ - QImage createIconImage(const QString &path, const QSize &size, qreal scale, KIconLoader::States state, const KIconColors &colors); - - /** - * @internal - * Adds an QPixmap with its associated path to the shared icon cache. - */ - void insertCachedPixmapWithPath(const QString &key, const QPixmap &data, const QString &path); - - /** - * @internal - * Retrieves the path and pixmap of the given key from the shared - * icon cache. - */ - bool findCachedPixmapWithPath(const QString &key, QPixmap &data, QString &path); - - /** - * Find the given file in the search paths. - */ - QString locate(const QString &fileName); - - /** - * @internal - * React to a global icon theme change - */ - void _k_refreshIcons(int group); + q->connect(s_globalData, &KIconLoaderGlobalData::iconChanged, q, [this](int group) { + _k_refreshIcons(group); + }); + init(m_appname, extraSearchPaths); +} - bool shouldCheckForUnknownIcons() - { - if (mLastUnknownIconCheck.isValid() && mLastUnknownIconCheck.elapsed() < kiconloader_ms_between_checks) { - return false; - } - mLastUnknownIconCheck.start(); - return true; - } +KIconLoaderPrivate::~KIconLoaderPrivate() +{ + clear(); +} - KIconLoader *const q; +KIconLoaderPrivate *KIconLoaderPrivate::get(KIconLoader *loader) +{ + return loader->d.get(); +} - QStringList mThemesInTree; - KIconGroup *mpGroups = nullptr; - KIconThemeNode *mpThemeRoot = nullptr; - QStringList searchPaths; - KIconEffect mpEffect; - QList<KIconThemeNode *> links; - - // This shares the icons across all processes - KSharedDataCache *mIconCache = nullptr; - - // This caches rendered QPixmaps in just this process. - QCache<QString, PixmapWithPath> mPixmapCache; - - bool extraDesktopIconsLoaded : 1; - // lazy loading: initIconThemes() is only needed when the "links" list is needed - // mIconThemeInited is used inside initIconThemes() to init only once - bool mIconThemeInited : 1; - QString m_appname; - - void drawOverlays(const KIconLoader *loader, KIconLoader::Group group, int state, QPixmap &pix, const QStringList &overlays); - - QHash<QString, bool> mIconAvailability; // icon name -> true (known to be available) or false (known to be unavailable) - QElapsedTimer mLastUnknownIconCheck; // recheck for unknown icons after kiconloader_ms_between_checks - // the colors used to recolor svg icons stylesheets - KIconColors mColors; - QPalette mPalette; - // to keep track if we are using a custom palette or just falling back to qApp; - bool mCustomColors = false; -}; +void KIconLoaderPrivate::clear() +{ + /* antlarr: There's no need to delete d->mpThemeRoot as it's already + deleted when the elements of d->links are deleted */ + qDeleteAll(links); + delete[] mpGroups; + delete mIconCache; + mpGroups = nullptr; + mIconCache = nullptr; + mPixmapCache.clear(); + m_appname.clear(); + searchPaths.clear(); + links.clear(); + mIconThemeInited = false; + mThemesInTree.clear(); +} void KIconLoaderPrivate::drawOverlays(const KIconLoader *iconLoader, KIconLoader::Group group, int state, QPixmap &pix, const QStringList &overlays) { @@ -548,6 +361,15 @@ Q_EMIT q->iconChanged(group); } +bool KIconLoaderPrivate::shouldCheckForUnknownIcons() +{ + if (mLastUnknownIconCheck.isValid() && mLastUnknownIconCheck.elapsed() < kiconloader_ms_between_checks) { + return false; + } + mLastUnknownIconCheck.start(); + return true; +} + KIconLoader::KIconLoader(const QString &appname, const QStringList &extraSearchPaths, QObject *parent) : QObject(parent) , d(new KIconLoaderPrivate(appname, extraSearchPaths, this)) @@ -1088,6 +910,29 @@ return path; } +QString KIconLoaderPrivate::preferredIconPath(const QString &name) +{ + QString path; + + auto it = mIconAvailability.constFind(name); + const auto end = mIconAvailability.constEnd(); + + if (it != end && it.value().isEmpty() && !shouldCheckForUnknownIcons()) { + return path; // known to be unavailable + } + + if (it != end) { + path = it.value(); + } + + if (path.isEmpty()) { + path = q->iconPath(name, KIconLoader::Desktop, KIconLoader::MatchBest); + mIconAvailability.insert(name, path); + } + + return path; +} + inline QString KIconLoaderPrivate::unknownIconPath(int size, qreal scale) const { QString path = findMatchingIcon(QStringLiteral("unknown"), size, scale); @@ -1783,19 +1628,7 @@ bool KIconLoader::hasIcon(const QString &name) const { - auto it = d->mIconAvailability.constFind(name); - const auto end = d->mIconAvailability.constEnd(); - if (it != end && !it.value() && !d->shouldCheckForUnknownIcons()) { - return false; // known to be unavailable - } - bool found = it != end && it.value(); - if (!found) { - if (!iconPath(name, KIconLoader::Desktop, KIconLoader::MatchBest).isEmpty()) { - found = true; - } - d->mIconAvailability.insert(name, found); // remember whether the icon is available or not - } - return found; + return !d->preferredIconPath(name).isEmpty(); } void KIconLoader::setCustomPalette(const QPalette &palette) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiconthemes-5.98.0/src/kiconloader.h new/kiconthemes-5.99.0/src/kiconloader.h --- old/kiconthemes-5.98.0/src/kiconloader.h 2022-09-05 14:07:56.000000000 +0200 +++ new/kiconthemes-5.99.0/src/kiconloader.h 2022-10-01 16:18:43.000000000 +0200 @@ -695,6 +695,7 @@ void iconChanged(int group); private: + friend class KIconLoaderPrivate; // @internal the data object std::unique_ptr<KIconLoaderPrivate> const d; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiconthemes-5.98.0/src/kiconloader_p.h new/kiconthemes-5.99.0/src/kiconloader_p.h --- old/kiconthemes-5.98.0/src/kiconloader_p.h 1970-01-01 01:00:00.000000000 +0100 +++ new/kiconthemes-5.99.0/src/kiconloader_p.h 2022-10-01 16:18:43.000000000 +0200 @@ -0,0 +1,227 @@ +/* + This file is part of the KDE project, module kdecore. + SPDX-FileCopyrightText: 2000 Geert Jansen <jan...@kde.org> + SPDX-FileCopyrightText: 2000 Antonio Larrosa <larr...@kde.org> + + SPDX-License-Identifier: LGPL-2.0-only +*/ + +#ifndef KICONLOADER_P_H +#define KICONLOADER_P_H + +#include <QCache> +#include <QElapsedTimer> +#include <QPixmap> +#include <QSize> +#include <QString> +#include <QStringList> + +#include <KSharedDataCache> + +#include "kiconcolors.h" +#include "kiconeffect.h" +#include "kiconloader.h" + +class KIconThemeNode; + +/*** KIconGroup: Icon type description. ***/ + +struct KIconGroup { + int size; +}; + +/** + * Holds a QPixmap for this process, along with its associated path on disk. + */ +struct PixmapWithPath { + QPixmap pixmap; + QString path; +}; + +/*** d pointer for KIconLoader. ***/ +class KIconLoaderPrivate +{ +public: + KIconLoaderPrivate(const QString &_appname, const QStringList &extraSearchPaths, KIconLoader *qq); + ~KIconLoaderPrivate(); + + static KIconLoaderPrivate *get(KIconLoader *loader); + + void clear(); + + /** + * @internal + */ + void init(const QString &_appname, const QStringList &extraSearchPaths = QStringList()); + + /** + * @internal + */ + void initIconThemes(); + + /** + * @internal + * tries to find an icon with the name. It tries some extension and + * match strategies + */ + QString findMatchingIcon(const QString &name, int size, qreal scale) const; + + /** + * @internal + * tries to find an icon with the name. + * This is one layer above findMatchingIcon -- it also implements generic fallbacks + * such as generic icons for mimetypes. + */ + QString findMatchingIconWithGenericFallbacks(const QString &name, int size, qreal scale) const; + + /** + * @internal + * returns the preferred icon path for an icon with the name. + * Can be used for a quick "hasIcon" check since it caches + * that an icon was not found. + */ + QString preferredIconPath(const QString &name); + + /** + * @internal + * Adds themes installed in the application's directory. + **/ + void addAppThemes(const QString &appname, const QString &themeBaseDir = QString()); + + /** + * @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); + + /** + * Adds all the default themes from other desktops at the end of + * the list of icon themes. + */ + void addExtraDesktopThemes(); + + /** + * @internal + * return the path for the unknown icon in that size + */ + QString unknownIconPath(int size, qreal scale) const; + + /** + * Checks if name ends in one of the supported icon formats (i.e. .png) + * and returns the name without the extension if it does. + */ + QString removeIconExtension(const QString &name) const; + + /** + * @internal + * Used with KIconLoader::loadIcon to convert the given name, size, group, + * and icon state information to valid states. All parameters except the + * name can be modified as well to be valid. + */ + void normalizeIconMetadata(KIconLoader::Group &group, QSize &size, int &state) const; + + /** + * @internal + * Used with KIconLoader::loadIcon to get a base key name from the given + * icon metadata. Ensure the metadata is normalized first. + */ + QString makeCacheKey(const QString &name, + KIconLoader::Group group, + const QStringList &overlays, + const QSize &size, + qreal scale, + int state, + const KIconColors &colors) const; + + /** + * @internal + * If the icon is an SVG file, process it generating a stylesheet + * following the current color scheme. in this case the icon can use named colors + * as text color, background color, highlight color, positive/neutral/negative color + * @see KColorScheme + */ + QByteArray processSvg(const QString &path, KIconLoader::States state, const KIconColors &colors) const; + + /** + * @internal + * Creates the QImage for @p path, using SVG rendering as appropriate. + * @p size is only used for scalable images, but if non-zero non-scalable + * images will be resized anyways. + */ + QImage createIconImage(const QString &path, const QSize &size, qreal scale, KIconLoader::States state, const KIconColors &colors); + + /** + * @internal + * Adds an QPixmap with its associated path to the shared icon cache. + */ + void insertCachedPixmapWithPath(const QString &key, const QPixmap &data, const QString &path); + + /** + * @internal + * Retrieves the path and pixmap of the given key from the shared + * icon cache. + */ + bool findCachedPixmapWithPath(const QString &key, QPixmap &data, QString &path); + + /** + * Find the given file in the search paths. + */ + QString locate(const QString &fileName); + + /** + * @internal + * React to a global icon theme change + */ + void _k_refreshIcons(int group); + + bool shouldCheckForUnknownIcons(); + + KIconLoader *const q; + + QStringList mThemesInTree; + KIconGroup *mpGroups = nullptr; + KIconThemeNode *mpThemeRoot = nullptr; + QStringList searchPaths; + KIconEffect mpEffect; + QList<KIconThemeNode *> links; + + // This shares the icons across all processes + KSharedDataCache *mIconCache = nullptr; + + // This caches rendered QPixmaps in just this process. + QCache<QString, PixmapWithPath> mPixmapCache; + + bool extraDesktopIconsLoaded : 1; + // lazy loading: initIconThemes() is only needed when the "links" list is needed + // mIconThemeInited is used inside initIconThemes() to init only once + bool mIconThemeInited : 1; + QString m_appname; + + void drawOverlays(const KIconLoader *loader, KIconLoader::Group group, int state, QPixmap &pix, const QStringList &overlays); + + QHash<QString, QString> mIconAvailability; // icon name -> actual icon name (not null if known to be available) + QElapsedTimer mLastUnknownIconCheck; // recheck for unknown icons after kiconloader_ms_between_checks + // the colors used to recolor svg icons stylesheets + KIconColors mColors; + QPalette mPalette; + // to keep track if we are using a custom palette or just falling back to qApp; + bool mCustomColors = false; +}; + +#endif // KICONLOADER_P_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiconthemes-5.98.0/src/tools/kiconfinder/CMakeLists.txt new/kiconthemes-5.99.0/src/tools/kiconfinder/CMakeLists.txt --- old/kiconthemes-5.98.0/src/tools/kiconfinder/CMakeLists.txt 2022-09-05 14:07:56.000000000 +0200 +++ new/kiconthemes-5.99.0/src/tools/kiconfinder/CMakeLists.txt 2022-10-01 16:18:43.000000000 +0200 @@ -2,4 +2,4 @@ ecm_mark_nongui_executable(kiconfinder5) target_link_libraries(kiconfinder5 Qt${QT_MAJOR_VERSION}::Gui KF5IconThemes) -install(TARGETS kiconfinder5 ${KF5_INSTALL_TARGETS_DEFAULT_ARGS}) +install(TARGETS kiconfinder5 ${KF_INSTALL_TARGETS_DEFAULT_ARGS}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiconthemes-5.98.0/src/tools/ksvg2icns/CMakeLists.txt new/kiconthemes-5.99.0/src/tools/ksvg2icns/CMakeLists.txt --- old/kiconthemes-5.98.0/src/tools/ksvg2icns/CMakeLists.txt 2022-09-05 14:07:56.000000000 +0200 +++ new/kiconthemes-5.99.0/src/tools/ksvg2icns/CMakeLists.txt 2022-10-01 16:18:43.000000000 +0200 @@ -2,4 +2,4 @@ ecm_mark_nongui_executable(ksvg2icns) target_link_libraries(ksvg2icns Qt${QT_MAJOR_VERSION}::Gui Qt${QT_MAJOR_VERSION}::Svg) -install(TARGETS ksvg2icns ${KF5_INSTALL_TARGETS_DEFAULT_ARGS}) +install(TARGETS ksvg2icns ${KF_INSTALL_TARGETS_DEFAULT_ARGS}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiconthemes-5.98.0/tests/kiconloadertest.cpp new/kiconthemes-5.99.0/tests/kiconloadertest.cpp --- old/kiconthemes-5.98.0/tests/kiconloadertest.cpp 2022-09-05 14:07:56.000000000 +0200 +++ new/kiconthemes-5.99.0/tests/kiconloadertest.cpp 2022-10-01 16:18:43.000000000 +0200 @@ -22,7 +22,7 @@ qDebug() << "queryIcons " << mGroup << "," << mContext; const QStringList filelist = mpLoader->queryIcons(mGroup, mContext); qDebug() << " -> found " << filelist.count() << " icons."; - int i = 0; + // int i = 0; for (const auto &icon : filelist) { // qDebug() << ( i==9 ? "..." : (*it) ); mpLoader->loadIcon(icon, (KIconLoader::Group)mGroup);