Hello community, here is the log from the commit of package libqt5xdg for openSUSE:Factory checked in at 2018-06-29 22:31:13 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libqt5xdg (Old) and /work/SRC/openSUSE:Factory/.libqt5xdg.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libqt5xdg" Fri Jun 29 22:31:13 2018 rev:8 rq:618054 version:3.2.0 Changes: -------- --- /work/SRC/openSUSE:Factory/libqt5xdg/libqt5xdg.changes 2017-10-24 22:23:00.721440104 +0200 +++ /work/SRC/openSUSE:Factory/.libqt5xdg.new/libqt5xdg.changes 2018-06-29 22:31:38.258244775 +0200 @@ -1,0 +2,10 @@ +Tue May 22 13:54:39 UTC 2018 - [email protected] + +- Update to 3.2.0: + * xdgiconloader: Add GTK cache revalidation (fixes finding and + showing new icons, especially in main menu) + * xdgiconloader: Cache ScalableFollowsColorEntry properly + * Set genericName as tooltip (for main menu) + * Fix symbolic SVG icons with Qt >= 5.10 + +------------------------------------------------------------------- Old: ---- libqtxdg-3.1.0.tar.xz libqtxdg-3.1.0.tar.xz.asc New: ---- libqtxdg-3.2.0.tar.xz libqtxdg-3.2.0.tar.xz.asc ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libqt5xdg.spec ++++++ --- /var/tmp/diff_new_pack.7OhrMW/_old 2018-06-29 22:31:38.938244255 +0200 +++ /var/tmp/diff_new_pack.7OhrMW/_new 2018-06-29 22:31:38.942244252 +0200 @@ -1,7 +1,7 @@ # # spec file for package libqt5xdg # -# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ %define _name libqtxdg Name: libqt5xdg -Version: 3.1.0 +Version: 3.2.0 Release: 0 Summary: Qt implementation of xdg specs for lxqt License: GPL-3.0 @@ -31,7 +31,7 @@ BuildRequires: gcc-c++ BuildRequires: libQt5Gui-private-headers-devel BuildRequires: pkgconfig -BuildRequires: pkgconfig(Qt5Core) >= 5.6.1 +BuildRequires: pkgconfig(Qt5Core) >= 5.7.1 BuildRequires: pkgconfig(Qt5DBus) BuildRequires: pkgconfig(Qt5Svg) BuildRequires: pkgconfig(Qt5Test) @@ -107,18 +107,18 @@ %files -n libQt5XdgIconLoader3 %defattr(-,root,root) %{_libdir}/libQt5XdgIconLoader.so.3 -%{_libdir}/libQt5XdgIconLoader.so.3.1.0 +%{_libdir}/libQt5XdgIconLoader.so.3.2.0 %files -n libQt5XdgIconLoader-devel %defattr(-,root,root) %dir %{_includedir}/qt5xdgiconloader -%dir %{_includedir}/qt5xdgiconloader/3.1.0 -%dir %{_includedir}/qt5xdgiconloader/3.1.0/private -%dir %{_includedir}/qt5xdgiconloader/3.1.0/private/xdgiconloader +%dir %{_includedir}/qt5xdgiconloader/3.2.0 +%dir %{_includedir}/qt5xdgiconloader/3.2.0/private +%dir %{_includedir}/qt5xdgiconloader/3.2.0/private/xdgiconloader %dir %{_datadir}/cmake/qt5xdgiconloader %{_libdir}/libQt5XdgIconLoader.so %{_libdir}/qt5/plugins/iconengines/libQt5XdgIconPlugin.so -%{_includedir}/qt5xdgiconloader/3.1.0/private/xdgiconloader/xdgiconloader_p.h +%{_includedir}/qt5xdgiconloader/3.2.0/private/xdgiconloader/xdgiconloader_p.h %{_includedir}/qt5xdgiconloader/xdgiconloader_export.h %{_libdir}/pkgconfig/Qt5XdgIconLoader.pc %{_datadir}/cmake/qt5xdgiconloader/qt5xdgiconloader-config-version.cmake ++++++ libqtxdg-3.1.0.tar.xz -> libqtxdg-3.2.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.1.0/AUTHORS new/libqtxdg-3.2.0/AUTHORS --- old/libqtxdg-3.1.0/AUTHORS 2017-10-21 20:49:05.000000000 +0200 +++ new/libqtxdg-3.2.0/AUTHORS 2018-05-21 19:03:32.000000000 +0200 @@ -1,10 +1,10 @@ Upstream Authors: - LXQt team: http://lxqt.org + LXQt team: https://lxqt.org Razor team: http://razor-qt.org Copyright: Copyright (c) 2010-2012 Razor team - Copyright (c) 2012-2017 LXQt team + Copyright (c) 2012-2018 LXQt team License: LGPL-2.1+ and LGPL-2.1-or-3-with-Digia-1.1-exception The full text of the LGPL-2.1+ license can be found in the 'COPYING' file. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.1.0/CHANGELOG new/libqtxdg-3.2.0/CHANGELOG --- old/libqtxdg-3.1.0/CHANGELOG 2017-10-21 20:49:05.000000000 +0200 +++ new/libqtxdg-3.2.0/CHANGELOG 2018-05-21 19:03:32.000000000 +0200 @@ -1,7 +1,29 @@ -libqtxdg-3.1.0 / 2017-10-21 +libqtxdg-3.2.0 / 2018-05-21 =========================== + * Bump minor version to 2 + * xdgaction: Remove unneeded processEvents() call + * CMake: Prevent in-source builds + * Set genericName as tooltip + * Use Qt5 new signal slot syntax + * Fixed project uris to https://lxqt.org + * Fix some lxde mentions + * fixup...correct context object for disconnection + * fixup...only one watcher object & invalidate key + * xdgiconloader: Add GTK cache revalidation + * xdgiconloader: Cache ScalableFollowsColorEntry properly + * Prevent a possible container detach + * Fixed a typo in searching gtk icon cache + * Normalize signal/slot signatures + * Fix symbolic SVG icons with Qt5.10 + * Don't allow Q_FOREACH to be used + * xdgdesktopfile: Fix typo made in 24c9845 + +3.1.0 / 2017-10-21 +================== + + * Release 3.1.0: Update changelog * Bump version to 3.1.0 * xdgdesktopfile: Add API for getting actions info * xdgdesktopfile: Add support for activating actions diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.1.0/CMakeLists.txt new/libqtxdg-3.2.0/CMakeLists.txt --- old/libqtxdg-3.1.0/CMakeLists.txt 2017-10-21 20:49:05.000000000 +0200 +++ new/libqtxdg-3.2.0/CMakeLists.txt 2018-05-21 19:03:32.000000000 +0200 @@ -26,7 +26,7 @@ endif() set(QTXDG_MAJOR_VERSION 3) -set(QTXDG_MINOR_VERSION 1) +set(QTXDG_MINOR_VERSION 2) set(QTXDG_PATCH_VERSION 0) set(QTXDG_VERSION_STRING ${QTXDG_MAJOR_VERSION}.${QTXDG_MINOR_VERSION}.${QTXDG_PATCH_VERSION}) @@ -35,6 +35,7 @@ include(GNUInstallDirs) # Standard directories for installation include(CMakePackageConfigHelpers) include(GenerateExportHeader) +include(prevent_in_source_builds) include(create_portable_headers) include(create_pkgconfig_file) include(compiler_settings NO_POLICY_SCOPE) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.1.0/cmake/compiler_settings.cmake new/libqtxdg-3.2.0/cmake/compiler_settings.cmake --- old/libqtxdg-3.1.0/cmake/compiler_settings.cmake 2017-10-21 20:49:05.000000000 +0200 +++ new/libqtxdg-3.2.0/cmake/compiler_settings.cmake 2018-05-21 19:03:32.000000000 +0200 @@ -118,6 +118,7 @@ -DQT_NO_CAST_TO_ASCII -DQT_NO_URL_CAST_FROM_STRING -DQT_NO_CAST_FROM_BYTEARRAY + -DQT_NO_FOREACH ) #----------------------------------------------------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.1.0/cmake/prevent_in_source_builds.cmake new/libqtxdg-3.2.0/cmake/prevent_in_source_builds.cmake --- old/libqtxdg-3.1.0/cmake/prevent_in_source_builds.cmake 1970-01-01 01:00:00.000000000 +0100 +++ new/libqtxdg-3.2.0/cmake/prevent_in_source_builds.cmake 2018-05-21 19:03:32.000000000 +0200 @@ -0,0 +1,65 @@ +#============================================================================= +# Copyright (c) 2018 Luís Pereira <[email protected]> +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +function(prevent_in_source_builds) + + # Handle smarties with symlinks + get_filename_component(srcdir "${CMAKE_SOURCE_DIR}" REALPATH) + get_filename_component(bindir "${CMAKE_BINARY_DIR}" REALPATH) + + if("${srcdir}" STREQUAL "${bindir}") + # We are in a in source build + message("##############################################################") + message("# In Source Build detected.") + message("# QtXdg does not support in source builds.") + message("# Out of source build is required.") + message("#") + message("# The general approach to out of source builds is:") + message("# mkdir build") + message("# cd build") + message("# cmake <path to sources>") + message("# make") + message("#") + message("# An in source build was attemped. Some files were created.") + message("# Use 'git status' to check them. Remove them with:") + message("# cd <path to sources>") + message("#") + message("# # Don’t actually remove anything, just show what would be done") + message("# git clean -n -d") + message("#") + message("# # Actually remove the files") + message("# git clean -f -d") + message("#") + message("# checkout files out of the index") + message("# git checkout --") + message("##############################################################") + + message(FATAL_ERROR "Aborting configuration") + endif() +endfunction() + +prevent_in_source_builds() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.1.0/qtxdg/desktopenvironment_p.cpp new/libqtxdg-3.2.0/qtxdg/desktopenvironment_p.cpp --- old/libqtxdg-3.1.0/qtxdg/desktopenvironment_p.cpp 2017-10-21 20:49:05.000000000 +0200 +++ new/libqtxdg-3.2.0/qtxdg/desktopenvironment_p.cpp 2018-05-21 19:03:32.000000000 +0200 @@ -2,7 +2,7 @@ * (c)LGPL2+ * * LXQt - a lightweight, Qt based, desktop toolset - * http://lxqt.org + * https://lxqt.org * * Copyright: 2014 LXQt team * Authors: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.1.0/qtxdg/xdgaction.cpp new/libqtxdg-3.2.0/qtxdg/xdgaction.cpp --- old/libqtxdg-3.1.0/qtxdg/xdgaction.cpp 2017-10-21 20:49:05.000000000 +0200 +++ new/libqtxdg-3.2.0/qtxdg/xdgaction.cpp 2018-05-21 19:03:32.000000000 +0200 @@ -1,8 +1,8 @@ /* BEGIN_COMMON_COPYRIGHT_HEADER * (c)LGPL2+ * - * Razor - a lightweight, Qt based, desktop toolset - * http://razor-qt.org + * LXQt - a lightweight, Qt based, desktop toolset + * https://lxqt.org * * Copyright: 2010-2011 Razor team * Authors: @@ -118,5 +118,4 @@ setIcon(mDesktopFile.icon()); if (icon().isNull()) setIcon(XdgIcon::fromTheme(QLatin1String("application-x-executable"))); - QCoreApplication::processEvents(); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.1.0/qtxdg/xdgaction.h new/libqtxdg-3.2.0/qtxdg/xdgaction.h --- old/libqtxdg-3.1.0/qtxdg/xdgaction.h 2017-10-21 20:49:05.000000000 +0200 +++ new/libqtxdg-3.2.0/qtxdg/xdgaction.h 2018-05-21 19:03:32.000000000 +0200 @@ -1,8 +1,8 @@ /* BEGIN_COMMON_COPYRIGHT_HEADER * (c)LGPL2+ * - * Razor - a lightweight, Qt based, desktop toolset - * http://razor-qt.org + * LXQt - a lightweight, Qt based, desktop toolset + * https://lxqt.org * * Copyright: 2010-2011 Razor team * Authors: @@ -71,9 +71,11 @@ const XdgDesktopFile& desktopFile() const { return mDesktopFile; } +public Q_SLOTS: + void updateIcon(); + private Q_SLOTS: void runConmmand() const; - void updateIcon(); private: void load(const XdgDesktopFile& desktopFile); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.1.0/qtxdg/xdgautostart.cpp new/libqtxdg-3.2.0/qtxdg/xdgautostart.cpp --- old/libqtxdg-3.1.0/qtxdg/xdgautostart.cpp 2017-10-21 20:49:05.000000000 +0200 +++ new/libqtxdg-3.2.0/qtxdg/xdgautostart.cpp 2018-05-21 19:03:32.000000000 +0200 @@ -1,8 +1,8 @@ /* BEGIN_COMMON_COPYRIGHT_HEADER * (c)LGPL2+ * - * Razor - a lightweight, Qt based, desktop toolset - * http://razor-qt.org + * LXQt - a lightweight, Qt based, desktop toolset + * https://lxqt.org * * Copyright: 2012 Razor team * Authors: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.1.0/qtxdg/xdgautostart.h new/libqtxdg-3.2.0/qtxdg/xdgautostart.h --- old/libqtxdg-3.1.0/qtxdg/xdgautostart.h 2017-10-21 20:49:05.000000000 +0200 +++ new/libqtxdg-3.2.0/qtxdg/xdgautostart.h 2018-05-21 19:03:32.000000000 +0200 @@ -1,8 +1,8 @@ /* BEGIN_COMMON_COPYRIGHT_HEADER * (c)LGPL2+ * - * Razor - a lightweight, Qt based, desktop toolset - * http://razor-qt.org + * LXQt - a lightweight, Qt based, desktop toolset + * https://lxqt.org * * Copyright: 2012 Razor team * Authors: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.1.0/qtxdg/xdgdesktopfile.cpp new/libqtxdg-3.2.0/qtxdg/xdgdesktopfile.cpp --- old/libqtxdg-3.1.0/qtxdg/xdgdesktopfile.cpp 2017-10-21 20:49:05.000000000 +0200 +++ new/libqtxdg-3.2.0/qtxdg/xdgdesktopfile.cpp 2018-05-21 19:03:32.000000000 +0200 @@ -1,8 +1,8 @@ /* BEGIN_COMMON_COPYRIGHT_HEADER * (c)LGPL2+ * - * Razor - a lightweight, Qt based, desktop toolset - * http://razor-qt.org + * LXQt - a lightweight, Qt based, desktop toolset + * https://lxqt.org * * Copyright: 2010-2011 Razor team * Authors: @@ -463,7 +463,8 @@ if (started) { QProcess* proc = p.take(); //release the pointer(will be selfdestroyed upon finish) - QObject::connect(proc, SIGNAL(finished(int, QProcess::ExitStatus)), proc, SLOT(deleteLater())); + QObject::connect(proc, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished), + proc, &QProcess::deleteLater); } return started; } @@ -527,7 +528,7 @@ //Note: after the QDBusInterface construction, it can *invalid* (has reasonable lastError()) // but this can be due to some intermediate DBus call(s) which doesn't need to be fatal and // our next call() can succeed - // see discussion https://github.com/lxde/libqtxdg/pull/75 + // see discussion https://github.com/lxqt/libqtxdg/pull/75 if (app.lastError().isValid()) { qWarning().noquote() << "XdgDesktopFileData::startByDBus: invalid interface:" << app.lastError().message() @@ -558,7 +559,7 @@ return QStringList(); } - return q->value(key).toString().split(QLatin1Char(';'), QString::SkipEmptyParts); + return q->value(used_key).toString().split(QLatin1Char(';'), QString::SkipEmptyParts); } @@ -1518,7 +1519,8 @@ } else /* if (isStringList) */ { - for (const QString &value: it.value().toStringList()) + const auto values = it.value().toStringList(); + for (const QString &value : values) { stream << value << QLatin1Char(';'); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.1.0/qtxdg/xdgdesktopfile.h new/libqtxdg-3.2.0/qtxdg/xdgdesktopfile.h --- old/libqtxdg-3.1.0/qtxdg/xdgdesktopfile.h 2017-10-21 20:49:05.000000000 +0200 +++ new/libqtxdg-3.2.0/qtxdg/xdgdesktopfile.h 2018-05-21 19:03:32.000000000 +0200 @@ -1,8 +1,8 @@ /* BEGIN_COMMON_COPYRIGHT_HEADER * (c)LGPL2+ * - * Razor - a lightweight, Qt based, desktop toolset - * http://razor-qt.org + * LXQt - a lightweight, Qt based, desktop toolset + * https://lxqt.org * * Copyright: 2010-2011 Razor team * Authors: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.1.0/qtxdg/xdgdesktopfile_p.h new/libqtxdg-3.2.0/qtxdg/xdgdesktopfile_p.h --- old/libqtxdg-3.1.0/qtxdg/xdgdesktopfile_p.h 2017-10-21 20:49:05.000000000 +0200 +++ new/libqtxdg-3.2.0/qtxdg/xdgdesktopfile_p.h 2018-05-21 19:03:32.000000000 +0200 @@ -2,7 +2,7 @@ * (c)LGPL2+ * * LXQt - a lightweight, Qt based, desktop toolset - * http://lxqt.org + * https://lxqt.org * * Copyright: 2015 LXQt team * Authors: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.1.0/qtxdg/xdgdirs.cpp new/libqtxdg-3.2.0/qtxdg/xdgdirs.cpp --- old/libqtxdg-3.1.0/qtxdg/xdgdirs.cpp 2017-10-21 20:49:05.000000000 +0200 +++ new/libqtxdg-3.2.0/qtxdg/xdgdirs.cpp 2018-05-21 19:03:32.000000000 +0200 @@ -1,8 +1,8 @@ /* BEGIN_COMMON_COPYRIGHT_HEADER * (c)LGPL2+ * - * Razor - a lightweight, Qt based, desktop toolset - * http://razor-qt.org + * LXQt - a lightweight, Qt based, desktop toolset + * https://lxqt.org * * Copyright: 2010-2011 Razor team * Authors: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.1.0/qtxdg/xdgdirs.h new/libqtxdg-3.2.0/qtxdg/xdgdirs.h --- old/libqtxdg-3.1.0/qtxdg/xdgdirs.h 2017-10-21 20:49:05.000000000 +0200 +++ new/libqtxdg-3.2.0/qtxdg/xdgdirs.h 2018-05-21 19:03:32.000000000 +0200 @@ -1,8 +1,8 @@ /* BEGIN_COMMON_COPYRIGHT_HEADER * (c)LGPL2+ * - * Razor - a lightweight, Qt based, desktop toolset - * http://razor-qt.org + * LXQt - a lightweight, Qt based, desktop toolset + * https://lxqt.org * * Copyright: 2010-2011 Razor team * Authors: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.1.0/qtxdg/xdgicon.cpp new/libqtxdg-3.2.0/qtxdg/xdgicon.cpp --- old/libqtxdg-3.1.0/qtxdg/xdgicon.cpp 2017-10-21 20:49:05.000000000 +0200 +++ new/libqtxdg-3.2.0/qtxdg/xdgicon.cpp 2018-05-21 19:03:32.000000000 +0200 @@ -1,8 +1,8 @@ /* BEGIN_COMMON_COPYRIGHT_HEADER * (c)LGPL2+ * - * Razor - a lightweight, Qt based, desktop toolset - * http://razor-qt.org + * LXQt - a lightweight, Qt based, desktop toolset + * https://lxqt.org * * Copyright: 2010-2011 Razor team * Authors: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.1.0/qtxdg/xdgicon.h new/libqtxdg-3.2.0/qtxdg/xdgicon.h --- old/libqtxdg-3.1.0/qtxdg/xdgicon.h 2017-10-21 20:49:05.000000000 +0200 +++ new/libqtxdg-3.2.0/qtxdg/xdgicon.h 2018-05-21 19:03:32.000000000 +0200 @@ -1,8 +1,8 @@ /* BEGIN_COMMON_COPYRIGHT_HEADER * (c)LGPL2+ * - * Razor - a lightweight, Qt based, desktop toolset - * http://razor-qt.org + * LXQt - a lightweight, Qt based, desktop toolset + * https://lxqt.org * * Copyright: 2010-2011 Razor team * Authors: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.1.0/qtxdg/xdgmenu.cpp new/libqtxdg-3.2.0/qtxdg/xdgmenu.cpp --- old/libqtxdg-3.1.0/qtxdg/xdgmenu.cpp 2017-10-21 20:49:05.000000000 +0200 +++ new/libqtxdg-3.2.0/qtxdg/xdgmenu.cpp 2018-05-21 19:03:32.000000000 +0200 @@ -1,8 +1,8 @@ /* BEGIN_COMMON_COPYRIGHT_HEADER * (c)LGPL2+ * - * Razor - a lightweight, Qt based, desktop toolset - * http://razor-qt.org + * LXQt - a lightweight, Qt based, desktop toolset + * https://lxqt.org * * Copyright: 2010-2011 Razor team * Authors: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.1.0/qtxdg/xdgmenu.h new/libqtxdg-3.2.0/qtxdg/xdgmenu.h --- old/libqtxdg-3.1.0/qtxdg/xdgmenu.h 2017-10-21 20:49:05.000000000 +0200 +++ new/libqtxdg-3.2.0/qtxdg/xdgmenu.h 2018-05-21 19:03:32.000000000 +0200 @@ -1,8 +1,8 @@ /* BEGIN_COMMON_COPYRIGHT_HEADER * (c)LGPL2+ * - * Razor - a lightweight, Qt based, desktop toolset - * http://razor-qt.org + * LXQt - a lightweight, Qt based, desktop toolset + * https://lxqt.org * * Copyright: 2010-2011 Razor team * Authors: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.1.0/qtxdg/xdgmenu_p.h new/libqtxdg-3.2.0/qtxdg/xdgmenu_p.h --- old/libqtxdg-3.1.0/qtxdg/xdgmenu_p.h 2017-10-21 20:49:05.000000000 +0200 +++ new/libqtxdg-3.2.0/qtxdg/xdgmenu_p.h 2018-05-21 19:03:32.000000000 +0200 @@ -1,8 +1,8 @@ /* BEGIN_COMMON_COPYRIGHT_HEADER * (c)LGPL2+ * - * Razor - a lightweight, Qt based, desktop toolset - * http://razor-qt.org + * LXQt - a lightweight, Qt based, desktop toolset + * https://lxqt.org * * Copyright: 2010-2011 Razor team * Authors: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.1.0/qtxdg/xdgmenuapplinkprocessor.cpp new/libqtxdg-3.2.0/qtxdg/xdgmenuapplinkprocessor.cpp --- old/libqtxdg-3.1.0/qtxdg/xdgmenuapplinkprocessor.cpp 2017-10-21 20:49:05.000000000 +0200 +++ new/libqtxdg-3.2.0/qtxdg/xdgmenuapplinkprocessor.cpp 2018-05-21 19:03:32.000000000 +0200 @@ -1,8 +1,8 @@ /* BEGIN_COMMON_COPYRIGHT_HEADER * (c)LGPL2+ * - * Razor - a lightweight, Qt based, desktop toolset - * http://razor-qt.org + * LXQt - a lightweight, Qt based, desktop toolset + * https://lxqt.org * * Copyright: 2010-2011 Razor team * Authors: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.1.0/qtxdg/xdgmenuapplinkprocessor.h new/libqtxdg-3.2.0/qtxdg/xdgmenuapplinkprocessor.h --- old/libqtxdg-3.1.0/qtxdg/xdgmenuapplinkprocessor.h 2017-10-21 20:49:05.000000000 +0200 +++ new/libqtxdg-3.2.0/qtxdg/xdgmenuapplinkprocessor.h 2018-05-21 19:03:32.000000000 +0200 @@ -1,8 +1,8 @@ /* BEGIN_COMMON_COPYRIGHT_HEADER * (c)LGPL2+ * - * Razor - a lightweight, Qt based, desktop toolset - * http://razor-qt.org + * LXQt - a lightweight, Qt based, desktop toolset + * https://lxqt.org * * Copyright: 2010-2011 Razor team * Authors: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.1.0/qtxdg/xdgmenulayoutprocessor.cpp new/libqtxdg-3.2.0/qtxdg/xdgmenulayoutprocessor.cpp --- old/libqtxdg-3.1.0/qtxdg/xdgmenulayoutprocessor.cpp 2017-10-21 20:49:05.000000000 +0200 +++ new/libqtxdg-3.2.0/qtxdg/xdgmenulayoutprocessor.cpp 2018-05-21 19:03:32.000000000 +0200 @@ -1,8 +1,8 @@ /* BEGIN_COMMON_COPYRIGHT_HEADER * (c)LGPL2+ * - * Razor - a lightweight, Qt based, desktop toolset - * http://razor-qt.org + * LXQt - a lightweight, Qt based, desktop toolset + * https://lxqt.org * * Copyright: 2010-2011 Razor team * Authors: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.1.0/qtxdg/xdgmenulayoutprocessor.h new/libqtxdg-3.2.0/qtxdg/xdgmenulayoutprocessor.h --- old/libqtxdg-3.1.0/qtxdg/xdgmenulayoutprocessor.h 2017-10-21 20:49:05.000000000 +0200 +++ new/libqtxdg-3.2.0/qtxdg/xdgmenulayoutprocessor.h 2018-05-21 19:03:32.000000000 +0200 @@ -1,8 +1,8 @@ /* BEGIN_COMMON_COPYRIGHT_HEADER * (c)LGPL2+ * - * Razor - a lightweight, Qt based, desktop toolset - * http://razor-qt.org + * LXQt - a lightweight, Qt based, desktop toolset + * https://lxqt.org * * Copyright: 2010-2011 Razor team * Authors: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.1.0/qtxdg/xdgmenureader.cpp new/libqtxdg-3.2.0/qtxdg/xdgmenureader.cpp --- old/libqtxdg-3.1.0/qtxdg/xdgmenureader.cpp 2017-10-21 20:49:05.000000000 +0200 +++ new/libqtxdg-3.2.0/qtxdg/xdgmenureader.cpp 2018-05-21 19:03:32.000000000 +0200 @@ -1,8 +1,8 @@ /* BEGIN_COMMON_COPYRIGHT_HEADER * (c)LGPL2+ * - * Razor - a lightweight, Qt based, desktop toolset - * http://razor-qt.org + * LXQt - a lightweight, Qt based, desktop toolset + * https://lxqt.org * * Copyright: 2010-2011 Razor team * Authors: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.1.0/qtxdg/xdgmenureader.h new/libqtxdg-3.2.0/qtxdg/xdgmenureader.h --- old/libqtxdg-3.1.0/qtxdg/xdgmenureader.h 2017-10-21 20:49:05.000000000 +0200 +++ new/libqtxdg-3.2.0/qtxdg/xdgmenureader.h 2018-05-21 19:03:32.000000000 +0200 @@ -1,8 +1,8 @@ /* BEGIN_COMMON_COPYRIGHT_HEADER * (c)LGPL2+ * - * Razor - a lightweight, Qt based, desktop toolset - * http://razor-qt.org + * LXQt - a lightweight, Qt based, desktop toolset + * https://lxqt.org * * Copyright: 2010-2011 Razor team * Authors: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.1.0/qtxdg/xdgmenurules.cpp new/libqtxdg-3.2.0/qtxdg/xdgmenurules.cpp --- old/libqtxdg-3.1.0/qtxdg/xdgmenurules.cpp 2017-10-21 20:49:05.000000000 +0200 +++ new/libqtxdg-3.2.0/qtxdg/xdgmenurules.cpp 2018-05-21 19:03:32.000000000 +0200 @@ -1,8 +1,8 @@ /* BEGIN_COMMON_COPYRIGHT_HEADER * (c)LGPL2+ * - * Razor - a lightweight, Qt based, desktop toolset - * http://razor-qt.org + * LXQt - a lightweight, Qt based, desktop toolset + * https://lxqt.org * * Copyright: 2010-2011 Razor team * Authors: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.1.0/qtxdg/xdgmenurules.h new/libqtxdg-3.2.0/qtxdg/xdgmenurules.h --- old/libqtxdg-3.1.0/qtxdg/xdgmenurules.h 2017-10-21 20:49:05.000000000 +0200 +++ new/libqtxdg-3.2.0/qtxdg/xdgmenurules.h 2018-05-21 19:03:32.000000000 +0200 @@ -1,8 +1,8 @@ /* BEGIN_COMMON_COPYRIGHT_HEADER * (c)LGPL2+ * - * Razor - a lightweight, Qt based, desktop toolset - * http://razor-qt.org + * LXQt - a lightweight, Qt based, desktop toolset + * https://lxqt.org * * Copyright: 2010-2011 Razor team * Authors: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.1.0/qtxdg/xdgmenuwidget.cpp new/libqtxdg-3.2.0/qtxdg/xdgmenuwidget.cpp --- old/libqtxdg-3.1.0/qtxdg/xdgmenuwidget.cpp 2017-10-21 20:49:05.000000000 +0200 +++ new/libqtxdg-3.2.0/qtxdg/xdgmenuwidget.cpp 2018-05-21 19:03:32.000000000 +0200 @@ -1,8 +1,8 @@ /* BEGIN_COMMON_COPYRIGHT_HEADER * (c)LGPL2+ * - * Razor - a lightweight, Qt based, desktop toolset - * http://razor-qt.org + * LXQt - a lightweight, Qt based, desktop toolset + * https://lxqt.org * * Copyright: 2010-2011 Razor team * Authors: @@ -105,7 +105,8 @@ title = xml.attribute(QLatin1String("name")); q->setTitle(escape(title)); - q->setToolTip(xml.attribute(QLatin1String("comment"))); + //q->setToolTip(xml.attribute(QLatin1String("comment"))); + q->setToolTipsVisible(true); QIcon parentIcon; @@ -221,12 +222,12 @@ else title = xml.attribute(QLatin1String("name")); + action->setText(escape(title)); if (!xml.attribute(QLatin1String("genericName")).isEmpty() && xml.attribute(QLatin1String("genericName")) != title) - title += QString::fromLatin1(" (%1)").arg(xml.attribute(QLatin1String("genericName"))); + action->setToolTip(xml.attribute(QLatin1String("genericName"))); - action->setText(escape(title)); return action; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.1.0/qtxdg/xdgmenuwidget.h new/libqtxdg-3.2.0/qtxdg/xdgmenuwidget.h --- old/libqtxdg-3.1.0/qtxdg/xdgmenuwidget.h 2017-10-21 20:49:05.000000000 +0200 +++ new/libqtxdg-3.2.0/qtxdg/xdgmenuwidget.h 2018-05-21 19:03:32.000000000 +0200 @@ -1,8 +1,8 @@ /* BEGIN_COMMON_COPYRIGHT_HEADER * (c)LGPL2+ * - * Razor - a lightweight, Qt based, desktop toolset - * http://razor-qt.org + * LXQt - a lightweight, Qt based, desktop toolset + * https://lxqt.org * * Copyright: 2010-2011 Razor team * Authors: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.1.0/qtxdg/xmlhelper.cpp new/libqtxdg-3.2.0/qtxdg/xmlhelper.cpp --- old/libqtxdg-3.1.0/qtxdg/xmlhelper.cpp 2017-10-21 20:49:05.000000000 +0200 +++ new/libqtxdg-3.2.0/qtxdg/xmlhelper.cpp 2018-05-21 19:03:32.000000000 +0200 @@ -1,8 +1,8 @@ /* BEGIN_COMMON_COPYRIGHT_HEADER * (c)LGPL2+ * - * Razor - a lightweight, Qt based, desktop toolset - * http://razor-qt.org + * LXQt - a lightweight, Qt based, desktop toolset + * https://lxqt.org * * Copyright: 2010-2011 Razor team * Authors: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.1.0/qtxdg/xmlhelper.h new/libqtxdg-3.2.0/qtxdg/xmlhelper.h --- old/libqtxdg-3.1.0/qtxdg/xmlhelper.h 2017-10-21 20:49:05.000000000 +0200 +++ new/libqtxdg-3.2.0/qtxdg/xmlhelper.h 2018-05-21 19:03:32.000000000 +0200 @@ -1,8 +1,8 @@ /* BEGIN_COMMON_COPYRIGHT_HEADER * (c)LGPL2+ * - * Razor - a lightweight, Qt based, desktop toolset - * http://razor-qt.org + * LXQt - a lightweight, Qt based, desktop toolset + * https://lxqt.org * * Copyright: 2010-2011 Razor team * Authors: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.1.0/test/qtxdg_test.cpp new/libqtxdg-3.2.0/test/qtxdg_test.cpp --- old/libqtxdg-3.1.0/test/qtxdg_test.cpp 2017-10-21 20:49:05.000000000 +0200 +++ new/libqtxdg-3.2.0/test/qtxdg_test.cpp 2018-05-21 19:03:32.000000000 +0200 @@ -2,7 +2,7 @@ * (c)LGPL2+ * * LXQt - a lightweight, Qt based, desktop toolset - * http://lxqt.org + * https://lxqt.org * * Copyright: 2013~2015 LXQt team * Authors: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.1.0/test/qtxdg_test.h new/libqtxdg-3.2.0/test/qtxdg_test.h --- old/libqtxdg-3.1.0/test/qtxdg_test.h 2017-10-21 20:49:05.000000000 +0200 +++ new/libqtxdg-3.2.0/test/qtxdg_test.h 2018-05-21 19:03:32.000000000 +0200 @@ -2,7 +2,7 @@ * (c)LGPL2+ * * LXQt - a lightweight, Qt based, desktop toolset - * http://lxqt.org + * https://lxqt.org * * Copyright: 2013~2014 LXQt team * Authors: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.1.0/test/tst_xdgdirs.cpp new/libqtxdg-3.2.0/test/tst_xdgdirs.cpp --- old/libqtxdg-3.1.0/test/tst_xdgdirs.cpp 2017-10-21 20:49:05.000000000 +0200 +++ new/libqtxdg-3.2.0/test/tst_xdgdirs.cpp 2018-05-21 19:03:32.000000000 +0200 @@ -2,7 +2,7 @@ * (c)LGPL2+ * * LXQt - a lightweight, Qt based, desktop toolset - * http://lxqt.org + * https://lxqt.org * * Copyright: 2015 LXQt team * Authors: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.1.0/xdgiconloader/plugin/xdgiconengineplugin.cpp new/libqtxdg-3.2.0/xdgiconloader/plugin/xdgiconengineplugin.cpp --- old/libqtxdg-3.1.0/xdgiconloader/plugin/xdgiconengineplugin.cpp 2017-10-21 20:49:05.000000000 +0200 +++ new/libqtxdg-3.2.0/xdgiconloader/plugin/xdgiconengineplugin.cpp 2018-05-21 19:03:32.000000000 +0200 @@ -2,7 +2,7 @@ * (c)LGPL2+ * * LXQt - a lightweight Qt based desktop - * http://lxqt.org + * https://lxqt.org * * Copyright: 2017 LXQt team * Authors: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.1.0/xdgiconloader/plugin/xdgiconengineplugin.h new/libqtxdg-3.2.0/xdgiconloader/plugin/xdgiconengineplugin.h --- old/libqtxdg-3.1.0/xdgiconloader/plugin/xdgiconengineplugin.h 2017-10-21 20:49:05.000000000 +0200 +++ new/libqtxdg-3.2.0/xdgiconloader/plugin/xdgiconengineplugin.h 2018-05-21 19:03:32.000000000 +0200 @@ -2,7 +2,7 @@ * (c)LGPL2+ * * LXQt - a lightweight Qt based desktop - * http://lxqt.org + * https://lxqt.org * * Copyright: 2017 LXQt team * Authors: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.1.0/xdgiconloader/xdgiconloader.cpp new/libqtxdg-3.2.0/xdgiconloader/xdgiconloader.cpp --- old/libqtxdg-3.1.0/xdgiconloader/xdgiconloader.cpp 2017-10-21 20:49:05.000000000 +0200 +++ new/libqtxdg-3.2.0/xdgiconloader/xdgiconloader.cpp 2018-05-21 19:03:32.000000000 +0200 @@ -48,6 +48,7 @@ #include <QtGui/QPainter> #include <QImageReader> #include <QXmlStreamReader> +#include <QFileSystemWatcher> #ifdef Q_DEAD_CODE_FROM_QT4_MAC #include <private/qt_cocoa_helpers_mac_p.h> @@ -109,7 +110,9 @@ explicit QIconCacheGtkReader(const QString &themeDir); QVector<const char *> lookup(const QStringRef &); bool isValid() const { return m_isValid; } + bool reValid(bool infoRefresh); private: + QFileInfo m_cacheFileInfo; QFile m_file; const unsigned char *m_data; quint64 m_size; @@ -133,38 +136,73 @@ | m_data[offset+1] << 16 | m_data[offset] << 24; } }; +Q_GLOBAL_STATIC(QFileSystemWatcher, gtkCachesWatcher); QIconCacheGtkReader::QIconCacheGtkReader(const QString &dirName) - : m_isValid(false) + : m_cacheFileInfo{dirName + QLatin1String("/icon-theme.cache")} + , m_data(nullptr) + , m_isValid(false) +{ + m_file.setFileName(m_cacheFileInfo.absoluteFilePath()); + // Note: The cache file can be (IS) removed and newly created during the + // cache update. But we hold open file descriptor for the "old" removed + // file. So we need to watch the changes and reopen/remap the file. + QObject::connect(gtkCachesWatcher(), &QFileSystemWatcher::fileChanged, &m_file, [this](const QString & path) + { + if (m_file.fileName() == path) + { + m_isValid = false; + // invalidate icons to reload them ... + QIconLoader::instance()->invalidateKey(); + } + }); + reValid(false); +} + +bool QIconCacheGtkReader::reValid(bool infoRefresh) { - QFileInfo info(dirName + QLatin1String("/icon-theme.cache")); - if (!info.exists() || info.lastModified() < QFileInfo(dirName).lastModified()) - return; - m_file.setFileName(info.absoluteFilePath()); + if (m_data) + m_file.unmap(const_cast<unsigned char *>(m_data)); + m_file.close(); + + if (infoRefresh) + m_cacheFileInfo.refresh(); + + const QDir dir = m_cacheFileInfo.absoluteDir(); + + if (!m_cacheFileInfo.exists() || m_cacheFileInfo.lastModified() < QFileInfo{dir.absolutePath()}.lastModified()) + return m_isValid; + + // Note: If the file is removed, it is also silently removed from watched + // paths in QFileSystemWatcher. + if (!gtkCachesWatcher->files().contains(m_cacheFileInfo.absoluteFilePath())) + gtkCachesWatcher->addPath(m_cacheFileInfo.absoluteFilePath()); + if (!m_file.open(QFile::ReadOnly)) - return; + return m_isValid; m_size = m_file.size(); m_data = m_file.map(0, m_size); if (!m_data) - return; + return m_isValid; if (read16(0) != 1) // VERSION_MAJOR - return; + return m_isValid; m_isValid = true; // Check that all the directories are older than the cache - auto lastModified = info.lastModified(); + auto lastModified = m_cacheFileInfo.lastModified(); quint32 dirListOffset = read32(8); quint32 dirListLen = read32(dirListOffset); for (uint i = 0; i < dirListLen; ++i) { quint32 offset = read32(dirListOffset + 4 + 4 * i); - if (!m_isValid || offset >= m_size || lastModified < QFileInfo(dirName + QLatin1Char('/') - + QString::fromUtf8(reinterpret_cast<const char*>(m_data + offset))).lastModified()) { + if (!m_isValid || offset >= m_size || lastModified < QFileInfo(dir + , QString::fromUtf8(reinterpret_cast<const char*>(m_data + offset))).lastModified()) { m_isValid = false; - return; + return m_isValid; } } + return m_isValid; } static quint32 icon_name_hash(const char *p) @@ -333,8 +371,8 @@ * intentionally. * * Ref. - * https://github.com/lxde/lxqt/issues/1252 - * https://github.com/lxde/libqtxdg/pull/116 + * https://github.com/lxqt/lxqt/issues/1252 + * https://github.com/lxqt/libqtxdg/pull/116 */ QThemeIconInfo XdgIconLoader::findIconHelper(const QString &themeName, const QString &iconName, @@ -379,7 +417,7 @@ // Try to reduce the amount of subDirs by looking in the GTK+ cache in order to save // a massive amount of file stat (especially if the icon is not there) auto cache = theme.m_gtkCaches.at(i); - if (cache->isValid()) { + if (cache->isValid() || cache->reValid(true)) { const auto result = cache->lookup(iconNameFallback); if (cache->isValid()) { const QVector<QIconDirInfo> subDirsCopy = subDirs; @@ -786,81 +824,87 @@ } -// XXX: duplicated from qicon.cpp, because the symbol qt_iconEngineFactoryLoader isn't exported :( -Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, qt_iconEngineFactoryLoader, - (QIconEngineFactoryInterface_iid, QLatin1String("/iconengines"), Qt::CaseInsensitive)) -//extern QFactoryLoader *qt_iconEngineFactoryLoader(); // qicon.cpp - QPixmap ScalableFollowsColorEntry::pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) { - QIcon & icon = QIcon::Selected == mode ? svgSelectedIcon : svgIcon; - if (icon.isNull()) + QPixmap pm = svgIcon.pixmap(size, mode, state); + // Note: not checking the QIcon::isNull(), because in Qt5.10 the isNull() is not reliable + // for svg icons desierialized from stream (see https://codereview.qt-project.org/#/c/216086/) + if (pm.isNull()) { // The following lines are adapted and updated from KDE's "kiconloader.cpp" -> // KIconLoaderPrivate::processSvg() and KIconLoaderPrivate::createIconImage(). // They read the SVG color scheme of SVG icons and give images based on the icon mode. - QByteArray processedContents; - QFile device{filename};; + QHash<int, QByteArray> svg_buffers; + QFile device{filename}; if (device.open(QIODevice::ReadOnly)) { const QPalette pal = qApp->palette(); - QString styleSheet = QStringLiteral(".ColorScheme-Text{color:%1;}") - .arg(mode == QIcon::Selected - ? pal.highlightedText().color().name() - : pal.windowText().color().name()); + // Note: indexes are assembled as in qtsvg (QSvgIconEnginePrivate::hashKey()) + QMap<int, QString> style_sheets; + style_sheets[(QIcon::Normal<<4)|QIcon::Off] = QStringLiteral(".ColorScheme-Text{color:%1;}").arg(pal.windowText().color().name()); + style_sheets[(QIcon::Selected<<4)|QIcon::Off] = QStringLiteral(".ColorScheme-Text{color:%1;}").arg(pal.highlightedText().color().name()); + QMap<int, QSharedPointer<QXmlStreamWriter> > writers; + for (auto i = style_sheets.cbegin(); i != style_sheets.cend(); ++i) + { + writers[i.key()].reset(new QXmlStreamWriter{&svg_buffers[i.key()]}); + } + QXmlStreamReader xmlReader(&device); - QXmlStreamWriter writer(&processedContents); while (!xmlReader.atEnd()) { if (xmlReader.readNext() == QXmlStreamReader::StartElement && xmlReader.qualifiedName() == QLatin1String("style") && xmlReader.attributes().value(QLatin1String("id")) == QLatin1String("current-color-scheme")) { - writer.writeStartElement(QLatin1String("style")); - writer.writeAttributes(xmlReader.attributes()); - writer.writeCharacters(styleSheet); - writer.writeEndElement(); + for (auto i = style_sheets.cbegin(); i != style_sheets.cend(); ++i) + { + QXmlStreamWriter & writer = *writers[i.key()]; + writer.writeStartElement(QLatin1String("style")); + writer.writeAttributes(xmlReader.attributes()); + writer.writeCharacters(*i); + writer.writeEndElement(); + } while (xmlReader.tokenType() != QXmlStreamReader::EndElement) xmlReader.readNext(); + } else if (xmlReader.tokenType() != QXmlStreamReader::Invalid) + { + for (auto i = style_sheets.cbegin(); i != style_sheets.cend(); ++i) + { + writers[i.key()]->writeCurrentToken(xmlReader); + } } - else if (xmlReader.tokenType() != QXmlStreamReader::Invalid) - writer.writeCurrentToken(xmlReader); } + // duplicate the contets also for opposite state + svg_buffers[(QIcon::Normal<<4)|QIcon::On] = svg_buffers[(QIcon::Normal<<4)|QIcon::Off]; + svg_buffers[(QIcon::Selected<<4)|QIcon::On] = svg_buffers[(QIcon::Selected<<4)|QIcon::Off]; } // use the QSvgIconEngine - // - assemble the content as it is done by the QSvgIconEngine::write() (operator <<) - // - create the QIcon with QSvgIconEngine initialized from the content - const int index = qt_iconEngineFactoryLoader()->indexOf(QStringLiteral("svg")); - if (index != -1) - { - if (QIconEnginePlugin * factory = qobject_cast<QIconEnginePlugin*>(qt_iconEngineFactoryLoader()->instance(index))) - { - if (QIconEngine * engine = factory->create()) - { - QByteArray engine_arr; - QDataStream str{&engine_arr, QIODevice::WriteOnly}; - str.setVersion(QDataStream::Qt_4_4); - QHash<int, QString> filenames; - filenames[0] = filename; - QHash<int, QByteArray> svg_buffers; - svg_buffers[0] = processedContents; - str << filenames << static_cast<int>(0)/*isCompressed*/ << svg_buffers << static_cast<int>(0)/*hasAddedPimaps*/; + // - assemble the content as it is done by the operator <<(QDataStream &s, const QIcon &icon) + // (the QSvgIconEngine::key() + QSvgIconEngine::write()) + // - create the QIcon from the content by usage of the QIcon::operator >>(QDataStream &s, const QIcon &icon) + // (icon with the (QSvgIconEngine) will be used) + QByteArray icon_arr; + QDataStream str{&icon_arr, QIODevice::WriteOnly}; + str.setVersion(QDataStream::Qt_4_4); + QHash<int, QString> filenames; + filenames[0] = filename; // Note: filenames are ignored in the QSvgIconEngine::read() + str << QStringLiteral("svg") << filenames << static_cast<int>(0)/*isCompressed*/ << svg_buffers << static_cast<int>(0)/*hasAddedPimaps*/; - QDataStream str_read{&engine_arr, QIODevice::ReadOnly}; - str_read.setVersion(QDataStream::Qt_4_4); + QDataStream str_read{&icon_arr, QIODevice::ReadOnly}; + str_read.setVersion(QDataStream::Qt_4_4); - engine->read(str_read); - icon = QIcon{engine}; - } - } - } + str_read >> svgIcon; + pm = svgIcon.pixmap(size, mode, state); // load the icon directly from file, if still null - if (icon.isNull()) - icon = QIcon(filename); + if (pm.isNull()) + { + svgIcon = QIcon(filename); + pm = svgIcon.pixmap(size, mode, state); + } } - return icon.pixmap(size, mode, state); + return pm; } QPixmap XdgIconLoaderEngine::pixmap(const QSize &size, QIcon::Mode mode, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.1.0/xdgiconloader/xdgiconloader_p.h new/libqtxdg-3.2.0/xdgiconloader/xdgiconloader_p.h --- old/libqtxdg-3.1.0/xdgiconloader/xdgiconloader_p.h 2017-10-21 20:49:05.000000000 +0200 +++ new/libqtxdg-3.2.0/xdgiconloader/xdgiconloader_p.h 2018-05-21 19:03:32.000000000 +0200 @@ -64,7 +64,6 @@ struct ScalableFollowsColorEntry : public ScalableEntry { QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) Q_DECL_OVERRIDE; - QIcon svgSelectedIcon; }; //class QIconLoaderEngine : public QIconEngine
