summaryrefslogtreecommitdiff
path: root/app-office/kraft/files/kraft-1.0-akonadi-23.08.patch
blob: 40fdd6383d4a7440b6835ecffac7f6d789776faf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
From ba3a0e4c1d232b05daddd9ded110e15e0a3c9005 Mon Sep 17 00:00:00 2001
From: Klaas Freitag <freitag@owncloud.com>
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 <freitag@owncloud.com>
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();
       }