[PATCH] Fix build with AppStreamQt5 >= 1.0
authorMatthias Klumpp <matthias@tenstral.net>
Mon, 18 Dec 2023 04:08:44 +0000 (05:08 +0100)
committerPatrick Franz <deltaone@debian.org>
Fri, 31 May 2024 14:54:34 +0000 (16:54 +0200)
Gbp-Pq: Name fix-appstreamqt5-1.0-build.patch

CMakeLists.txt
applets/kicker/plugin/actionlist.cpp
runners/CMakeLists.txt
runners/appstream/CMakeLists.txt
runners/appstream/appstreamrunner.cpp
runners/appstream/appstreamrunner.h

index 67910f256dbc25c3094569597b2c89942398405c..38c0bc68c38114335c5a28f4fa9ea1e687aaf723 100644 (file)
@@ -183,12 +183,12 @@ if(FONTCONFIG_FOUND)
   find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS PrintSupport)
 endif()
 
-find_package(AppStreamQt 0.10.6)
-set_package_properties(AppStreamQt PROPERTIES DESCRIPTION "Access metadata for listing available software"
+find_package(AppStreamQt5 1.0.0)
+set_package_properties(AppStreamQt5 PROPERTIES DESCRIPTION "Access metadata for listing available software"
                        URL "https://www.freedesktop.org/wiki/Distributions/AppStream/"
                        TYPE OPTIONAL)
 
-if(${AppStreamQt_FOUND})
+if(${AppStreamQt5_FOUND})
     set(HAVE_APPSTREAMQT true)
 endif()
 
index 61fc2348723c58e06dd622644054e09d46905eb8..c3a1148addc0b4d92ca3e1f34aa9e19830dcec95 100644 (file)
@@ -32,7 +32,7 @@
 #include "containmentinterface.h"
 
 #ifdef HAVE_APPSTREAMQT
-#include <AppStreamQt/pool.h>
+#include <AppStreamQt5/pool.h>
 #endif
 
 namespace KAStats = KActivities::Stats;
@@ -448,10 +448,10 @@ bool handleAppstreamActions(const QString &actionId, const KService::Ptr &servic
 
     const auto components =
         appstreamPool->componentsByLaunchable(AppStream::Launchable::KindDesktopId, service->desktopEntryName() + QLatin1String(".desktop"));
-    if (components.empty()) {
+    if (components.isEmpty()) {
         return false;
     }
-    return QDesktopServices::openUrl(QUrl(QLatin1String("appstream://") + components[0].id()));
+    return QDesktopServices::openUrl(QUrl(QLatin1String("appstream://") + components.indexSafe(0)->id()));
 #else
     return false;
 #endif
index ec22f27d701f2cf815578dd70207d4fc611f67f5..4216518e9682b7ea5bbffccb28bc98eff2c37007 100644 (file)
@@ -14,7 +14,7 @@ add_subdirectory(shell)
 add_subdirectory(webshortcuts)
 add_subdirectory(windowedwidgets)
 
-if(AppStreamQt_FOUND)
+if(AppStreamQt5_FOUND)
     add_subdirectory(appstream)
 endif()
 
index 7dc43cdad93a40ba8bb636b38f2a0aaeaf9e76b4..15c486a3ea3b8d3dbb25a07d347c617b8415aa40 100644 (file)
@@ -11,4 +11,4 @@ ecm_qt_declare_logging_category(krunner_appstream_SRCS
     DEFAULT_SEVERITY Warning)
 
 kcoreaddons_add_plugin(krunner_appstream SOURCES ${krunner_appstream_SRCS} INSTALL_NAMESPACE "kf5/krunner")
-target_link_libraries(krunner_appstream PUBLIC Qt::Gui KF5::Runner KF5::I18n KF5::Service AppStreamQt)
+target_link_libraries(krunner_appstream PUBLIC Qt::Gui KF5::Runner KF5::I18n KF5::Service AppStreamQt5)
index b0dcb381ee48c671b0a3d15069b59e3a8e427dce..b3a660c8ef463f8ee2d42de644642a1ed5039c88 100644 (file)
@@ -6,7 +6,7 @@
 
 #include "appstreamrunner.h"
 
-#include <AppStreamQt/icon.h>
+#include <AppStreamQt5/icon.h>
 
 #include <QDebug>
 #include <QDesktopServices>
@@ -150,17 +150,17 @@ QList<AppStream::Component> InstallerRunner::findComponentsByString(const QStrin
     QMutexLocker locker(&m_appstreamMutex);
     QString error;
     static bool warnedOnce = false;
-    static bool opened = m_db.load(&error);
+    static bool opened = m_db.load();
     if (!opened) {
         if (warnedOnce) {
-            qCDebug(RUNNER_APPSTREAM) << "Had errors when loading AppStream metadata pool" << error;
+            qCDebug(RUNNER_APPSTREAM) << "Had errors when loading AppStream metadata pool" << m_db.lastError();
         } else {
-            qCWarning(RUNNER_APPSTREAM) << "Had errors when loading AppStream metadata pool" << error;
+            qCWarning(RUNNER_APPSTREAM) << "Had errors when loading AppStream metadata pool" << m_db.lastError();
             warnedOnce = true;
         }
     }
 
-    return m_db.search(query);
+    return m_db.search(query).toList();
 }
 
 #include "appstreamrunner.moc"
index 18197ab08b05c4b202b946c4450bf83de44e9c51..b585f55c36f680d5b83202892a35effd7a31f21a 100644 (file)
@@ -6,7 +6,7 @@
 
 #pragma once
 
-#include <AppStreamQt/pool.h>
+#include <AppStreamQt5/pool.h>
 #include <KRunner/AbstractRunner>
 #include <QMutex>