Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package kguiaddons for openSUSE:Factory checked in at 2021-07-15 23:59:38 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kguiaddons (Old) and /work/SRC/openSUSE:Factory/.kguiaddons.new.2625 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "kguiaddons" Thu Jul 15 23:59:38 2021 rev:92 rq:905498 version:5.84.0 Changes: -------- --- /work/SRC/openSUSE:Factory/kguiaddons/kguiaddons.changes 2021-06-16 20:35:28.287184739 +0200 +++ /work/SRC/openSUSE:Factory/.kguiaddons.new.2625/kguiaddons.changes 2021-07-16 00:01:21.765108885 +0200 @@ -1,0 +2,16 @@ +Sun Jul 4 07:45:27 UTC 2021 - Christophe Giboudeaux <christo...@krop.fr> + +- Update to 5.84.0 + * New feature release + * For more details please see: + * https://kde.org/announcements/frameworks/5/5.84.0 +- Changes since 5.83.0: + * Fix build + * Use method that is exposed in Qt6 + * Relicense files away from LGPL-2.0-only + * Relicense file to LGPL-2.0-or-later + * Add information about utilities provided by KGuiAddons + * UrlHandler: fix url concatenation when using docs.kde.org + * Support static builds + +------------------------------------------------------------------- Old: ---- kguiaddons-5.83.0.tar.xz kguiaddons-5.83.0.tar.xz.sig New: ---- kguiaddons-5.84.0.tar.xz kguiaddons-5.84.0.tar.xz.sig ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kguiaddons.spec ++++++ --- /var/tmp/diff_new_pack.CcS0RH/_old 2021-07-16 00:01:22.361104570 +0200 +++ /var/tmp/diff_new_pack.CcS0RH/_new 2021-07-16 00:01:22.365104541 +0200 @@ -17,7 +17,7 @@ %define lname libKF5GuiAddons5 -%define _tar_path 5.83 +%define _tar_path 5.84 # Full KF5 version (e.g. 5.33.0) %{!?_kf5_version: %global _kf5_version %{version}} # Last major and minor KF5 version (e.g. 5.33) @@ -25,7 +25,7 @@ # Only needed for the package signature condition %bcond_without lang Name: kguiaddons -Version: 5.83.0 +Version: 5.84.0 Release: 0 Summary: Utilities for graphical user interfaces License: LGPL-2.1-or-later ++++++ kguiaddons-5.83.0.tar.xz -> kguiaddons-5.84.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kguiaddons-5.83.0/CMakeLists.txt new/kguiaddons-5.84.0/CMakeLists.txt --- old/kguiaddons-5.83.0/CMakeLists.txt 2021-06-05 10:54:28.000000000 +0200 +++ new/kguiaddons-5.84.0/CMakeLists.txt 2021-06-27 23:58:15.000000000 +0200 @@ -1,10 +1,10 @@ cmake_minimum_required(VERSION 3.16) -set(KF_VERSION "5.83.0") # handled by release scripts +set(KF_VERSION "5.84.0") # handled by release scripts project(KGuiAddons VERSION ${KF_VERSION}) include(FeatureSummary) -find_package(ECM 5.83.0 NO_MODULE) +find_package(ECM 5.84.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) @@ -27,6 +27,8 @@ include(KDECMakeSettings) include(KDEGitCommitHooks) +set(CMAKE_C_STANDARD 99) + set(REQUIRED_QT_VERSION 5.15.0) if (WITH_WAYLAND) set(_qtgui_find_components COMPONENTS Private) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kguiaddons-5.83.0/KF5GuiAddonsConfig.cmake.in new/kguiaddons-5.84.0/KF5GuiAddonsConfig.cmake.in --- old/kguiaddons-5.83.0/KF5GuiAddonsConfig.cmake.in 2021-06-05 10:54:28.000000000 +0200 +++ new/kguiaddons-5.84.0/KF5GuiAddonsConfig.cmake.in 2021-06-27 23:58:15.000000000 +0200 @@ -5,6 +5,13 @@ include(CMakeFindDependencyMacro) find_dependency(Qt5Gui @REQUIRED_QT_VERSION@) +if (NOT @BUILD_SHARED_LIBS@) + if (@WITH_WAYLAND@) + find_dependency(Wayland REQUIRED Client) + find_dependency(Qt5WaylandClient) + find_dependency(QtWaylandScanner) + endif() +endif() include("${CMAKE_CURRENT_LIST_DIR}/KF5GuiAddonsTargets.cmake") @PACKAGE_INCLUDE_QCHTARGETS@ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kguiaddons-5.83.0/README.md new/kguiaddons-5.84.0/README.md --- old/kguiaddons-5.83.0/README.md 2021-06-05 10:54:28.000000000 +0200 +++ new/kguiaddons-5.84.0/README.md 2021-06-27 23:58:15.000000000 +0200 @@ -4,6 +4,45 @@ ## Introduction -The KDE GUI addons provide utilities for graphical user interfaces in the areas +The &KDE GUI addons provide utilities for graphical user interfaces in the areas of colors, fonts, text, images, keyboard input. +## Usage + +To use KGuiAddons, you'll want to look for it using + +```cmake +find_package(KF5GuiAddons) +``` + +or its QMake counterpart. + +### Color utilities + +The KColorUtils namespace contains various small utilities to work with colors. KColorCollection provides +handling of color collections ("pallettes"). KColorMimeData adds drag-and-drop and clipboard mimedata +manipulation to QColor objects + +### Text utilities + +KWordWrap is a special word wrapping algorithm that takes beauty into account. It can be used +directly with QPainter or can return the wrapped text in a QString. + +KDateValidator is a QValidator that validates user-entered dates. + +KFontUtils::adaptFontSize() is a function that calculates the biggest font size (in points) +that can be used to draw a text centered in a rectangle using word wrapping. + +### Keyboard utilities + +KeySequenceRecorder is a utility that records a QKeySequence by listening to key events in a window. +This can be used to let the user modify predefined keyboard shortcuts for example. + +### Icon utilities + +KIconUtils contains functions to add overlays on top of a QIcon. + +### Cursor utilities + +KCursorSaver is used to temporarily set a mouse cursor and restore the previous one on destruction. + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kguiaddons-5.83.0/README.md.license new/kguiaddons-5.84.0/README.md.license --- old/kguiaddons-5.83.0/README.md.license 1970-01-01 01:00:00.000000000 +0100 +++ new/kguiaddons-5.84.0/README.md.license 2021-06-27 23:58:15.000000000 +0200 @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2014 Cornelius Schumacher <schumac...@kde.org> +SPDX-FileCopyrightText: 2021 Carl Schwan <carlsch...@kde.org> +SPDX-FileCopyrightText: LGPL-2.1-or-later diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kguiaddons-5.83.0/autotests/CMakeLists.txt new/kguiaddons-5.84.0/autotests/CMakeLists.txt --- old/kguiaddons-5.83.0/autotests/CMakeLists.txt 2021-06-05 10:54:28.000000000 +0200 +++ new/kguiaddons-5.84.0/autotests/CMakeLists.txt 2021-06-27 23:58:15.000000000 +0200 @@ -10,5 +10,6 @@ kiconutilstest.cpp kcursorsavertest.cpp keysequencerecordertest.cpp + kurlhandlertest.cpp LINK_LIBRARIES KF5::GuiAddons Qt5::Test ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kguiaddons-5.83.0/autotests/kurlhandlertest.cpp new/kguiaddons-5.84.0/autotests/kurlhandlertest.cpp --- old/kguiaddons-5.83.0/autotests/kurlhandlertest.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/kguiaddons-5.84.0/autotests/kurlhandlertest.cpp 2021-06-27 23:58:15.000000000 +0200 @@ -0,0 +1,58 @@ +/* + SPDX-FileCopyrightText: 2021 Ahmad Samir <a.samir...@gmail.com> + + SPDX-License-Identifier: LGPL-2.0-or-later + */ + +#include "kurlhandlertest.h" + +#include "kurlhandler_p.h" + +#include <QTest> + +void KUrlHandlerTest::testOpeningDocsUrls_data() +{ + QTest::addColumn<QString>("appname"); + QTest::addColumn<QString>("helpUrl"); + QTest::addColumn<QString>("expected"); + + const QString common = "https://docs.kde.org/index.php?branch=stable5&language=" + QLocale().name(); + + QTest::newRow("okular-help-handbook") << "okular" + << "help:/" << common + "&application=okular&path=index.html"; + + QTest::newRow("okular-help-config-dialog") << "okular" + << "help:/okular/configure.html" << common + "&application=okular&path=configure.html"; + + QTest::newRow("systemsettings-fonts") << "systemsettings" + << "help:/kcontrol/fonts/index.html" << common + "&application=kcontrol/fonts&path=index.html"; + + QTest::newRow("systemsettings-clock") << "systemsettings" + << "help:/kcontrol/clock/index.html" << common + "&application=kcontrol/clock&path=index.html"; + + QTest::newRow("systemsettings-powerdevil") << "systemsettings" + << "help:/kcontrol/powerdevil/index.html#advanced-settings" + << common + "&application=kcontrol/powerdevil&path=index.html#advanced-settings"; + + QTest::newRow("with-fragment") << "kinfocenter" + << "help:/kinfocenter/index.html#kcm_memory" << common + "&application=kinfocenter&path=kcm_memory.html"; + + QTest::newRow("with-fragment-2") << "okular" + << "help:/okular/signatures.html#adding_digital_signatures" + << common + "&application=okular&path=signatures.html#adding_digital_signatures"; +} + +void KUrlHandlerTest::testOpeningDocsUrls() +{ + QFETCH(QString, appname); + QFETCH(QString, helpUrl); + QFETCH(QString, expected); + + QCoreApplication::setOrganizationDomain(QStringLiteral("kde.org")); + QCoreApplication::setApplicationName(appname); + + const QUrl actual = KUrlHandler().concatDocsUrl(QUrl(helpUrl)); + QCOMPARE(actual, QUrl(expected)); +} + +QTEST_MAIN(KUrlHandlerTest) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kguiaddons-5.83.0/autotests/kurlhandlertest.h new/kguiaddons-5.84.0/autotests/kurlhandlertest.h --- old/kguiaddons-5.83.0/autotests/kurlhandlertest.h 1970-01-01 01:00:00.000000000 +0100 +++ new/kguiaddons-5.84.0/autotests/kurlhandlertest.h 2021-06-27 23:58:15.000000000 +0200 @@ -0,0 +1,21 @@ +/* + SPDX-FileCopyrightText: 2021 Ahmad Samir <a.samir...@gmail.com> + + SPDX-License-Identifier: LGPL-2.0-or-later + */ + +#ifndef KURLHANDLERTEST_H +#define KURLHANDLERTEST_H + +#include <QObject> + +class KUrlHandlerTest : public QObject +{ + Q_OBJECT + +private Q_SLOTS: + void testOpeningDocsUrls_data(); + void testOpeningDocsUrls(); +}; + +#endif // KURLHANDLERTEST_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kguiaddons-5.83.0/src/CMakeLists.txt new/kguiaddons-5.84.0/src/CMakeLists.txt --- old/kguiaddons-5.83.0/src/CMakeLists.txt 2021-06-05 10:54:28.000000000 +0200 +++ new/kguiaddons-5.84.0/src/CMakeLists.txt 2021-06-27 23:58:15.000000000 +0200 @@ -1,5 +1,13 @@ +add_library(KF5GuiAddons) +add_library(KF5::GuiAddons ALIAS KF5GuiAddons) + +set_target_properties(KF5GuiAddons PROPERTIES + VERSION ${KGUIADDONS_VERSION} + SOVERSION ${KGUIADDONS_SOVERSION} + EXPORT_NAME GuiAddons +) -set(kguiaddons_LIB_SRCS +target_sources(KF5GuiAddons PRIVATE colors/kcolorspaces.cpp colors/kcolorutils.cpp colors/kcolorcollection.cpp @@ -11,16 +19,13 @@ util/klocalimagecacheimpl.cpp util/kmodifierkeyinfo.cpp util/kmodifierkeyinfoprovider.cpp - util/urlhandler.cpp + util/kurlhandler_p.cpp util/kcursorsaver.cpp recorder/keyboardgrabber.cpp recorder/keysequencerecorder.cpp ) - -set (kguiaddons_LIB_SRCS ${kguiaddons_LIB_SRCS} util/kmodifierkeyinfoprovider.cpp) - -ecm_qt_declare_logging_category(kguiaddons_LIB_SRCS +ecm_qt_declare_logging_category(KF5GuiAddons HEADER kguiaddons_debug.h IDENTIFIER KGUIADDONS_LOG CATEGORY_NAME kf.guiaddons @@ -28,9 +33,8 @@ EXPORT KGUIADDONS ) -add_library(KF5GuiAddons ${kguiaddons_LIB_SRCS}) - if(WITH_WAYLAND) + set(wayland_SRCS) ecm_add_qtwayland_client_protocol(wayland_SRCS PROTOCOL recorder/keyboard-shortcuts-inhibit-unstable-v1.xml BASENAME keyboard-shortcuts-inhibit-unstable-v1 @@ -41,7 +45,6 @@ endif() generate_export_header(KF5GuiAddons BASE_NAME KGuiAddons) -add_library(KF5::GuiAddons ALIAS KF5GuiAddons) set(kguiaddons_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/colors @@ -70,11 +73,6 @@ endif() endif () -set_target_properties(KF5GuiAddons PROPERTIES VERSION ${KGUIADDONS_VERSION} - SOVERSION ${KGUIADDONS_SOVERSION} - EXPORT_NAME GuiAddons -) - ecm_generate_headers(KGuiAddons_HEADERS HEADER_NAMES KColorUtils diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kguiaddons-5.83.0/src/colors/kcolorcollection.cpp new/kguiaddons-5.84.0/src/colors/kcolorcollection.cpp --- old/kguiaddons-5.83.0/src/colors/kcolorcollection.cpp 2021-06-05 10:54:28.000000000 +0200 +++ new/kguiaddons-5.84.0/src/colors/kcolorcollection.cpp 2021-06-27 23:58:15.000000000 +0200 @@ -1,7 +1,7 @@ /* This file is part of the KDE libraries SPDX-FileCopyrightText: 1999 Waldo Bastian <bast...@kde.org> - SPDX-License-Identifier: LGPL-2.0-only + SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL */ // KDE color collection diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kguiaddons-5.83.0/src/colors/kcolorcollection.h new/kguiaddons-5.84.0/src/colors/kcolorcollection.h --- old/kguiaddons-5.83.0/src/colors/kcolorcollection.h 2021-06-05 10:54:28.000000000 +0200 +++ new/kguiaddons-5.84.0/src/colors/kcolorcollection.h 2021-06-27 23:58:15.000000000 +0200 @@ -1,7 +1,7 @@ /* This file is part of the KDE libraries SPDX-FileCopyrightText: 1999 Waldo Bastian <bast...@kde.org> - SPDX-License-Identifier: LGPL-2.0-only + SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL */ // KDE color collection. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kguiaddons-5.83.0/src/recorder/keysequencerecorder.cpp new/kguiaddons-5.84.0/src/recorder/keysequencerecorder.cpp --- old/kguiaddons-5.83.0/src/recorder/keysequencerecorder.cpp 2021-06-05 10:54:28.000000000 +0200 +++ new/kguiaddons-5.84.0/src/recorder/keysequencerecorder.cpp 2021-06-27 23:58:15.000000000 +0200 @@ -21,7 +21,6 @@ #include <QWindow> #include <array> -#include <memory> constexpr Qt::KeyboardModifiers modifierMask = Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier | Qt::KeypadModifier; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kguiaddons-5.83.0/src/recorder/waylandinhibition.cpp new/kguiaddons-5.84.0/src/recorder/waylandinhibition.cpp --- old/kguiaddons-5.83.0/src/recorder/waylandinhibition.cpp 2021-06-05 10:54:28.000000000 +0200 +++ new/kguiaddons-5.84.0/src/recorder/waylandinhibition.cpp 2021-06-27 23:58:15.000000000 +0200 @@ -7,6 +7,7 @@ #include <QGuiApplication> #include <QtWaylandClient/QWaylandClientExtensionTemplate> +#include <QtWaylandClient/QtWaylandClientVersion> #include <qpa/qplatformnativeinterface.h> #include "qwayland-keyboard-shortcuts-inhibit-unstable-v1.h" @@ -17,9 +18,13 @@ ShortcutsInhibitManager() : QWaylandClientExtensionTemplate<ShortcutsInhibitManager>(1) { +#if QTWAYLANDCLIENT_VERSION >= QT_VERSION_CHECK(6, 2, 0) + initialize(); +#else // QWaylandClientExtensionTemplate invokes this with a QueuedConnection but we want shortcuts // to be inhibited immediately. QMetaObject::invokeMethod(this, "addRegistryListener"); +#endif } ~ShortcutsInhibitManager() { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kguiaddons-5.83.0/src/text/kwordwrap.cpp new/kguiaddons-5.84.0/src/text/kwordwrap.cpp --- old/kguiaddons-5.83.0/src/text/kwordwrap.cpp 2021-06-05 10:54:28.000000000 +0200 +++ new/kguiaddons-5.84.0/src/text/kwordwrap.cpp 2021-06-27 23:58:15.000000000 +0200 @@ -1,7 +1,7 @@ /* This file is part of the KDE libraries SPDX-FileCopyrightText: 2001 David Faure <fa...@kde.org> - SPDX-License-Identifier: LGPL-2.0-only + SPDX-License-Identifier: LGPL-2.0-or-later */ #include "kwordwrap.h" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kguiaddons-5.83.0/src/text/kwordwrap.h new/kguiaddons-5.84.0/src/text/kwordwrap.h --- old/kguiaddons-5.83.0/src/text/kwordwrap.h 2021-06-05 10:54:28.000000000 +0200 +++ new/kguiaddons-5.84.0/src/text/kwordwrap.h 2021-06-27 23:58:15.000000000 +0200 @@ -1,7 +1,7 @@ /* This file is part of the KDE libraries SPDX-FileCopyrightText: 2001 David Faure <fa...@kde.org> - SPDX-License-Identifier: LGPL-2.0-only + SPDX-License-Identifier: LGPL-2.0-or-later */ #ifndef kwordwrap_h diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kguiaddons-5.83.0/src/util/kurlhandler_p.cpp new/kguiaddons-5.84.0/src/util/kurlhandler_p.cpp --- old/kguiaddons-5.83.0/src/util/kurlhandler_p.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/kguiaddons-5.84.0/src/util/kurlhandler_p.cpp 2021-06-27 23:58:15.000000000 +0200 @@ -0,0 +1,127 @@ +/* + SPDX-FileCopyrightText: 2013 Aleix Pol Gonzalez <aleix...@blue-systems.com> + + SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL +*/ + +#include "kurlhandler_p.h" + +#include <kguiaddons_debug.h> + +#include <QCoreApplication> +#include <QDebug> +#include <QDesktopServices> +#include <QLocale> +#include <QProcess> +#include <QStandardPaths> +#include <QUrl> + +static const char s_khelpcenter_exec[] = "khelpcenter"; + +static bool openWithKHelpCenter(const QUrl &url) +{ + const QString helpcenter = QStandardPaths::findExecutable(QString::fromLatin1(s_khelpcenter_exec)); + if (!helpcenter.isEmpty()) { + QUrl u(url); + if (u.path() == QLatin1Char('/')) { + const QString appName = QCoreApplication::applicationName(); + u.setPath(appName); + } + + QProcess::startDetached(helpcenter, QStringList(u.toString())); + return true; + } + + return false; +} + +KUrlHandler::KUrlHandler(QObject *parent) + : QObject(parent) +{ +} + +void KUrlHandler::openHelp(const QUrl &url) const +{ + if (openWithKHelpCenter(url)) { + return; + } + + const QUrl docUrl = concatDocsUrl(url); + if (docUrl.isValid()) { + QDesktopServices::openUrl(docUrl); + } else { + qCWarning(KGUIADDONS_LOG) << "Could not find a suitable handler for" << url.toString(); + } +} + +QUrl KUrlHandler::concatDocsUrl(const QUrl &url) const +{ + if (QCoreApplication::organizationDomain() != QLatin1String("kde.org")) { + return {}; + } + + // KHelpCenter is not available and it's a KDE application, open the docs at docs.kde.org + // with the default web browser on the system + + QString path = url.path(); + const QString fragment = url.fragment(); + const QString common = QLatin1String("https://docs.kde.org/index.php?branch=stable5&language=") + QLocale().name(); + + const QString appName = QCoreApplication::applicationName(); + + // Special case for KCModules + if (appName == QLatin1String("systemsettings") && path.startsWith(QLatin1String("/kcontrol"))) { + // E.g. change "/kcontrol/fonts/index.html" to "&application=kcontrol/fonts&path=index.html" + // docs.kde.org will resolve the url and add the proper package name, e.g. plasma-workspace: + // https://docs.kde.org/stable5/en/plasma-workspace/kcontrol/fonts/index.html + QString kcmAppName(path); + kcmAppName.remove(0, 1); // Remove leading "/" + const int idx = kcmAppName.indexOf(QLatin1String("/index.html")); + if (idx > 0) { + kcmAppName.truncate(idx); + } + + // Some KCModules have a valid fragment, e.g. kcontrol/powerdevil/index.html#advanced-settings + const QString tail = QLatin1String("index.html") + (!fragment.isEmpty() ? QLatin1Char('#') + fragment : QString{}); + + return QUrl(common + QLatin1String("&application=") + kcmAppName + QLatin1String("&path=") + tail); + } + + // E.g. "help:/" and appName is "okular", e.g. opening Help -> Okular HandBook + if (path == QLatin1Char('/')) { + return QUrl(common + QLatin1String("&application=") + appName + QLatin1String("&path=") + QLatin1String("index.html")); + } + + // E.g. "help:/okular/configure.html", don't repeat "appName"; e.g. clicking Help button in + // the "Settings -> Configure Okular" dialog + const QString redundant = QLatin1Char('/') + appName + QLatin1Char('/'); + if (path.startsWith(redundant)) { + path.remove(0, redundant.size()); + + if (!fragment.isEmpty()) { + // E.g. "help:/kinfocenter/index.html#kcm_memory", it's actually "kinfocenter/kcm_memory.html" + if (path == QLatin1String("index.html")) { + qCWarning(KGUIADDONS_LOG) << "X-DocPath entry in a .desktop file in" << appName << "is:" << appName + QLatin1String("/index.html#") + fragment + << ", however it should be:" << appName + QLatin1Char('/') + fragment + QLatin1String(".html"); + + path = fragment + QLatin1String(".html"); + } else { + // E.g. "help:/okular/signatures.html#adding_digital_signatures" + path += QLatin1Char('#') + fragment; + } + } + + return QUrl(common + QLatin1String("&application=") + appName + QLatin1String("&path=") + path); + } + + return {}; +} + +Q_GLOBAL_STATIC(KUrlHandler, s_handler) + +static void initializeGlobalSettings() +{ + QDesktopServices::setUrlHandler(QStringLiteral("help"), s_handler, "openHelp"); +} + +Q_COREAPP_STARTUP_FUNCTION(initializeGlobalSettings) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kguiaddons-5.83.0/src/util/kurlhandler_p.h new/kguiaddons-5.84.0/src/util/kurlhandler_p.h --- old/kguiaddons-5.83.0/src/util/kurlhandler_p.h 1970-01-01 01:00:00.000000000 +0100 +++ new/kguiaddons-5.84.0/src/util/kurlhandler_p.h 2021-06-27 23:58:15.000000000 +0200 @@ -0,0 +1,29 @@ +/* + SPDX-FileCopyrightText: 2021 Ahmad Samir <a.samir...@gmail.com> + + SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL +*/ + +#ifndef KURLHANDLER_P_H +#define KURLHANDLER_P_H + +#include <kguiaddons_export.h> + +#include <QObject> + +class QUrl; + +class KGUIADDONS_EXPORT KUrlHandler : public QObject +{ + Q_OBJECT + +public: + explicit KUrlHandler(QObject *parent = nullptr); + + QUrl concatDocsUrl(const QUrl &url) const; + +public Q_SLOTS: + void openHelp(const QUrl &url) const; +}; + +#endif // KURLHANDLER_P_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kguiaddons-5.83.0/src/util/urlhandler.cpp new/kguiaddons-5.84.0/src/util/urlhandler.cpp --- old/kguiaddons-5.83.0/src/util/urlhandler.cpp 2021-06-05 10:54:28.000000000 +0200 +++ new/kguiaddons-5.84.0/src/util/urlhandler.cpp 1970-01-01 01:00:00.000000000 +0100 @@ -1,72 +0,0 @@ -/* - SPDX-FileCopyrightText: 2013 Aleix Pol Gonzalez <aleix...@blue-systems.com> - - SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL -*/ - -#include <kguiaddons_debug.h> - -#include <QCoreApplication> -#include <QDesktopServices> -#include <QLocale> -#include <QObject> -#include <QProcess> -#include <QStandardPaths> -#include <QUrl> - -class UrlHandler : public QObject -{ - Q_OBJECT -public: - explicit UrlHandler(QObject *parent = nullptr) - : QObject(parent) - { - } - -public Q_SLOTS: - void openHelp(const QUrl &url) - { - const QString appName = QCoreApplication::applicationName(); - - QUrl u(url); - if (u.path() == QLatin1Char('/')) { - u.setPath(appName); - } - - const QString helpcenter = QStandardPaths::findExecutable(QStringLiteral("khelpcenter")); - if (!helpcenter.isEmpty()) { // use khelpcenter if it is available - QProcess::startDetached(helpcenter, QStringList(u.toString())); - return; - } - - // if khelpcenter is not available and it's a KDE application, use docs.kde.org - if (QCoreApplication::organizationDomain() == QLatin1String("kde.org")) { - QString path = url.path(); - QString docPath; - if (appName == QLatin1String("systemsettings") && path.startsWith(QLatin1String("/kcontrol"))) { - // special case for kcm modules - // e.g. "help:/kcontrol/fonts/index.html" >>> "&application=kcontrol/fonts" - docPath = path.remove(0, 1).remove(QLatin1String("/index.html")); - } else { // e.g. "help:/okular", "help:/systemsettings" - docPath = appName + QStringLiteral("&path=") + path; - } - QDesktopServices::openUrl( - QUrl{QLatin1String("https://docs.kde.org/index.php?branch=stable5&language=%1&application=%2").arg(QLocale().name(), docPath)}); - return; - } - - // not a KDE application - qCWarning(KGUIADDONS_LOG) << "Could not find a suitable handler for " << u.toString(); - } -}; - -Q_GLOBAL_STATIC(UrlHandler, s_handler) - -static void initializeGlobalSettings() -{ - QDesktopServices::setUrlHandler(QStringLiteral("help"), s_handler, "openHelp"); -} - -Q_COREAPP_STARTUP_FUNCTION(initializeGlobalSettings) - -#include "urlhandler.moc"