Commit ff44b52d authored by mvogt's avatar mvogt

[libcontacts] Update the synchronizeList function

Also restore pre-fetching of favorite contact details.
parent e702826d
...@@ -1384,6 +1384,15 @@ void SeasideCache::requestStateChanged(QContactAbstractRequest::State state) ...@@ -1384,6 +1384,15 @@ void SeasideCache::requestStateChanged(QContactAbstractRequest::State state)
cacheItem->itemData->mergeCandidatesFetched(candidateIds); cacheItem->itemData->mergeCandidatesFetched(candidateIds);
} }
} }
else if (m_fetchFilter != FilterNone) {
// We have completed fetching this filter set
completeSynchronizeList(
this,
m_contacts[m_fetchFilter],
m_cacheIndex,
m_contactIdRequest.ids(),
m_queryIndex);
}
} else if (request == &m_relationshipSaveRequest || request == &m_relationshipRemoveRequest) { } else if (request == &m_relationshipSaveRequest || request == &m_relationshipRemoveRequest) {
QSet<ContactIdType> contactIds; QSet<ContactIdType> contactIds;
foreach (const QContactRelationship &relationship, m_relationshipSaveRequest.relationships() + foreach (const QContactRelationship &relationship, m_relationshipSaveRequest.relationships() +
...@@ -1614,9 +1623,10 @@ void SeasideCache::keepPopulated() ...@@ -1614,9 +1623,10 @@ void SeasideCache::keepPopulated()
if (!m_keepPopulated) { if (!m_keepPopulated) {
m_keepPopulated = true; m_keepPopulated = true;
// Start a query to fully populate the cache // Start a query to fully populate the cache, starting with favorites
m_refreshRequired = true; m_fetchFilter = FilterFavorites;
requestUpdate(); m_fetchRequest.setFilter(QContactFavorite::match());
m_fetchRequest.start();
} }
} }
......
This diff is collapsed.
...@@ -234,17 +234,7 @@ void tst_SynchronizeLists::filtered() ...@@ -234,17 +234,7 @@ void tst_SynchronizeLists::filtered()
m_cache = original; m_cache = original;
m_filter = expected; m_filter = expected;
int c = 0; synchronizeFilteredList(this, m_cache, reference);
int r = 0;
synchronizeFilteredList(this, m_cache, c, reference, r);
if (c < m_cache.count())
m_cache.remove(c, m_cache.count() - c);
for (; r < reference.count(); ++r) {
if (m_filter.contains(reference.at(r)))
m_cache.append(reference.at(r));
}
if (m_cache != expected) { if (m_cache != expected) {
qDebug() << "expected" << expected; qDebug() << "expected" << expected;
...@@ -290,15 +280,7 @@ void tst_SynchronizeLists::unfiltered() ...@@ -290,15 +280,7 @@ void tst_SynchronizeLists::unfiltered()
m_filterEnabled = false; m_filterEnabled = false;
m_cache = original; m_cache = original;
int c = 0; synchronizeList(this, m_cache, reference);
int r = 0;
synchronizeList(this, m_cache, c, reference, r);
if (c < m_cache.count())
m_cache.remove(c, m_cache.count() - c);
for (; r < reference.count(); ++r)
m_cache.append(reference.at(r));
if (m_cache != reference) { if (m_cache != reference) {
qDebug() << "expected" << reference; qDebug() << "expected" << reference;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment