commit:     b76bf200ce9bf0e9171d53c988f91a456e8f2bf0
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 26 10:30:45 2023 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Thu Aug 31 19:19:14 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b76bf200

app-office/kraft: add 1.0, build w/ >=kde-apps/akonadi-contact-23.08

See also:
https://github.com/dragotin/kraft/issues/209

Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 app-office/kraft/Manifest                          |   1 +
 .../kraft/files/kraft-1.0-akonadi-23.08.patch      | 161 +++++++++++++++++
 app-office/kraft/files/kraft-1.0-cmake.patch       | 197 +++++++++++++++++++++
 app-office/kraft/kraft-1.0.ebuild                  |  54 ++++++
 4 files changed, 413 insertions(+)

diff --git a/app-office/kraft/Manifest b/app-office/kraft/Manifest
index 0094ce821964..71a320a20c03 100644
--- a/app-office/kraft/Manifest
+++ b/app-office/kraft/Manifest
@@ -1 +1,2 @@
 DIST kraft-0.98.tar.gz 968081 BLAKE2B 
01221ea11e3d4793b2158f1742a2629759405aed22cc4e2c33e0c2d54862c34eb51f435af11738b383671b254e984a92a3362e9465ebb899054401156f535cba
 SHA512 
f8241ac00d80d45224fdc1d4847724d08ac138ea4c6a95a598b001c977002b2c3e8a9f054a1ac2ac4e86de6de8eff304b11b653a3dc3225ad757c5f5ca501850
+DIST kraft-1.0.tar.gz 3629908 BLAKE2B 
b40dc2d647e2985b01d9ee241fbd8cf1eb551621c4635a79c248d69538d2ac034889828461f11e6eefc5258bafe160f421c2960ad80de2a264a8978a4687ad56
 SHA512 
c45b41ed6eb3eae1f29d158506ea59d55a636974bfb655b307e3045edefcbee84fd833e16cf06b7317e8f634e1efef83841a7361af86007973ab2ef234c32585

