Hello community, here is the log from the commit of package kservice for openSUSE:Factory checked in at 2018-08-24 16:56:10 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kservice (Old) and /work/SRC/openSUSE:Factory/.kservice.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "kservice" Fri Aug 24 16:56:10 2018 rev:61 rq:630634 version:5.49.0 Changes: -------- --- /work/SRC/openSUSE:Factory/kservice/kservice.changes 2018-07-21 10:15:25.731097773 +0200 +++ /work/SRC/openSUSE:Factory/.kservice.new/kservice.changes 2018-08-24 16:56:22.617522422 +0200 @@ -1,0 +2,13 @@ +Sun Aug 19 09:19:23 UTC 2018 - christo...@krop.fr + +- Update to 5.49.0 + * New feature release + * For more details please see: + * https://www.kde.org/announcements/kde-frameworks-5.49.0.php +- Changes since 5.48.0: + * Use more nullptr + * API dox: talk about nullptr, not 0 + * Require out-of-source build + * Add subseq operator to match sub-sequences + +------------------------------------------------------------------- Old: ---- kservice-5.48.0.tar.xz New: ---- kservice-5.49.0.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kservice.spec ++++++ --- /var/tmp/diff_new_pack.2kWQiO/_old 2018-08-24 16:56:23.293523220 +0200 +++ /var/tmp/diff_new_pack.2kWQiO/_new 2018-08-24 16:56:23.301523229 +0200 @@ -16,15 +16,25 @@ # -%bcond_without lang -%define _tar_path 5.48 +%define _tar_path 5.49 # 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 lang Name: kservice -Version: 5.48.0 +Version: 5.49.0 Release: 0 +Summary: Plugin framework for desktop services +License: LGPL-2.1-or-later +Group: System/GUI/KDE +URL: http://www.kde.org +Source: http://download.kde.org/stable/frameworks/%{_tar_path}/%{name}-%{version}.tar.xz +Source1: baselibs.conf +# PATCH-FIX-OPENSUSE kservice-desktop-translations.patch +Patch0: kservice-desktop-translations.patch +# PATCH-FIX-OPENSUSE dont-show-yast-modules-in-the-applications-menu.patch -- hide the YaST modules from the application menu +Patch1: dont-show-yast-modules-in-the-applications-menu.patch BuildRequires: bison BuildRequires: cmake >= 3.0 BuildRequires: extra-cmake-modules >= %{_kf5_bugfix_version} @@ -41,22 +51,11 @@ BuildRequires: cmake(Qt5DBus) >= 5.6.0 BuildRequires: cmake(Qt5Test) >= 5.6.0 BuildRequires: cmake(Qt5Xml) >= 5.6.0 +Recommends: kded >= %{_kf5_bugfix_version} +Obsoletes: libKF5Service4 %if %{with lang} Recommends: %{name}-lang = %{version} %endif -Recommends: kded >= %{_kf5_bugfix_version} -Obsoletes: libKF5Service4 -Summary: Plugin framework for desktop services -License: LGPL-2.1-or-later -Group: System/GUI/KDE -Url: http://www.kde.org -Source: http://download.kde.org/stable/frameworks/%{_tar_path}/%{name}-%{version}.tar.xz -Source1: baselibs.conf -# PATCH-FIX-OPENSUSE kservice-desktop-translations.patch -Patch0: kservice-desktop-translations.patch -# PATCH-FIX-OPENSUSE dont-show-yast-modules-in-the-applications-menu.patch -- hide the YaST modules from the application menu -Patch1: dont-show-yast-modules-in-the-applications-menu.patch -BuildRoot: %{_tmppath}/%{name}-%{version}-build %description Provides a plugin framework for handling desktop services. Services can @@ -77,6 +76,7 @@ application specific code. Development files %lang_package + %prep %setup -q %patch0 -p1 @@ -95,7 +95,6 @@ %endif %post -p /sbin/ldconfig - %postun -p /sbin/ldconfig %if %{with lang} @@ -103,8 +102,7 @@ %endif %files -%defattr(-,root,root) -%doc COPYING* +%license COPYING* %{_kf5_libdir}/libKF5Service.so.* %{_kf5_bindir}/kbuildsycoca5 %dir %{_kf5_servicetypesdir} @@ -117,7 +115,6 @@ %{_kf5_debugdir}/*.categories %files devel -%defattr(-,root,root) %{_kf5_libdir}/libKF5Service.so %{_kf5_libdir}/cmake/KF5Service/ %{_kf5_includedir}/ ++++++ kservice-5.48.0.tar.xz -> kservice-5.49.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kservice-5.48.0/CMakeLists.txt new/kservice-5.49.0/CMakeLists.txt --- old/kservice-5.48.0/CMakeLists.txt 2018-07-08 00:32:35.000000000 +0200 +++ new/kservice-5.49.0/CMakeLists.txt 2018-08-04 13:00:59.000000000 +0200 @@ -1,13 +1,18 @@ cmake_minimum_required(VERSION 3.0) -set(KF5_VERSION "5.48.0") # handled by release scripts -set(KF5_DEP_VERSION "5.48.0") # handled by release scripts +set(KF5_VERSION "5.49.0") # handled by release scripts +set(KF5_DEP_VERSION "5.49.0") # handled by release scripts project(KService VERSION ${KF5_VERSION}) +# Disallow in-source build +if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") + message(FATAL_ERROR "KService requires an out of source build. Please create a separate build directory and run 'cmake path_to_kservice [options]' there.") +endif() + # ECM setup include(FeatureSummary) -find_package(ECM 5.48.0 NO_MODULE) +find_package(ECM 5.49.0 NO_MODULE) set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://projects.kde.org/projects/kdesupport/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/kservice-5.48.0/autotests/CMakeLists.txt new/kservice-5.49.0/autotests/CMakeLists.txt --- old/kservice-5.48.0/autotests/CMakeLists.txt 2018-07-08 00:32:35.000000000 +0200 +++ new/kservice-5.49.0/autotests/CMakeLists.txt 2018-08-04 13:00:59.000000000 +0200 @@ -33,6 +33,9 @@ # KServiceTest::testAllServices can fail if any service is deleted while the test runs set_tests_properties(kservicetest PROPERTIES RUN_SERIAL TRUE) +target_sources(kservicetest PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR}/../src/services/ktraderparsetree.cpp +) add_library(fakeplugin MODULE nsaplugin.cpp) ecm_mark_as_test(fakeplugin) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kservice-5.48.0/autotests/kservicetest.cpp new/kservice-5.49.0/autotests/kservicetest.cpp --- old/kservice-5.48.0/autotests/kservicetest.cpp 2018-07-08 00:32:35.000000000 +0200 +++ new/kservice-5.49.0/autotests/kservicetest.cpp 2018-08-04 13:00:59.000000000 +0200 @@ -28,6 +28,7 @@ #include <ksycoca.h> #include <kbuildsycoca_p.h> #include <../src/services/kserviceutil_p.h> +#include <../src/services/ktraderparsetree_p.h> #include <kservicegroup.h> #include <kservicetypetrader.h> @@ -545,6 +546,16 @@ QCOMPARE(offers.count(), 1); QVERIFY(offerListHasService(offers, QStringLiteral("faketextplugin.desktop"))); + // sub-sequence case sensitive + offers = KServiceTypeTrader::self()->query(QStringLiteral("FakePluginType"), QStringLiteral("'txtlug' subseq Library")); + QCOMPARE(offers.count(), 1); + QVERIFY(offerListHasService(offers, QStringLiteral("faketextplugin.desktop"))); + + // sub-sequence case insensitive + offers = KServiceTypeTrader::self()->query(QStringLiteral("FakePluginType"), QStringLiteral("'tXtLuG' ~subseq Library")); + QCOMPARE(offers.count(), 1); + QVERIFY(offerListHasService(offers, QStringLiteral("faketextplugin.desktop"))); + if (m_hasNonCLocale) { // Test float parsing, must use dot as decimal separator independent of locale. @@ -558,6 +569,34 @@ QVERIFY(offers.isEmpty()); } +void KServiceTest::testSubseqConstraints() +{ + auto test = [](const char* pattern, const char* text, bool sensitive) { + return KTraderParse::ParseTreeSubsequenceMATCH::isSubseq( + QString(pattern), + QString(text), + sensitive? Qt::CaseSensitive : Qt::CaseInsensitive + ); + }; + + // Case Sensitive + QVERIFY2(!test("", "", 1), "both empty"); + QVERIFY2(!test("", "something", 1), "empty pattern"); + QVERIFY2(!test("something", "", 1), "empty text"); + QVERIFY2(test("lngfile", "somereallylongfile", 1), "match ending"); + QVERIFY2(test("somelong", "somereallylongfile", 1), "match beginning"); + QVERIFY2(test("reallylong", "somereallylongfile", 1), "match middle"); + QVERIFY2(test("across", "a 23 c @#! r o01 o 5 s_s", 1), "match across"); + QVERIFY2(!test("nocigar", "soclosebutnociga", 1), "close but no match"); + QVERIFY2(!test("god", "dog", 1), "incorrect letter order"); + QVERIFY2(!test("mismatch", "mIsMaTcH", 1), "case sensitive mismatch"); + + // Case insensitive + QVERIFY2(test("mismatch", "mIsMaTcH", 0), "case insensitive match"); + QVERIFY2(test("tryhards", "Try Your Hardest", 0), "uppercase text"); + QVERIFY2(test("TRYHARDS", "try your hardest", 0), "uppercase pattern"); +} + void KServiceTest::testHasServiceType1() // with services constructed with a full path (rare) { QString fakepartPath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String("kservices5/") + "fakepart.desktop"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kservice-5.48.0/autotests/kservicetest.h new/kservice-5.49.0/autotests/kservicetest.h --- old/kservice-5.48.0/autotests/kservicetest.h 2018-07-08 00:32:35.000000000 +0200 +++ new/kservice-5.49.0/autotests/kservicetest.h 2018-08-04 13:00:59.000000000 +0200 @@ -39,6 +39,7 @@ void testAllServices(); void testServiceTypeTraderForReadOnlyPart(); void testTraderConstraints(); + void testSubseqConstraints(); void testHasServiceType1(); void testHasServiceType2(); void testWriteServiceTypeProfile(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kservice-5.48.0/po/id/kservice5.po new/kservice-5.49.0/po/id/kservice5.po --- old/kservice-5.48.0/po/id/kservice5.po 2018-07-08 00:32:35.000000000 +0200 +++ new/kservice-5.49.0/po/id/kservice5.po 2018-08-04 13:00:59.000000000 +0200 @@ -9,8 +9,8 @@ "Project-Id-Version: kdelibs4\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" "POT-Creation-Date: 2017-02-07 08:40+0100\n" -"PO-Revision-Date: 2018-06-30 08:18+0700\n" -"Last-Translator: Wantoyo <wanto...@gmail.com>\n" +"PO-Revision-Date: 2018-07-23 06:27+0700\n" +"Last-Translator: wantoyo <wanto...@gmail.com>\n" "Language-Team: Indonesian <kde-i18n-...@kde.org>\n" "Language: id\n" "MIME-Version: 1.0\n" @@ -140,7 +140,7 @@ "KLauncher could not be reached via D-Bus. Error when calling %1:\n" "%2\n" msgstr "" -"KLauncher tak dapat dicapai via D-Bus. Error ketika memanggil %1:\n" +"KLauncher tidak dapat dicapai via D-Bus. Error ketika memanggil %1:\n" "%2\n" #: kdeinit/ktoolinvocation_x11.cpp:251 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kservice-5.48.0/po/uk/kservice5.po new/kservice-5.49.0/po/uk/kservice5.po --- old/kservice-5.48.0/po/uk/kservice5.po 2018-07-08 00:32:35.000000000 +0200 +++ new/kservice-5.49.0/po/uk/kservice5.po 2018-08-04 13:00:59.000000000 +0200 @@ -1,5 +1,5 @@ # Translation of kservice5.po to Ukrainian -# Copyright (C) 2014-2015 This_file_is_part_of_KDE +# Copyright (C) 2018 This_file_is_part_of_KDE # This file is distributed under the license LGPL version 2.1 or # version 3 or later versions approved by the membership of KDE e.V. # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kservice-5.48.0/po/zh_CN/kservice5.po new/kservice-5.49.0/po/zh_CN/kservice5.po --- old/kservice-5.48.0/po/zh_CN/kservice5.po 2018-07-08 00:32:35.000000000 +0200 +++ new/kservice-5.49.0/po/zh_CN/kservice5.po 2018-08-04 13:00:59.000000000 +0200 @@ -16,7 +16,7 @@ "Project-Id-Version: kdeorg\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" "POT-Creation-Date: 2017-02-07 08:40+0100\n" -"PO-Revision-Date: 2018-07-03 17:34\n" +"PO-Revision-Date: 2018-07-24 08:41\n" "Last-Translator: guoyunhebrave <guoyunhebr...@gmail.com>\n" "Language-Team: Chinese Simplified\n" "Language: zh_CN\n" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kservice-5.48.0/src/services/kmimetypetrader.h new/kservice-5.49.0/src/services/kmimetypetrader.h --- old/kservice-5.48.0/src/services/kmimetypetrader.h 2018-07-08 00:32:35.000000000 +0200 +++ new/kservice-5.49.0/src/services/kmimetypetrader.h 2018-08-04 13:00:59.000000000 +0200 @@ -98,7 +98,7 @@ * * @param mimeType the mime type (see query()) * @param genericServiceType the service type (see query()) - * @return the preferred service, or 0 if no service is available + * @return the preferred service, or @c nullptr if no service is available */ KService::Ptr preferredService(const QString &mimeType, const QString &genericServiceType = QStringLiteral("Application")); @@ -142,7 +142,7 @@ if (error) { *error = QCoreApplication::translate("", "No service matching the requirements was found"); } - return 0; + return nullptr; } /** @@ -177,7 +177,7 @@ if (error) { *error = QCoreApplication::translate("", "No service matching the requirements was found"); } - return 0; + return nullptr; } /** diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kservice-5.48.0/src/services/kservice.h new/kservice-5.49.0/src/services/kservice.h --- old/kservice-5.48.0/src/services/kservice.h 2018-07-08 00:32:35.000000000 +0200 +++ new/kservice-5.49.0/src/services/kservice.h 2018-08-04 13:00:59.000000000 +0200 @@ -417,7 +417,7 @@ * It's usually better to use serviceByStorageId() instead. * * @param _path the path of the configuration file - * @return a pointer to the requested service or 0 if the service is + * @return a pointer to the requested service or @c nullptr if the service is * unknown. * @em Very @em important: Don't store the result in a KService* ! */ @@ -433,7 +433,7 @@ * but note that it assumes that no two entries have the same filename. * * @param _name the name of the configuration file - * @return a pointer to the requested service or 0 if the service is + * @return a pointer to the requested service or @c nullptr if the service is * unknown. * @em Very @em important: Don't store the result in a KService* ! */ @@ -443,7 +443,7 @@ * Find a service by its menu-id * * @param _menuId the menu id of the service - * @return a pointer to the requested service or 0 if the service is + * @return a pointer to the requested service or @c nullptr if the service is * unknown. * @em Very @em important: Don't store the result in a KService* ! */ @@ -454,7 +454,7 @@ * function will try very hard to find a matching service. * * @param _storageId the storage id or desktop-file path of the service - * @return a pointer to the requested service or 0 if the service is + * @return a pointer to the requested service or @c nullptr if the service is * unknown. * @em Very @em important: Don't store the result in a KService* ! */ @@ -497,7 +497,7 @@ * @param parent The parent object (see QObject constructor) * @param args A list of arguments, passed to the factory and possibly * to the component (see KPluginFactory) - * @param error A pointer to QString which should receive the error description or 0 + * @param error A pointer to QString which should receive the error description or @c nullptr * * @return A pointer to the newly created object or a null pointer if the * factory was unable to create an object of the given type. @@ -506,7 +506,7 @@ T *createInstance(QObject *parent = nullptr, const QVariantList &args = QVariantList(), QString *error = nullptr) const { - return createInstance<T>(0, parent, args, error); + return createInstance<T>(nullptr, parent, args, error); } /** @@ -517,7 +517,7 @@ * @param parent The parent object (see QObject constructor) * @param args A list of arguments, passed to the factory and possibly * to the component (see KPluginFactory) - * @param error A pointer to QString which should receive the error description or 0 + * @param error A pointer to QString which should receive the error description or @c nullptr * * @return A pointer to the newly created object or a null pointer if the * factory was unable to create an object of the given type. @@ -540,7 +540,7 @@ *error = pluginLoader.errorString(); pluginLoader.unload(); } - return 0; + return nullptr; } /** diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kservice-5.48.0/src/services/kserviceoffer.h new/kservice-5.49.0/src/services/kserviceoffer.h --- old/kservice-5.48.0/src/services/kserviceoffer.h 2018-07-08 00:32:35.000000000 +0200 +++ new/kservice-5.49.0/src/services/kserviceoffer.h 2018-08-04 13:00:59.000000000 +0200 @@ -100,7 +100,7 @@ /** * The service which this offer is about. - * @return the service this offer is about, can be 0 + * @return the service this offer is about, can be @c nullptr * in valid offers or when not set */ KService::Ptr service() const; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kservice-5.48.0/src/services/kservicetype.h new/kservice-5.49.0/src/services/kservicetype.h --- old/kservice-5.48.0/src/services/kservicetype.h 2018-07-08 00:32:35.000000000 +0200 +++ new/kservice-5.49.0/src/services/kservicetype.h 2018-08-04 13:00:59.000000000 +0200 @@ -126,11 +126,11 @@ int serviceOffersOffset() const; /** - * Returns a pointer to the servicetype '_name' or 0L if the + * Returns a pointer to the servicetype '_name' or @c nullptr if the * service type is unknown. * VERY IMPORTANT : don't store the result in a KServiceType * ! * @param _name the name of the service type to search - * @return the pointer to the service type, or 0 + * @return the pointer to the service type, or @c nullptr */ static Ptr serviceType(const QString &_name); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kservice-5.48.0/src/services/kservicetypetrader.h new/kservice-5.49.0/src/services/kservicetypetrader.h --- old/kservice-5.48.0/src/services/kservicetypetrader.h 2018-07-08 00:32:35.000000000 +0200 +++ new/kservice-5.49.0/src/services/kservicetypetrader.h 2018-08-04 13:00:59.000000000 +0200 @@ -120,7 +120,7 @@ * Returns the preferred service for @p serviceType. * * @param serviceType the service type (e.g. "KMyApp/Plugin") - * @return the preferred service, or 0 if no service is available + * @return the preferred service, or @c nullptr if no service is available */ KService::Ptr preferredService(const QString &serviceType) const; @@ -158,7 +158,7 @@ const QString &constraint = QString(), QObject *parent = nullptr, const QVariantList &args = QVariantList(), QString *error = nullptr) { - return createInstanceFromQuery<T>(serviceType, 0, parent, constraint, args, error); + return createInstanceFromQuery<T>(serviceType, nullptr, parent, constraint, args, error); } /** @@ -196,7 +196,7 @@ if (error && error->isEmpty()) { *error = QCoreApplication::translate("", "No service matching the requirements was found"); } - return 0; + return nullptr; } /** diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kservice-5.48.0/src/services/ktraderparse.cpp new/kservice-5.49.0/src/services/ktraderparse.cpp --- old/kservice-5.48.0/src/services/ktraderparse.cpp 2018-07-08 00:32:35.000000000 +0200 +++ new/kservice-5.49.0/src/services/ktraderparse.cpp 2018-08-04 13:00:59.000000000 +0200 @@ -101,6 +101,11 @@ return new ParseTreeMATCH(static_cast<ParseTreeBase *>(_ptr1), static_cast<ParseTreeBase *>(_ptr2), _cs == 1 ? Qt::CaseSensitive : Qt::CaseInsensitive); } +void *KTraderParse_newSubsequenceMATCH(void *_ptr1, void *_ptr2, int _cs) +{ + return new ParseTreeSubsequenceMATCH(static_cast<ParseTreeBase *>(_ptr1), static_cast<ParseTreeBase *>(_ptr2), _cs == 1 ? Qt::CaseSensitive : Qt::CaseInsensitive); +} + void *KTraderParse_newCALC(void *_ptr1, void *_ptr2, int _i) { return new ParseTreeCALC(static_cast<ParseTreeBase *>(_ptr1), static_cast<ParseTreeBase *>(_ptr2), _i); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kservice-5.48.0/src/services/ktraderparse_p.h new/kservice-5.49.0/src/services/ktraderparse_p.h --- old/kservice-5.48.0/src/services/ktraderparse_p.h 2018-07-08 00:32:35.000000000 +0200 +++ new/kservice-5.49.0/src/services/ktraderparse_p.h 2018-08-04 13:00:59.000000000 +0200 @@ -32,6 +32,7 @@ void *KTraderParse_newIN(void *_ptr1, void *_ptr2, int _cs); void *KTraderParse_newSubstringIN(void *_ptr1, void *_ptr2, int _cs); void *KTraderParse_newMATCH(void *_ptr1, void *_ptr2, int _cs); +void *KTraderParse_newSubsequenceMATCH(void *_ptr1, void *_ptr2, int _cs); void *KTraderParse_newCALC(void *_ptr1, void *_ptr2, int _i); void *KTraderParse_newBRACKETS(void *_ptr1); void *KTraderParse_newNOT(void *_ptr1); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kservice-5.48.0/src/services/ktraderparsetree.cpp new/kservice-5.49.0/src/services/ktraderparsetree.cpp --- old/kservice-5.48.0/src/services/ktraderparsetree.cpp 2018-07-08 00:32:35.000000000 +0200 +++ new/kservice-5.49.0/src/services/ktraderparsetree.cpp 2018-08-04 13:00:59.000000000 +0200 @@ -423,6 +423,42 @@ return true; } +bool ParseTreeSubsequenceMATCH::eval(ParseContext *_context) const +{ + _context->type = ParseContext::T_BOOL; + + ParseContext c1(_context); + ParseContext c2(_context); + if (!m_pLeft->eval(&c1)) { + return false; + } + if (!m_pRight->eval(&c2)) { + return false; + } + if (c1.type != ParseContext::T_STRING || c2.type != ParseContext::T_STRING) { + return false; + } + _context->b = ParseTreeSubsequenceMATCH::isSubseq(c1.str, c2.str, m_cs); + return true; +} + +bool ParseTreeSubsequenceMATCH:: +isSubseq(const QString& pattern, const QString& text, Qt::CaseSensitivity cs) +{ + if (pattern.isEmpty()) { + return false; + } + bool chk_case = cs == Qt::CaseSensitive; + + QString::const_iterator i = text.constBegin(), j = pattern.constBegin(); + for (; i != text.constEnd() && j != pattern.constEnd(); ++i) { + if ((chk_case && *i == *j) || (!chk_case && i->toLower() == j->toLower())) { + ++j; + } + } + return j == pattern.constEnd(); +} + bool ParseTreeIN::eval(ParseContext *_context) const { _context->type = ParseContext::T_BOOL; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kservice-5.48.0/src/services/ktraderparsetree_p.h new/kservice-5.49.0/src/services/ktraderparsetree_p.h --- old/kservice-5.48.0/src/services/ktraderparsetree_p.h 2018-07-08 00:32:35.000000000 +0200 +++ new/kservice-5.49.0/src/services/ktraderparsetree_p.h 2018-08-04 13:00:59.000000000 +0200 @@ -222,6 +222,41 @@ }; /** + * @internal + * + * A sub-sequence match is like a sub-string match except the characters + * do not have to be contiguous. For example 'ct' is a sub-sequence of 'cat' + * but not a sub-string. 'at' is both a sub-string and sub-sequence of 'cat'. + * All sub-strings are sub-sequences. + * + * This is useful if you want to support a fuzzier search, say for instance + * you are searching for `LibreOffice 6.0 Writer`, after typing `libre` you + * see a list of all the LibreOffice apps, to narrow down that list you only + * need to add `write` (so the search term is `librewrite`) instead of typing + * out the entire app name until a distinguishing letter is reached. + * It's also useful to allow the user to forget to type some characters. + */ +class ParseTreeSubsequenceMATCH : public ParseTreeBase +{ +public: + ParseTreeSubsequenceMATCH(ParseTreeBase *_ptr1, ParseTreeBase *_ptr2, Qt::CaseSensitivity cs) + { + m_pLeft = _ptr1; + m_pRight = _ptr2; + m_cs = cs; + } + + bool eval(ParseContext *_context) const override; + + static bool isSubseq(const QString& pattern, const QString& text, Qt::CaseSensitivity cs); + +protected: + ParseTreeBase::Ptr m_pLeft; + ParseTreeBase::Ptr m_pRight; + Qt::CaseSensitivity m_cs; +}; + +/** * @internal */ class ParseTreeCALC : public ParseTreeBase diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kservice-5.48.0/src/services/lex.l new/kservice-5.49.0/src/services/lex.l --- old/kservice-5.48.0/src/services/lex.l 2018-07-08 00:32:35.000000000 +0200 +++ new/kservice-5.49.0/src/services/lex.l 2018-08-04 13:00:59.000000000 +0200 @@ -35,6 +35,8 @@ "<=" { return LEQ; } ">=" { return GEQ; } "~~" { return MATCH_INSENSITIVE; } +"subseq" { return MATCH_SUBSEQUENCE; } +"~subseq" { return MATCH_SUBSEQUENCE_INSENSITIVE; } "not" { return NOT; } "and" { return AND; } "or" { return OR; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kservice-5.48.0/src/services/yacc.y new/kservice-5.49.0/src/services/yacc.y --- old/kservice-5.48.0/src/services/yacc.y 2018-07-08 00:32:35.000000000 +0200 +++ new/kservice-5.49.0/src/services/yacc.y 2018-08-04 13:00:59.000000000 +0200 @@ -45,6 +45,8 @@ %token TOKEN_IN %token TOKEN_IN_SUBSTRING %token MATCH_INSENSITIVE +%token MATCH_SUBSEQUENCE +%token MATCH_SUBSEQUENCE_INSENSITIVE %token TOKEN_IN_INSENSITIVE %token TOKEN_IN_SUBSTRING_INSENSITIVE %token EXIST @@ -122,6 +124,8 @@ expr_twiddle: expr '~' expr { $$ = KTraderParse_newMATCH( $<ptr>1, $<ptr>3, 1 ); } | expr_twiddle MATCH_INSENSITIVE expr { $$ = KTraderParse_newMATCH( $<ptr>1, $<ptr>3, 0 ); } + | expr_twiddle MATCH_SUBSEQUENCE expr { $$ = KTraderParse_newSubsequenceMATCH( $<ptr>1, $<ptr>3, 1 ); } + | expr_twiddle MATCH_SUBSEQUENCE_INSENSITIVE expr { $$ = KTraderParse_newSubsequenceMATCH( $<ptr>1, $<ptr>3, 0 ); } | expr { $$ = $<ptr>1; } ; @@ -156,6 +160,7 @@ void yyerror ( yyscan_t scanner, const char *s ) /* Called by yyparse on error */ { + (void) scanner; KTraderParse_error( s ); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kservice-5.48.0/src/sycoca/vfolder_menu_p.h new/kservice-5.49.0/src/sycoca/vfolder_menu_p.h --- old/kservice-5.48.0/src/sycoca/vfolder_menu_p.h 2018-07-08 00:32:35.000000000 +0200 +++ new/kservice-5.49.0/src/sycoca/vfolder_menu_p.h 2018-08-04 13:00:59.000000000 +0200 @@ -210,7 +210,7 @@ * out. * * This function returns a pointer to the menu if it was found - * or 0 if it was not found. + * or @c nullptr if it was not found. */ SubMenu *takeSubMenu(SubMenu *parentMenu, const QString &menuName);