diff options
author | Bart Ribbers <bribbers@disroot.org> | 2021-04-14 15:01:08 +0200 |
---|---|---|
committer | Bart Ribbers <bribbers@disroot.org> | 2021-04-14 14:20:39 +0000 |
commit | d5eb1f470d47a953141fcde98024a715727236e0 (patch) | |
tree | 0bea33bc568cdef5346c2b6d540b59e84e6fce65 | |
parent | e915ed30dba9989f36ce73665cacb22f5d843688 (diff) |
testing/qtcontacts-sqlite: new aport
-rw-r--r-- | testing/qtcontacts-sqlite/0001-fix-build-with-newer-qt.patch | 409 | ||||
-rw-r--r-- | testing/qtcontacts-sqlite/0002-drop-old-api.patch | 370 | ||||
-rw-r--r-- | testing/qtcontacts-sqlite/APKBUILD | 36 |
3 files changed, 815 insertions, 0 deletions
diff --git a/testing/qtcontacts-sqlite/0001-fix-build-with-newer-qt.patch b/testing/qtcontacts-sqlite/0001-fix-build-with-newer-qt.patch new file mode 100644 index 00000000000..b617ec7024b --- /dev/null +++ b/testing/qtcontacts-sqlite/0001-fix-build-with-newer-qt.patch @@ -0,0 +1,409 @@ +From 9bf3a397c46be850ec39c00265b5315e3ba3a9e9 Mon Sep 17 00:00:00 2001 +From: Sergey Chupligin <s.chupligin@omprussia.ru> +Date: Thu, 8 Nov 2018 13:20:45 +0300 +Subject: [PATCH] Fix build with qt 5.9 + +--- + qtcontacts-sqlite.pro | 3 +-- + rpm/qtcontacts-sqlite-qt5.spec | 26 ++++++++++++++------------ + src/engine/contactid.cpp | 26 ++++++++++++++++++++++++++ + src/engine/contactid_p.h | 16 +++++++++++++--- + src/engine/contactreader.cpp | 21 ++++++++++++++++++++- + src/engine/contactsengine.cpp | 20 ++++++++++++++++++++ + src/engine/contactsengine.h | 7 ++++++- + src/engine/contactsplugin.cpp | 4 ++++ + src/engine/contactwriter.cpp | 15 ++++++++++++++- + 9 files changed, 118 insertions(+), 20 deletions(-) + +diff --git a/qtcontacts-sqlite.pro b/qtcontacts-sqlite.pro +index 6ae3cad..ae42f79 100644 +--- a/qtcontacts-sqlite.pro ++++ b/qtcontacts-sqlite.pro +@@ -1,7 +1,6 @@ + TEMPLATE = subdirs + SUBDIRS = \ +- src \ +- tests ++ src + OTHER_FILES += rpm/qtcontacts-sqlite-qt5.spec + + tests.depends = src +diff --git a/rpm/qtcontacts-sqlite-qt5.spec b/rpm/qtcontacts-sqlite-qt5.spec +index 050ff6b..8bbb896 100644 +--- a/rpm/qtcontacts-sqlite-qt5.spec ++++ b/rpm/qtcontacts-sqlite-qt5.spec +@@ -1,3 +1,5 @@ ++%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 +@@ -20,19 +22,19 @@ 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} ++#%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. ++#%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 ++#%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 +@@ -52,7 +54,7 @@ This package contains extension headers for the qtcontacts-sqlite-qt5 library. + %setup -q -n %{name}-%{version} + + %build +-%qmake5 "VERSION=%{version}" ++%qmake5 "VERSION=%{version}" QTPIM_VERSION=%{qtpim_verion} + make %{?_smp_mflags} + + %install +diff --git a/src/engine/contactid.cpp b/src/engine/contactid.cpp +index 7f7c733..47025e8 100644 +--- a/src/engine/contactid.cpp ++++ b/src/engine/contactid.cpp +@@ -52,6 +52,15 @@ quint32 dbIdFromString(const QString &s) + return 0; + } + ++QByteArray dbIdToLocalId(quint32 dbId) ++{ ++ return QByteArray::number(dbId); ++} ++ ++quint32 dbIdFromLocalId(const QByteArray &s) ++{ ++ return quint32(s.toLongLong()); ++} + } + + #include <QContactManagerEngine> +@@ -63,10 +72,16 @@ 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 + } + ++ + quint32 ContactId::databaseId(const QContact &contact) + { + return databaseId(contact.id()); +@@ -74,13 +89,18 @@ 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 + } + ++ + const QContactId &ContactId::contactId(const QContactId &apiId) + { + return apiId; +@@ -88,9 +108,14 @@ 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) +@@ -122,6 +147,7 @@ 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 99ca31f..3cd708f 100644 +--- a/src/engine/contactid_p.h ++++ b/src/engine/contactid_p.h +@@ -36,17 +36,25 @@ + #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); +- static QContactId apiId(quint32 databaseId); +- + static quint32 databaseId(const QContact &contact); ++ ++ static QContactId apiId(quint32 databaseId); + static quint32 databaseId(const QContactId &apiId); + + static const QContactId &contactId(const QContactId &apiId); +@@ -63,11 +71,13 @@ public: + ContactId(quint32 databaseId); + 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; +- QString managerUri() 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 4d47ef6..2f17bda 100644 +--- a/src/engine/contactreader.cpp ++++ b/src/engine/contactreader.cpp +@@ -658,10 +658,15 @@ 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); + +@@ -1227,7 +1232,11 @@ 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(); +@@ -2175,7 +2184,17 @@ 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") { ++ gender.setGender(QContactGender::GenderType::GenderFemale); ++ } 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 eaf7a1e..301ace8 100644 +--- a/src/engine/contactsengine.cpp ++++ b/src/engine/contactsengine.cpp +@@ -466,8 +466,13 @@ 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 + { + } + +@@ -1390,6 +1395,13 @@ static QList<QContactId> idList(const QVector<quint32> &contactIds) + return ids; + } + ++static QList<QContactDetail::DetailType> detalId() ++{ ++//TODO add list of changed types of contacts id. Now return all changes; ++ QList<QContactDetail::DetailType> dId; ++ return dId; ++} ++ + void ContactsEngine::_q_contactsAdded(const QVector<quint32> &contactIds) + { + emit contactsAdded(idList(contactIds)); +@@ -1397,13 +1409,21 @@ 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 b79dece..781df49 100644 +--- a/src/engine/contactsengine.h ++++ b/src/engine/contactsengine.h +@@ -118,7 +118,12 @@ public: + const QString &relationshipType, + const QContact &participant, + QContactRelationship::Role role, +- QContactManager::Error *error) const override; ++ QContactManager::Error *error) const ++#if QTPIM_VERSION < 59 ++ override ++#endif ++ ; ++ + bool saveRelationships( + QList<QContactRelationship> *relationships, + QMap<int, QContactManager::Error> *errorMap, +diff --git a/src/engine/contactsplugin.cpp b/src/engine/contactsplugin.cpp +index d5a1a5e..d662211 100644 +--- a/src/engine/contactsplugin.cpp ++++ b/src/engine/contactsplugin.cpp +@@ -48,8 +48,10 @@ 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 + }; + + +@@ -77,11 +79,13 @@ 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 2835e6f..f2aaef9 100644 +--- a/src/engine/contactwriter.cpp ++++ b/src/engine/contactwriter.cpp +@@ -413,9 +413,13 @@ 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(); +@@ -2693,7 +2697,11 @@ 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>(); +@@ -2735,11 +2743,16 @@ 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 + diff --git a/testing/qtcontacts-sqlite/0002-drop-old-api.patch b/testing/qtcontacts-sqlite/0002-drop-old-api.patch new file mode 100644 index 00000000000..5f8e7e158b8 --- /dev/null +++ b/testing/qtcontacts-sqlite/0002-drop-old-api.patch @@ -0,0 +1,370 @@ +From 246138505cedc96dbcc2a1c6067befa1b4410b6a Mon Sep 17 00:00:00 2001 +From: Sergey Chupligin <neochapay@gmail.com> +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 + diff --git a/testing/qtcontacts-sqlite/APKBUILD b/testing/qtcontacts-sqlite/APKBUILD new file mode 100644 index 00000000000..3829d6088e6 --- /dev/null +++ b/testing/qtcontacts-sqlite/APKBUILD @@ -0,0 +1,36 @@ +# Contributor: Bart Ribbers <bribbers@disroot.org> +# Maintainer: Bart Ribbers <bribbers@disroot.org> +pkgname=qtcontacts-sqlite +pkgver=0.2.39 +pkgrel=0 +pkgdesc="A backend for the QtContacts API" +url="https://git.sailfishos.org/mer-core/qtcontacts-sqlite" +arch="all" +license="BSD-3-Clause" +makedepends=" + mlite-dev + qt5-qtbase-dev + qt5-qtpim-dev + " +source="https://git.sailfishos.org/mer-core/qtcontacts-sqlite/-/archive/$pkgver/qtcontacts-sqlite-$pkgver.tar.gz + 0001-fix-build-with-newer-qt.patch + 0002-drop-old-api.patch + " +subpackages="$pkgname-dev" + +build() { + qmake-qt5 PREFIX=/usr + make +} + +check() { + make check +} + +package() { + INSTALL_ROOT="$pkgdir" make install +} + +sha512sums="ff62b67b96bb150abd06e23b47d13abebb00da05ccf4ed92b269df3cf48f2c0f8ec1312242326ffe6e51f8dee49b6d057976ac759cf4f5fd6342c501f695fd2c qtcontacts-sqlite-0.2.39.tar.gz +1096452e2326b311c4b14169cf5e0779cf9955c800178bc5b74d1706c76507b4d82442a50d8b707ac5df12f99dd6faf7a2374e554c2159408fa453b10d7f1ff6 0001-fix-build-with-newer-qt.patch +036af277c180584106b92d34dbf90aeda10bcad5fbdfa17b69f4d9c461a01c48bdf93ed07f2c8bd990d6c6e259576013f4e1b77069dfa1abf4206513e319b781 0002-drop-old-api.patch" |