From 96628d329085ff2d9df9a1341045246868cc2bd5 Mon Sep 17 00:00:00 2001 From: Sergey Chupligin Date: Tue, 15 Oct 2019 12:18:12 +0300 Subject: [PATCH] [libcontacts] Update API for QtPim 5.9 --- src/seasidecache.cpp | 24 +++++++++--------------- src/seasidecontactbuilder.cpp | 2 ++ src/seasideimport.cpp | 2 ++ src/seasidepropertyhandler.cpp | 1 + 5 files changed, 21 insertions(+), 19 deletions(-) diff --git a/src/seasidecache.cpp b/src/seasidecache.cpp index 035ab44..6a347b8 100644 --- a/src/seasidecache.cpp +++ b/src/seasidecache.cpp @@ -1717,11 +1717,7 @@ void SeasideCache::startRequest(bool *idleProcessing) requestPending = true; } else { QContactId aggregateId = m_contactsToFetchConstituents.first(); - - // Find the constituents of this contact - QContact first; - first.setId(aggregateId); - m_relationshipsFetchRequest.setFirst(first); + m_relationshipsFetchRequest.setFirst(aggregateId); m_relationshipsFetchRequest.setRelationshipType(QContactRelationship::Aggregates()); m_relationshipsFetchRequest.start(); } @@ -2566,7 +2562,7 @@ void SeasideCache::relationshipsAvailable() foreach (const QContactRelationship &rel, m_relationshipsFetchRequest.relationships()) { if (rel.relationshipType() == aggregatesRelationship) { - m_constituentIds.insert(apiId(rel.second())); + m_constituentIds.insert(rel.second()); } } } @@ -2779,7 +2775,7 @@ void SeasideCache::requestStateChanged(QContactAbstractRequest::State state) } foreach (const QContactRelationship &relationship, relationships) { - m_aggregatedContacts.insert(SeasideCache::apiId(relationship.first())); + m_aggregatedContacts.insert(relationship.first()); } if (completed) { @@ -2839,13 +2835,14 @@ void SeasideCache::requestStateChanged(QContactAbstractRequest::State state) QContactRelationshipFetchRequest *rfr = new QContactRelationshipFetchRequest(this); rfr->setManager(m_saveRequest.manager()); rfr->setRelationshipType(QContactRelationship::Aggregates()); - rfr->setSecond(c); + rfr->setSecond(c.id()); + connect(rfr, &QContactAbstractRequest::stateChanged, this, [this, c, rfr] { if (rfr->state() == QContactAbstractRequest::FinishedState) { rfr->deleteLater(); if (rfr->relationships().size()) { - const quint32 constituentId = internalId(apiId(rfr->relationships().at(0).second())); - const quint32 aggregateId = internalId(apiId(rfr->relationships().at(0).first())); + const quint32 constituentId = internalId(rfr->relationships().at(0).second()); + const quint32 aggregateId = internalId(rfr->relationships().at(0).first()); this->notifySaveContactComplete(constituentId, aggregateId); } else { // error: cannot retrieve aggregate for newly created constituent. @@ -3384,13 +3381,10 @@ int SeasideCache::contactIndex(quint32 iid, FilterType filterType) QContactRelationship SeasideCache::makeRelationship(const QString &type, const QContactId &id1, const QContactId &id2) { - QContact first, second; - first.setId(id1); - second.setId(id2); QContactRelationship relationship; relationship.setRelationshipType(type); - relationship.setFirst(first); - relationship.setSecond(second); + relationship.setFirst(id1); + relationship.setSecond(id2); return relationship; } diff --git a/src/seasidecontactbuilder.cpp b/src/seasidecontactbuilder.cpp index c3718f0..d518b85 100644 --- a/src/seasidecontactbuilder.cpp +++ b/src/seasidecontactbuilder.cpp @@ -72,6 +72,8 @@ #include #include +#include + namespace { QContactFetchHint basicFetchHint() diff --git a/src/seasideimport.cpp b/src/seasideimport.cpp index 40e3c67..dc4cfe2 100644 --- a/src/seasideimport.cpp +++ b/src/seasideimport.cpp @@ -35,6 +35,8 @@ #include #include +#include + namespace { QContactFetchHint basicFetchHint() { diff --git a/src/seasidepropertyhandler.cpp b/src/seasidepropertyhandler.cpp index 8bf0a12..0ddc128 100644 --- a/src/seasidepropertyhandler.cpp +++ b/src/seasidepropertyhandler.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include