diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,8 +63,12 @@ find_package(KSMServerDBusInterface CONFIG REQUIRED) find_package(KF5ItemModels CONFIG REQUIRED) find_package(KF5Emoticons CONFIG REQUIRED) -find_package(AppStreamQt 0.10.4 CONFIG REQUIRED) +find_package(AppStreamQt 0.10.4) +set_package_properties(AppStreamQt PROPERTIES DESCRIPTION "Appstream integration" + TYPE RECOMMENDED + PURPOSE "Needed to allow appstream integration from application menus" + ) find_package(KF5Baloo) set_package_properties(KF5Baloo PROPERTIES DESCRIPTION "File Searching" TYPE RECOMMENDED @@ -139,10 +143,15 @@ set(HAVE_BREEZE_DECO FALSE) endif() +if(${AppStreamQt_FOUND}) + set(HAVE_APPSTREAMQT true) +endif() + include_directories("${CMAKE_CURRENT_BINARY_DIR}") configure_file(config-workspace.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-workspace.h) configure_file(config-unix.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-unix.h ) +configure_file(config-appstream.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-appstream.h ) configure_file(config-X11.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-X11.h) configure_file(config-runtime.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-runtime.h) diff --git a/applets/kicker/CMakeLists.txt b/applets/kicker/CMakeLists.txt --- a/applets/kicker/CMakeLists.txt +++ b/applets/kicker/CMakeLists.txt @@ -74,7 +74,10 @@ KF5::Service KF5::Solid KF5::WindowSystem - AppStreamQt PW::KWorkspace) +if (${HAVE_APPSTREAMQT}) +target_link_libraries(kickerplugin AppStreamQt) +endif() + install(TARGETS kickerplugin DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/kicker) diff --git a/applets/kicker/plugin/appentry.cpp b/applets/kicker/plugin/appentry.cpp --- a/applets/kicker/plugin/appentry.cpp +++ b/applets/kicker/plugin/appentry.cpp @@ -25,6 +25,7 @@ #include "menuentryeditor.h" #include +#include #include #include @@ -46,7 +47,10 @@ #include #include + +#ifdef HAVE_APPSTREAMQT #include +#endif MenuEntryEditor *AppEntry::m_menuEntryEditor = nullptr; @@ -139,6 +143,7 @@ QVariantList appstreamActions(const KService::Ptr &service) { +#ifdef HAVE_APPSTREAMQT static AppStream::Pool pool; if (!pool.load()) { return {}; @@ -154,6 +159,9 @@ ret << appstreamAction; } return ret; +#else + return {}; +#endif } QVariantList AppEntry::actions() const diff --git a/config-appstream.h.cmake b/config-appstream.h.cmake new file mode 100644 --- /dev/null +++ b/config-appstream.h.cmake @@ -0,0 +1 @@ +#cmakedefine HAVE_APPSTREAMQT 1