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)
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) {
QSet<ContactIdType> contactIds;
foreach (const QContactRelationship &relationship, m_relationshipSaveRequest.relationships() +
......@@ -1614,9 +1623,10 @@ void SeasideCache::keepPopulated()
if (!m_keepPopulated) {
m_keepPopulated = true;
// Start a query to fully populate the cache
m_refreshRequired = true;
requestUpdate();
// Start a query to fully populate the cache, starting with favorites
m_fetchFilter = FilterFavorites;
m_fetchRequest.setFilter(QContactFavorite::match());
m_fetchRequest.start();
}
}
......
This diff is collapsed.
......@@ -234,17 +234,7 @@ void tst_SynchronizeLists::filtered()
m_cache = original;
m_filter = expected;
int c = 0;
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));
}
synchronizeFilteredList(this, m_cache, reference);
if (m_cache != expected) {
qDebug() << "expected" << expected;
......@@ -290,15 +280,7 @@ void tst_SynchronizeLists::unfiltered()
m_filterEnabled = false;
m_cache = original;
int c = 0;
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));
synchronizeList(this, m_cache, reference);
if (m_cache != 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