From ea1c378af589e274fdb59072740d840cdd98b8f1514f7164745a235e1fa1b9b8 Mon Sep 17 00:00:00 2001 From: Dominique Leuenberger Date: Fri, 24 Jul 2020 08:07:23 +0000 Subject: [PATCH] Accepting request 822447 from KDE:Extra OBS-URL: https://build.opensuse.org/request/show/822447 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/zanshin?expand=0&rev=7 --- ...all-the-kontact-plugin-into-kontact5.patch | 100 ++++++++++++++++++ Port-to-kontactinterface-5.14.42.patch | 58 ++++++++++ zanshin.changes | 7 ++ zanshin.spec | 7 +- 4 files changed, 171 insertions(+), 1 deletion(-) create mode 100644 Install-the-kontact-plugin-into-kontact5.patch create mode 100644 Port-to-kontactinterface-5.14.42.patch diff --git a/Install-the-kontact-plugin-into-kontact5.patch b/Install-the-kontact-plugin-into-kontact5.patch new file mode 100644 index 0000000..025b6b2 --- /dev/null +++ b/Install-the-kontact-plugin-into-kontact5.patch @@ -0,0 +1,100 @@ +From faba24de5cc556870991fcc013a0ef2dceb5eeb9 Mon Sep 17 00:00:00 2001 +From: David Faure +Date: Wed, 15 Apr 2020 09:29:42 +0200 +Subject: [PATCH] Install the kontact plugin into kontact5, with JSON metadata. + +Summary: This will allow kontact to use KPluginLoader one day. + +Test Plan: +rm $prefix/lib64/plugins/kontact_zanshinplugin.so ; make install +kontact still finds the zanshin plugin + +The same steps (other than old-kontact-interface compatibility) were already +pushed to all other kontact plugins. + +Reviewers: ervin + +Reviewed By: ervin + +Differential Revision: https://phabricator.kde.org/D28847 +--- + src/zanshin/kontact/CMakeLists.txt | 12 +++++++++++- + src/zanshin/kontact/kontact_plugin.cpp | 20 +++++++++++++++++++- + src/zanshin/kontact/zanshin_plugin.desktop | 2 +- + 3 files changed, 31 insertions(+), 3 deletions(-) + +diff --git a/src/zanshin/kontact/CMakeLists.txt b/src/zanshin/kontact/CMakeLists.txt +index 60913156..be660131 100644 +--- a/src/zanshin/kontact/CMakeLists.txt ++++ b/src/zanshin/kontact/CMakeLists.txt +@@ -1,3 +1,12 @@ ++# TODO: remove once kontactinterface 5.14.42 is required ++ ++if(NOT CMAKE_VERSION VERSION_LESS "3.10.0") ++ # CMake 3.9+ warns about automoc on files without Q_OBJECT, and doesn't know about other macros. ++ # 3.10+ lets us provide more macro names that require automoc. ++ # KF5 >= 5.42 takes care itself of adding its macros in its cmake config files ++ list(APPEND CMAKE_AUTOMOC_MACRO_NAMES "EXPORT_KONTACT_PLUGIN_WITH_JSON") ++endif() ++ + set(part_SRCS + ../app/aboutdata.cpp + part.cpp +@@ -22,8 +31,9 @@ set(kontact_SRCS + + add_library(kontact_zanshinplugin MODULE ${kontact_SRCS}) + target_link_libraries(kontact_zanshinplugin KF5::Parts KF5::KontactInterface) ++kcoreaddons_desktop_to_json(kontact_zanshinplugin zanshin_plugin.desktop) + +-install(TARGETS kontact_zanshinplugin DESTINATION ${KDE_INSTALL_PLUGINDIR}) ++install(TARGETS kontact_zanshinplugin DESTINATION ${KDE_INSTALL_PLUGINDIR}/kontact5) + install(FILES zanshin_plugin.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/kontact) + install(FILES zanshin_part.rc DESTINATION ${KDE_INSTALL_KXMLGUI5DIR}/zanshin) + +diff --git a/src/zanshin/kontact/kontact_plugin.cpp b/src/zanshin/kontact/kontact_plugin.cpp +index 4b0d2f92..8edbb4a6 100644 +--- a/src/zanshin/kontact/kontact_plugin.cpp ++++ b/src/zanshin/kontact/kontact_plugin.cpp +@@ -25,7 +25,25 @@ + + #include + +-EXPORT_KONTACT_PLUGIN(Plugin, zanshin) ++#if KONTACTINTERFACE_VERSION < QT_VERSION_CHECK(5, 14, 42) ++/** ++ Exports Kontact plugin. ++ @param pluginclass the class to instanciate (must derive from KontactInterface::Plugin ++ @param jsonFile filename of the JSON file, generated from a .desktop file ++ */ ++#define EXPORT_KONTACT_PLUGIN_WITH_JSON( pluginclass, jsonFile ) \ ++ class Instance \ ++ { \ ++ public: \ ++ static QObject *createInstance( QWidget *, QObject *parent, const QVariantList &list ) \ ++ { return new pluginclass( static_cast( parent ), list ); } \ ++ }; \ ++ K_PLUGIN_FACTORY_WITH_JSON( KontactPluginFactory, jsonFile, registerPlugin< pluginclass > \ ++ ( QString(), Instance::createInstance ); ) \ ++ K_EXPORT_PLUGIN_VERSION(KONTACT_PLUGIN_VERSION) ++#endif ++ ++EXPORT_KONTACT_PLUGIN_WITH_JSON(Plugin, "zanshin_plugin.json") + + Plugin::Plugin(KontactInterface::Core *core, const QVariantList&) + : KontactInterface::Plugin(core, core, "zanshin") +diff --git a/src/zanshin/kontact/zanshin_plugin.desktop b/src/zanshin/kontact/zanshin_plugin.desktop +index f616a898..58fe05c1 100644 +--- a/src/zanshin/kontact/zanshin_plugin.desktop ++++ b/src/zanshin/kontact/zanshin_plugin.desktop +@@ -3,7 +3,7 @@ Type=Service + Icon=zanshin + X-KDE-ServiceTypes=Kontact/Plugin,KPluginInfo + +-X-KDE-Library=kontact_zanshinplugin ++X-KDE-Library=kontact5/kontact_zanshinplugin + X-KDE-KontactPluginVersion=10 + X-KDE-KontactPartLibraryName=zanshin_part + X-KDE-KontactPartExecutableName=zanshin +-- +GitLab + diff --git a/Port-to-kontactinterface-5.14.42.patch b/Port-to-kontactinterface-5.14.42.patch new file mode 100644 index 0000000..8b6f292 --- /dev/null +++ b/Port-to-kontactinterface-5.14.42.patch @@ -0,0 +1,58 @@ +From 4850c08998b33b37af99c3312d193b063b3e8174 Mon Sep 17 00:00:00 2001 +From: David Faure +Date: Sat, 11 Apr 2020 17:36:25 +0200 +Subject: [PATCH] Port to kontactinterface >= 5.14.42, with ifdefs + +--- + src/zanshin/kontact/kontact_plugin.cpp | 7 +++++++ + src/zanshin/kontact/kontact_plugin.h | 5 +++++ + 2 files changed, 12 insertions(+) + +diff --git a/src/zanshin/kontact/kontact_plugin.cpp b/src/zanshin/kontact/kontact_plugin.cpp +index b03d9674..4b0d2f92 100644 +--- a/src/zanshin/kontact/kontact_plugin.cpp ++++ b/src/zanshin/kontact/kontact_plugin.cpp +@@ -33,9 +33,16 @@ Plugin::Plugin(KontactInterface::Core *core, const QVariantList&) + setComponentName(QStringLiteral("zanshin"), QStringLiteral("zanshin")); + } + ++#if KONTACTINTERFACE_VERSION >= QT_VERSION_CHECK(5, 14, 42) ++KParts::Part *Plugin::createPart() ++{ ++ return loadPart(); ++} ++#else + KParts::ReadOnlyPart *Plugin::createPart() + { + return loadPart(); + } ++#endif + + #include "kontact_plugin.moc" +diff --git a/src/zanshin/kontact/kontact_plugin.h b/src/zanshin/kontact/kontact_plugin.h +index 0d45564e..a270ba16 100644 +--- a/src/zanshin/kontact/kontact_plugin.h ++++ b/src/zanshin/kontact/kontact_plugin.h +@@ -25,6 +25,7 @@ + #define ZANSHIN_KONTACT_PLUGIN_H + + #include ++#include + + class Plugin : public KontactInterface::Plugin + { +@@ -36,7 +37,11 @@ public: + int weight() const override { return 449; } + + protected: ++#if KONTACTINTERFACE_VERSION >= QT_VERSION_CHECK(5, 14, 42) ++ KParts::Part *createPart() override; ++#else + KParts::ReadOnlyPart *createPart() override; ++#endif + }; + + #endif +-- +GitLab + diff --git a/zanshin.changes b/zanshin.changes index 5169539..2cf1638 100644 --- a/zanshin.changes +++ b/zanshin.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Thu Jul 23 11:07:30 UTC 2020 - Wolfgang Bauer + +- Add upstream patches to fix build with kontactinterface 20.08: + * Port-to-kontactinterface-5.14.42.patch + * Install-the-kontact-plugin-into-kontact5.patch + ------------------------------------------------------------------- Thu Feb 6 14:34:14 UTC 2020 - Christophe Giboudeaux diff --git a/zanshin.spec b/zanshin.spec index 6188b91..f73f7cb 100644 --- a/zanshin.spec +++ b/zanshin.spec @@ -25,6 +25,9 @@ License: GPL-2.0-only Group: Productivity/Office/Organizers URL: https://zanshin.kde.org Source: https://download.kde.org/stable/%{name}/%{name}-%{version}.tar.xz +# PATCH-FIX-UPSTREAM +Patch0: Port-to-kontactinterface-5.14.42.patch +Patch1: Install-the-kontact-plugin-into-kontact5.patch BuildRequires: boost-devel BuildRequires: kf5-filesystem BuildRequires: update-desktop-files @@ -49,6 +52,7 @@ job and personal life. You will never forget anything anymore. %prep %setup -q +%autopatch -p1 %build %cmake_kf5 -d build @@ -67,6 +71,7 @@ job and personal life. You will never forget anything anymore. %dir %{_kf5_appstreamdir} %dir %{_kf5_iconsdir}/hicolor/256x256 %dir %{_kf5_iconsdir}/hicolor/256x256/apps +%dir %{_kf5_plugindir}/kontact5/ %{_kf5_applicationsdir}/org.kde.zanshin.desktop %{_kf5_appstreamdir}/org.kde.zanshin.appdata.xml %{_kf5_bindir}/zanshin @@ -74,7 +79,7 @@ job and personal life. You will never forget anything anymore. %{_kf5_iconsdir}/hicolor/*/apps/zanshin.png %{_kf5_iconsdir}/hicolor/scalable/apps/zanshin.svgz %{_kf5_kxmlguidir}/zanshin/ -%{_kf5_plugindir}/kontact_zanshinplugin.so +%{_kf5_plugindir}/kontact5/kontact_zanshinplugin.so %{_kf5_plugindir}/krunner_zanshin.so %{_kf5_plugindir}/zanshin_part.so %{_kf5_servicesdir}/kontact/