-
Notifications
You must be signed in to change notification settings - Fork 0
/
0002-drop-old-api.patch
370 lines (336 loc) · 11.8 KB
/
0002-drop-old-api.patch
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
From 246138505cedc96dbcc2a1c6067befa1b4410b6a Mon Sep 17 00:00:00 2001
From: Sergey Chupligin <[email protected]>
Date: Wed, 4 Mar 2020 11:48:42 +0300
Subject: [PATCH] [packaging] Drop old api
---
rpm/qtcontacts-sqlite-qt5.spec | 20 ++-----------
src/engine/contactid.cpp | 51 ----------------------------------
src/engine/contactid_p.h | 14 ----------
src/engine/contactreader.cpp | 14 ----------
src/engine/contactsengine.cpp | 13 ---------
src/engine/contactsengine.h | 6 +---
src/engine/contactsplugin.cpp | 13 ---------
src/engine/contactwriter.cpp | 18 +-----------
8 files changed, 4 insertions(+), 145 deletions(-)
diff --git a/rpm/qtcontacts-sqlite-qt5.spec b/rpm/qtcontacts-sqlite-qt5.spec
index 8bbb896..18949ed 100644
--- a/rpm/qtcontacts-sqlite-qt5.spec
+++ b/rpm/qtcontacts-sqlite-qt5.spec
@@ -1,5 +1,3 @@
-%define qtpim_verion %(rpm -q --qf "%{VERS""ION}\n" qt5-qtpim-contacts | tr --delete . | cut -f1 -d"+" | cut -c1-3)
-
Name: qtcontacts-sqlite-qt5
Version: 0.2.36
Release: 0
@@ -11,7 +9,7 @@ Source0: %{name}-%{version}.tar.gz
BuildRequires: pkgconfig(Qt5Core)
BuildRequires: pkgconfig(Qt5Sql)
BuildRequires: pkgconfig(Qt5DBus)
-BuildRequires: pkgconfig(Qt5Contacts)
+BuildRequires: qt5-qtpim-contacts-devel >= 5.9.0
BuildRequires: pkgconfig(mlite5)
Requires: qt5-plugin-sqldriver-sqlite
@@ -22,20 +20,6 @@ Requires: qt5-plugin-sqldriver-sqlite
%defattr(-,root,root,-)
%{_libdir}/qt5/plugins/contacts/*.so*
-#%package tests
-#Summary: Unit tests for qtcontacts-sqlite-qt5
-#Group: System/Libraries
-#BuildRequires: pkgconfig(Qt5Test)
-#Requires: %{name} = %{version}-%{release}
-
-#%description tests
-#This package contains unit tests for the qtcontacts-sqlite-qt5 library.
-
-#%files tests
-#%defattr(-,root,root,-)
-#/opt/tests/qtcontacts-sqlite-qt5/*
-#%{_libdir}/qtcontacts-sqlite-qt5/libtestdlgg.so
-
%package extensions
Summary: QtContacts extension headers for qtcontacts-sqlite-qt5
Group: Development/Libraries
@@ -54,7 +38,7 @@ This package contains extension headers for the qtcontacts-sqlite-qt5 library.
%setup -q -n %{name}-%{version}
%build
-%qmake5 "VERSION=%{version}" QTPIM_VERSION=%{qtpim_verion}
+%qmake5 "VERSION=%{version}"
make %{?_smp_mflags}
%install
diff --git a/src/engine/contactid.cpp b/src/engine/contactid.cpp
index 47025e8..8944d2b 100644
--- a/src/engine/contactid.cpp
+++ b/src/engine/contactid.cpp
@@ -72,13 +72,8 @@ QContactId ContactId::apiId(const QContact &contact)
QContactId ContactId::apiId(quint32 dbId)
{
-#if QTPIM_VERSION < 59
- ContactId *eid = new ContactId(dbId);
- return QContactId(eid);
-#else
return QContactId(QContactManager::buildUri(default_uri, QMap<QString, QString>()),
dbIdToLocalId(dbId));
-#endif
}
@@ -89,15 +84,7 @@ quint32 ContactId::databaseId(const QContact &contact)
quint32 ContactId::databaseId(const QContactId &apiId)
{
-#if QTPIM_VERSION < 59
- if (const QContactEngineId *eid = QContactManagerEngine::engineId(apiId)) {
- const ContactId *iid = static_cast<const ContactId*>(eid);
- return iid->m_databaseId;
- }
- return 0;
-#else
return dbIdFromLocalId(apiId.localId());
-#endif
}
@@ -108,46 +95,8 @@ const QContactId &ContactId::contactId(const QContactId &apiId)
QContactId ContactId::fromString(const QString &s)
{
-#if QTPIM_VERSION < 59
- return apiId(dbIdFromString(s));
-#else
return apiId(dbIdFromLocalId(s.toUtf8()));
-#endif
-}
-
-#if QTPIM_VERSION < 59
-ContactId::ContactId(quint32 dbId)
- : QContactEngineId()
- , m_databaseId(dbId)
-{
-}
-
-ContactId::ContactId(const QString &s)
- : QContactEngineId()
- , m_databaseId(dbIdFromString(s))
-{
-}
-
-bool ContactId::isEqualTo(const QContactEngineId *other) const
-{
- return m_databaseId == static_cast<const ContactId*>(other)->m_databaseId;
-}
-
-bool ContactId::isLessThan(const QContactEngineId *other) const
-{
- return m_databaseId < static_cast<const ContactId*>(other)->m_databaseId;
-}
-
-QString ContactId::managerUri() const
-{
- return QContactManager::buildUri(default_uri, QMap<QString, QString>());
-}
-
-QContactEngineId* ContactId::clone() const
-{
- return new ContactId(m_databaseId);
}
-#endif
QString ContactId::toString() const
{
diff --git a/src/engine/contactid_p.h b/src/engine/contactid_p.h
index 3cd708f..7903185 100644
--- a/src/engine/contactid_p.h
+++ b/src/engine/contactid_p.h
@@ -36,19 +36,11 @@
#include <QContactId>
#include <QContact>
-#if QTPIM_VERSION < 59
-#include <QContactEngineId>
-#else
#include <QSharedDataPointer>
-#endif
QTCONTACTS_USE_NAMESPACE
-#if QTPIM_VERSION < 59
-class ContactId : public QContactEngineId
-#else
class ContactId : public QSharedData
-#endif
{
public:
static QContactId apiId(const QContact &contact);
@@ -72,12 +64,6 @@ public:
ContactId(const QString &s);
QString managerUri() const;
-#if QTPIM_VERSION < 59
- // implementing QContactEngineId:
- bool isEqualTo(const QContactEngineId *other) const;
- bool isLessThan(const QContactEngineId *other) const;
- QContactEngineId* clone() const;
-#endif
QString toString() const;
#ifndef QT_NO_DEBUG_STREAM
diff --git a/src/engine/contactreader.cpp b/src/engine/contactreader.cpp
index 2f17bda..6d24213 100644
--- a/src/engine/contactreader.cpp
+++ b/src/engine/contactreader.cpp
@@ -658,15 +658,9 @@ static QContactRelationship makeRelationship(const QString &type, quint32 firstI
{
QContactRelationship relationship;
relationship.setRelationshipType(type);
-#if QTPIM_VERSION < 59
- QContact first, second;
- first.setId(ContactId::apiId(firstId));
- second.setId(ContactId::apiId(secondId));
-#else
QContactId first, second;
first = QContactId::fromString(QString::number(firstId));
second = QContactId::fromString(QString::number(secondId));
-#endif
relationship.setFirst(first);
relationship.setSecond(second);
@@ -1232,11 +1226,7 @@ static QString buildWhere(const QContactIdFilter &filter, ContactsDatabase &db,
static QString buildWhere(const QContactRelationshipFilter &filter, QVariantList *bindings, bool *failed)
{
-#if QTPIM_VERSION < 59
- QContactId rci = filter.relatedContact().id();
-#else
QContactId rci = filter.relatedContactId();
-#endif
QContactRelationship::Role rcr = filter.relatedContactRole();
QString rt = filter.relationshipType();
@@ -2184,9 +2174,6 @@ QContactManager::Error ContactReader::queryContacts(
QContactGender gender;
// Gender is an enum in qtpim
QString genderText = contactQuery.value(col++).toString();
-#if QTPIM_VERSION < 59
- gender.setGender(static_cast<QContactGender::GenderField>(genderText.toInt()));
-#else
if(genderText == "Male") {
gender.setGender(QContactGender::GenderType::GenderMale);
} else if (genderText == "Female") {
@@ -2194,7 +2181,6 @@ QContactManager::Error ContactReader::queryContacts(
} else {
gender.setGender(QContactGender::GenderType::GenderUnspecified);
}
-#endif
contact.saveDetail(&gender);
QContactFavorite favorite;
diff --git a/src/engine/contactsengine.cpp b/src/engine/contactsengine.cpp
index 301ace8..0d1fe4c 100644
--- a/src/engine/contactsengine.cpp
+++ b/src/engine/contactsengine.cpp
@@ -466,13 +466,8 @@ public:
RelationshipFetchJob(QContactRelationshipFetchRequest *request)
: TemplateJob(request)
, m_type(request->relationshipType())
-#if QTPIM_VERSION < 59
- , m_first(request->first().id())
- , m_second(request->second().id())
-#else
, m_first(request->first().managerUri(), request->first().localId())
, m_second(request->second().managerUri(), request->second().localId())
-#endif
{
}
@@ -1409,21 +1404,13 @@ void ContactsEngine::_q_contactsAdded(const QVector<quint32> &contactIds)
void ContactsEngine::_q_contactsChanged(const QVector<quint32> &contactIds)
{
-#if QTPIM_VERSION < 59
- emit contactsChanged(idList(contactIds));
-#else
emit contactsChanged(idList(contactIds), detalId());
-#endif
}
void ContactsEngine::_q_contactsPresenceChanged(const QVector<quint32> &contactIds)
{
if (m_mergePresenceChanges) {
-#if QTPIM_VERSION < 59
- emit contactsChanged(idList(contactIds));
-#else
emit contactsChanged(idList(contactIds), detalId());
-#endif
} else {
emit contactsPresenceChanged(idList(contactIds));
}
diff --git a/src/engine/contactsengine.h b/src/engine/contactsengine.h
index 781df49..24c2659 100644
--- a/src/engine/contactsengine.h
+++ b/src/engine/contactsengine.h
@@ -118,11 +118,7 @@ public:
const QString &relationshipType,
const QContact &participant,
QContactRelationship::Role role,
- QContactManager::Error *error) const
-#if QTPIM_VERSION < 59
- override
-#endif
- ;
+ QContactManager::Error *error) const;
bool saveRelationships(
QList<QContactRelationship> *relationships,
diff --git a/src/engine/contactsplugin.cpp b/src/engine/contactsplugin.cpp
index d662211..f0f936a 100644
--- a/src/engine/contactsplugin.cpp
+++ b/src/engine/contactsplugin.cpp
@@ -48,10 +48,6 @@ public:
QContactManagerEngine *engine(
const QMap<QString, QString> ¶meters, QContactManager::Error* error);
QString managerName() const;
-#if QTPIM_VERSION < 59
- QContactEngineId *createContactEngineId(
- const QMap<QString, QString> ¶meters, const QString &engineIdString) const;
-#endif
};
@@ -79,13 +75,4 @@ QString ContactsFactory::managerName() const
return QString::fromLatin1("org.nemomobile.contacts.sqlite");
}
-#if QTPIM_VERSION < 59
-QContactEngineId *ContactsFactory::createContactEngineId(
- const QMap<QString, QString> ¶meters, const QString &engineIdString) const
-{
- Q_UNUSED(parameters)
- return new ContactId(engineIdString);
-}
-#endif
-
#include "contactsplugin.moc"
diff --git a/src/engine/contactwriter.cpp b/src/engine/contactwriter.cpp
index f2aaef9..3e4fd66 100644
--- a/src/engine/contactwriter.cpp
+++ b/src/engine/contactwriter.cpp
@@ -413,13 +413,9 @@ QContactManager::Error ContactWriter::saveRelationships(
for (int i = 0; i < relationships.size(); ++i) {
const QContactRelationship &relationship = relationships.at(i);
-#if QTPIM_VERSION < 59
- QContactId first(relationship.first().id());
- QContactId second(relationship.second().id());
-#else
QContactId first = relationship.first();
QContactId second = relationship.second();
-#endif
+
const quint32 firstId = ContactId::databaseId(first);
const quint32 secondId = ContactId::databaseId(second);
const QString &type = relationship.relationshipType();
@@ -2697,11 +2693,7 @@ static void promoteDetailsToLocal(const QList<QContactDetail> addDelta, const QL
localContact->saveDetail(<s);
} else if (type == detailType<QContactGender>()) {
QContactGender lg = localContact->detail<QContactGender>();
-#if QTPIM_VERSION < 59
- lg.setGender(static_cast<QContactGender::GenderField>(original.value<int>(QContactGender::FieldGender)));
-#else
lg.setGender(lg.gender());
-#endif
localContact->saveDetail(&lg);
} else if (type == detailType<QContactFavorite>()) {
QContactFavorite lf = localContact->detail<QContactFavorite>();
@@ -2743,16 +2735,8 @@ static QContactRelationship makeRelationship(const QString &type, const QContact
QContactRelationship relationship;
relationship.setRelationshipType(type);
-#if QTPIM_VERSION < 59
- QContact first, second;
- first.setId(firstId);
- second.setId(secondId);
- relationship.setFirst(first);
- relationship.setSecond(second);
-#else
relationship.setFirst(firstId);
relationship.setSecond(secondId);
-#endif
return relationship;
}
--
2.23.0