diff --git a/app-office/kraft/files/kraft-1.0-akonadi-23.08.patch 
b/app-office/kraft/files/kraft-1.0-akonadi-23.08.patch
new file mode 100644
index 000000000000..40fdd6383d4a
--- /dev/null
+++ b/app-office/kraft/files/kraft-1.0-akonadi-23.08.patch
@@ -0,0 +1,161 @@
+From ba3a0e4c1d232b05daddd9ded110e15e0a3c9005 Mon Sep 17 00:00:00 2001
+From: Klaas Freitag <[email protected]>
+Date: Tue, 29 Aug 2023 20:29:23 +0200
+Subject: [PATCH] Added Akonadi version check for some renamed components
+
+Akonadi renamed the contact viewer and editors namespace.
+---
+ CMakeLists.txt                | 10 +++++++++-
+ src/CMakeLists.txt            |  1 +
+ src/addressselectorwidget.cpp | 16 +++++++++++-----
+ src/addressselectorwidget.h   | 15 +++++++++++++--
+ 4 files changed, 34 insertions(+), 8 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 0f5541da..0cd73f99 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -109,7 +109,15 @@ set_package_properties(${AKO_PREFIX}AkonadiContact 
PROPERTIES
+     TYPE OPTIONAL
+ )
+ 
+-if(${AKO_PREFIX}Akonadi_FOUND AND ${AKO_PREFIX}AkonadiContact_FOUND)
++find_package(${AKO_PREFIX}ContactEditor)
++set_package_properties(${AKO_PREFIX}ContactEditor PROPERTIES
++    DESCRIPTION "Library for editing contacts stored in Akonadi"
++    URL "https://www.kde.org/";
++    PURPOSE "Optionally used for addressbook integration"
++    TYPE OPTIONAL
++)
++
++if(${AKO_PREFIX}Akonadi_FOUND AND ${AKO_PREFIX}AkonadiContact_FOUND AND 
${AKO_PREFIX}ContactEditor_FOUND)
+    add_definitions(-DHAVE_AKONADI)
+ endif()
+ 
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index a2bc5dcf..eac624d4 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -173,6 +173,7 @@ if(${AKO_PREFIX}Akonadi_FOUND)
+   list(APPEND KRAFT_LINK_LIBS
+     ${AKO_PREFIX}::AkonadiCore
+     ${AKO_PREFIX}::AkonadiContact
++    ${AKO_PREFIX}::ContactEditor
+     ${AKO_PREFIX}::AkonadiAgentBase
+     ${AKO_PREFIX}::AkonadiWidgets
+     ${AKO_PREFIX}::AkonadiXml
+diff --git a/src/addressselectorwidget.cpp b/src/addressselectorwidget.cpp
+index fd083634..504d5a6b 100644
+--- a/src/addressselectorwidget.cpp
++++ b/src/addressselectorwidget.cpp
+@@ -235,7 +235,11 @@ KraftContactViewer::KraftContactViewer(QWidget *parent)
+     lay->setMargin(0);
+     setLayout(lay);
+ #ifdef HAVE_AKONADI
++#if AKONADICONTACT_VERSION >= QT_VERSION_CHECK(5, 24, 0)
++    _contactViewer = new ContactEditor::ContactViewer;
++#else
+     _contactViewer = new Akonadi::ContactViewer;
++#endif
+     _contactViewer->setShowQRCode(false);
+ 
+     lay->addWidget(_contactViewer);
+@@ -372,9 +376,12 @@ bool AddressSelectorWidget::backendUp() const
+ void AddressSelectorWidget::slotCreateNewContact()
+ {
+ #ifdef HAVE_AKONADI
+-    // FIXME
+-_addressEditor.reset(new Akonadi::ContactEditorDialog( 
Akonadi::ContactEditorDialog::CreateMode, this ));
+-_addressEditor->show();
++#if AKONADICONTACT_VERSION >= QT_VERSION_CHECK(5, 24, 0)
++    _addressEditor = new 
ContactEditor::ContactEditorDialog(ContactEditor::ContactEditorDialog::EditMode,
 this );
++#else
++    _addressEditor = new 
Akonadi::ContactEditorDialog(Akonadi::ContactEditorDialog::CreateMode, this );
++#endif
++    _addressEditor->show();
+ #endif
+ }
+ 
+@@ -398,13 +405,12 @@ void 
AddressSelectorWidget::slotAddresseeSelected(QModelIndex index)
+ void AddressSelectorWidget::slotEditContact()
+ {
+ #ifdef HAVE_AKONADI
+-
+   if( _addressTreeView->selectionModel()->hasSelection() ) {
+       QModelIndex index = _addressTreeView->selectionModel()->currentIndex();
+     if ( index.isValid() ) {
+       const Akonadi::Item item = index.data( 
Akonadi::EntityTreeModel::ItemRole ).value<Akonadi::Item>();
+       if ( item.isValid() && item.hasPayload<KContacts::Addressee>() ) {
+-        _addressEditor.reset(new Akonadi::ContactEditorDialog( 
Akonadi::ContactEditorDialog::EditMode, this ));
++        _addressEditor = new 
Akonadi::ContactEditorDialog(Akonadi::ContactEditorDialog::EditMode, this);
+         _addressEditor->setContact( item );
+         _addressEditor->show();
+       }
+diff --git a/src/addressselectorwidget.h b/src/addressselectorwidget.h
+index 4c5ec3e2..70d97590 100644
+--- a/src/addressselectorwidget.h
++++ b/src/addressselectorwidget.h
+@@ -30,7 +30,10 @@
+ #else
+ #define AKONADICONTACT_VERSION AKONADI_VERSION
+ #endif
+-#if AKONADICONTACT_VERSION >= QT_VERSION_CHECK(5, 20, 0)
++#if AKONADICONTACT_VERSION >= QT_VERSION_CHECK(5, 24, 0)
++#include <AkonadiContactEditor/Akonadi/ContactViewer>
++#include <AkonadiContactEditor/Akonadi/ContactEditorDialog>
++#elif AKONADICONTACT_VERSION >= QT_VERSION_CHECK(5, 20, 0)
+ #include <AkonadiContact/Akonadi/ContactViewer>
+ #include <AkonadiContact/Akonadi/ContactEditorDialog>
+ #else
+@@ -66,8 +69,12 @@ class KraftContactViewer : public QWidget
+ 
+ private:
+ #ifdef HAVE_AKONADI
++#if AKONADICONTACT_VERSION >= QT_VERSION_CHECK(5, 24, 0)
++    ContactEditor::ContactViewer *_contactViewer;
++#else
+     Akonadi::ContactViewer *_contactViewer;
+ #endif
++#endif
+ };
+ 
+ class AddressSortProxyModel : public QSortFilterProxyModel
+@@ -124,7 +131,11 @@ private slots:
+   QTreeView *_addressTreeView;
+   KraftContactViewer *_contactViewer;
+ #ifdef HAVE_AKONADI
+-  QScopedPointer<Akonadi::ContactEditorDialog> _addressEditor;
++#if AKONADICONTACT_VERSION >= QT_VERSION_CHECK(5, 24, 0)
++    ContactEditor::ContactEditorDialog *_addressEditor;
++#else
++    Akonadi::ContactEditorDialog *_addressEditor;
++#endif
+ #endif
+ };
+ 
+From 052bfe5903cc1f33a27b0dc77512458ff39cfdb5 Mon Sep 17 00:00:00 2001
+From: Klaas Freitag <[email protected]>
+Date: Tue, 29 Aug 2023 20:54:08 +0200
+Subject: [PATCH] more version checks added
+
+---
+ src/addressselectorwidget.cpp | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/src/addressselectorwidget.cpp b/src/addressselectorwidget.cpp
+index 504d5a6..1cf2317 100644
+--- a/src/addressselectorwidget.cpp
++++ b/src/addressselectorwidget.cpp
+@@ -410,7 +410,11 @@ void AddressSelectorWidget::slotEditContact()
+     if ( index.isValid() ) {
+       const Akonadi::Item item = index.data( 
Akonadi::EntityTreeModel::ItemRole ).value<Akonadi::Item>();
+       if ( item.isValid() && item.hasPayload<KContacts::Addressee>() ) {
+-        _addressEditor = new 
Akonadi::ContactEditorDialog(Akonadi::ContactEditorDialog::EditMode, this);
++#if AKONADICONTACT_VERSION >= QT_VERSION_CHECK(5, 24, 0)
++        _addressEditor = new 
ContactEditor::ContactEditorDialog(ContactEditor::ContactEditorDialog::EditMode,
 this );
++#else
++        _addressEditor = new 
Akonadi::ContactEditorDialog(Akonadi::ContactEditorDialog::CreateMode, this );
++#endif
+         _addressEditor->setContact( item );
+         _addressEditor->show();
+       }

diff --git a/app-office/kraft/files/kraft-1.0-cmake.patch 
b/app-office/kraft/files/kraft-1.0-cmake.patch
new file mode 100644
index 000000000000..6ffa654be01e
--- /dev/null
+++ b/app-office/kraft/files/kraft-1.0-cmake.patch
@@ -0,0 +1,197 @@
+From 938f9796d7c84b86cde3778513941055f350ee0e Mon Sep 17 00:00:00 2001
+From: Klaas Freitag <[email protected]>
+Date: Sat, 29 Apr 2023 10:37:55 +0200
+Subject: [PATCH 1/3] Adopt CMake files to Akonadi prefix KPim5
+
+(cherry picked from commit f54b317f5cd894e4063b6d4c4c3a96012c1bcb28)
+---
+ CMakeLists.txt       | 16 ++++++++++------
+ src/CMakeLists.txt   | 13 ++++++-------
+ tools/CMakeLists.txt |  6 +++---
+ 3 files changed, 19 insertions(+), 16 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 07e15dd..8b5374c 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -8,6 +8,9 @@ find_package(ECM REQUIRED NO_MODULE)
+ set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} 
${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
+ set(CMAKE_AUTOMOC TRUE)
+ 
++# Akonadi Prefix: Set this to KF5 for builds with Akonadi Libs before 5.23
++set(AKO_PREFIX "KPim5")
++
+ include(KDEInstallDirs)
+ include(KDECMakeSettings)
+ include(ECMInstallIcons)
+@@ -47,23 +50,23 @@ set_package_properties(Grantlee5 PROPERTIES
+     TYPE OPTIONAL
+ )
+ 
+-find_package(KF5Akonadi)
+-set_package_properties(KF5Akonadi PROPERTIES
++find_package(${AKO_PREFIX}Akonadi)
++set_package_properties(${AKO_PREFIX}Akonadi PROPERTIES
+     DESCRIPTION "Library for general Access to Akonadi"
+     URL "https://www.kde.org/";
+     PURPOSE "Optionally used for addressbook integration"
+     TYPE OPTIONAL
+ )
+ 
+-find_package(KF5AkonadiContact)
+-set_package_properties(KF5AkonadiContact PROPERTIES
++find_package(${AKO_PREFIX}AkonadiContact)
++set_package_properties(${AKO_PREFIX}AkonadiContact PROPERTIES
+     DESCRIPTION "Library for Accessing Contacts stored in Akonadi"
+     URL "https://www.kde.org/";
+     PURPOSE "Optionally used for addressbook integration"
+     TYPE OPTIONAL
+ )
+ 
+-if(KF5Akonadi_FOUND AND KF5AkonadiContact_FOUND)
++if(${AKO_PREFIX}Akonadi_FOUND AND ${AKO_PREFIX}AkonadiContact_FOUND)
+    add_definitions(-DHAVE_AKONADI)
+ endif()
+ 
+@@ -80,7 +83,8 @@ set(QT_DEFINITIONS "${Qt5Core_DEFINITIONS} 
${Qt5Gui_DEFINITIONS} ${Qt5Widgets_DE
+ add_definitions(${QT_DEFINITIONS} )
+ 
+ include_directories(${QT_INCLUDES} src)
+-include_directories( /usr/include/KF5/AkonadiCore )
++include_directories( /usr/include/${AKO_PREFIX}/AkonadiCore )
++include_directories(/usr/include/${AKO_PREFIX}/)
+ 
+ if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/po")
+         ki18n_install(po)
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 6eaa557..8e9b069 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -1,4 +1,3 @@
+-# include_directories(${KDE4_INCLUDES} ${KDE4_INCLUDE_DIR} ${QT_INCLUDES} 
${CMAKE_CURRENT_BINARY_DIR} ${KDEPIMLIBS_INCLUDE_DIRS} external)
+ 
+ include_directories(${QT_INCLUDES} src)
+ add_subdirectory(pics)
+@@ -167,13 +166,13 @@ set(KRAFT_LINK_LIBS
+     ${CTEMPLATE_LIBRARIES} pthread
+     Grantlee5::Templates
+ )
+-if(KF5Akonadi_FOUND)
++if(${AKO_PREFIX}Akonadi_FOUND)
+   list(APPEND KRAFT_LINK_LIBS
+-    KF5::AkonadiCore
+-    KF5::AkonadiContact
+-    KF5::AkonadiAgentBase
+-    KF5::AkonadiWidgets
+-    KF5::AkonadiXml
++    ${AKO_PREFIX}::AkonadiCore
++    ${AKO_PREFIX}::AkonadiContact
++    ${AKO_PREFIX}::AkonadiAgentBase
++    ${AKO_PREFIX}::AkonadiWidgets
++    ${AKO_PREFIX}::AkonadiXml
+   )
+ endif()
+ 
+diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
+index 0c58c75..f005cfe 100644
+--- a/tools/CMakeLists.txt
++++ b/tools/CMakeLists.txt
+@@ -8,15 +8,15 @@ set(AUTOMOC ON)
+ # For now there is only the Akonadi based address backend, and thus
+ # the findcontact tool is only built if akonadi is there.
+ # If there are other backends, this must be FIXED.
+-if(KF5Akonadi_FOUND)
++if(${AKO_PREFIX}Akonadi_FOUND)
+     add_executable(${findcontact_NAME} ${FINDCONTACT_SRC})
+ 
+     target_link_libraries( ${findcontact_NAME}
+         Qt5::Core
+         Qt5::Widgets
+         KF5::Contacts
+-        KF5::AkonadiCore
+-        KF5::AkonadiContact
++        ${AKO_PREFIX}::AkonadiCore
++        ${AKO_PREFIX}::AkonadiContact
+     )
+ 
+     ########### install files ###############
+-- 
+2.42.0
+
+
+From 5a95547fe375d55f1bb690be14268b8a26b48204 Mon Sep 17 00:00:00 2001
+From: Klaas Freitag <[email protected]>
+Date: Sat, 29 Apr 2023 22:23:27 +0200
+Subject: [PATCH 2/3] use option to set AKO_PREFIX rather than an internal
+ variable
+
+(cherry picked from commit 50e090059365ddbacfd219325095f4f6c5f4aa7b)
+---
+ CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 8b5374c..f5ecc41 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -9,7 +9,7 @@ set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} 
${CMAKE_CURRENT_SOURCE_DIR}/cmake/modul
+ set(CMAKE_AUTOMOC TRUE)
+ 
+ # Akonadi Prefix: Set this to KF5 for builds with Akonadi Libs before 5.23
+-set(AKO_PREFIX "KPim5")
++option(AKO_PREFIX "Akonadi Prefix, either KF5 or KPim5, can be set by 
-DAKO_PREFIX=KF5" "KPim5")
+ 
+ include(KDEInstallDirs)
+ include(KDECMakeSettings)
+-- 
+2.42.0
+
+
+From e34c8b73ccd4d0142c7c16f8d4d4756cbacadd4d Mon Sep 17 00:00:00 2001
+From: Klaas Freitag <[email protected]>
+Date: Mon, 1 May 2023 14:09:09 +0200
+Subject: [PATCH 3/3] Fix Akonadi legacy detection
+
+(cherry picked from commit 66b64505bbfbc3285ba34ccacdf454720c8e0abc)
+---
+ CMakeLists.txt | 8 +++++++-
+ INSTALL.md     | 3 +++
+ 2 files changed, 10 insertions(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index f5ecc41..82b4e07 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -8,8 +8,14 @@ find_package(ECM REQUIRED NO_MODULE)
+ set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} 
${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
+ set(CMAKE_AUTOMOC TRUE)
+ 
++option(AKONADI_LEGACY_BUILD "Build with older versions of Akonadi (KF5 
Prefix)" OFF)
+ # Akonadi Prefix: Set this to KF5 for builds with Akonadi Libs before 5.23
+-option(AKO_PREFIX "Akonadi Prefix, either KF5 or KPim5, can be set by 
-DAKO_PREFIX=KF5" "KPim5")
++set(AKO_PREFIX "KPim5")
++
++if (AKONADI_LEGACY_BUILD)
++  set(AKO_PREFIX "KF5")
++endif()
++message("Akonadi Prefix is ${AKO_PREFIX}")
+ 
+ include(KDEInstallDirs)
+ include(KDECMakeSettings)
+diff --git a/INSTALL.md b/INSTALL.md
+index 1edd0ae..77d559c 100644
+--- a/INSTALL.md
++++ b/INSTALL.md
+@@ -59,6 +59,9 @@ These are optional to build with Akonadi Support:
+ - akonadi-contact-devel
+ - akonadi-devel
+ 
++To build with Akonadi versions before 23.04, cmake has to run wtih the
++build option `-DAKONADI_LEGACY_BUILD=ON` to use the old prefix KF5.
++
+ ### Build Kraft
+ 
+ cmake is designed so that the build process can be done in a separate
+-- 
+2.42.0
+

diff --git a/app-office/kraft/kraft-1.0.ebuild 
b/app-office/kraft/kraft-1.0.ebuild
new file mode 100644
index 000000000000..e4b2fb0e20c3
--- /dev/null
+++ b/app-office/kraft/kraft-1.0.ebuild
@@ -0,0 +1,54 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+VIRTUALX_REQUIRED="test"
+inherit ecm
+
+DESCRIPTION="Software to manage quotes and invoices in small enterprises"
+HOMEPAGE="https://www.volle-kraft-voraus.de/";
+SRC_URI="https://github.com/dragotin/${PN}/archive/v${PV}.tar.gz -> 
${P}.tar.gz"
+
+LICENSE="GPL-2+ LGPL-2+"
+SLOT="5"
+KEYWORDS="~amd64 ~x86"
+IUSE="pim"
+
+RESTRICT="test" # requires package installed, bug 745408
+
+DEPEND="
+       dev-cpp/ctemplate
+       dev-libs/grantlee:5
+       dev-qt/qtgui:5
+       dev-qt/qtsql:5
+       dev-qt/qtsvg:5
+       dev-qt/qtwidgets:5
+       dev-qt/qtxml:5
+       kde-frameworks/kconfig:5
+       kde-frameworks/kcontacts:5
+       kde-frameworks/ki18n:5
+       pim? (
+               >=kde-apps/akonadi-23.08.0:5
+               >=kde-apps/akonadi-contacts-23.08.0:5
+               kde-frameworks/kcoreaddons:5
+       )
+"
+RDEPEND="${DEPEND}"
+
+DOCS=( AUTHORS Changes.txt README.md Releasenotes.txt TODO )
+
+PATCHES=(
+       "${FILESDIR}/${P}-cmake.patch"
+       "${FILESDIR}/${P}-akonadi-23.08.patch"
+)
+
+src_configure() {
+       local mycmakeargs=(
+               -DCMAKE_DISABLE_FIND_PACKAGE_Asciidoctor=ON
+               $(cmake_use_find_package pim KPim5Akonadi)
+               $(cmake_use_find_package pim KPim5AkonadiContact)
+       )
+
+       ecm_src_configure
+}

Reply via email to