Skip to content
This repository has been archived by the owner on Sep 4, 2021. It is now read-only.

Commit

Permalink
Merge pull request #68 from matthewvogt/batch-append
Browse files Browse the repository at this point in the history
[libcontacts] Append contacts in batches
  • Loading branch information
matthewvogt committed Dec 21, 2013
2 parents 35da1ee + a5af87b commit fd74456
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions src/seasidecache.cpp
Expand Up @@ -2073,23 +2073,21 @@ void SeasideCache::applyPendingContactUpdates()
const bool partialFetch = !detailTypes.isEmpty();

QList<QContact> &appendedContacts((*it).second);
appendContacts(QList<QContact>() << appendedContacts.takeFirst(), type, partialFetch, detailTypes);

if (appendedContacts.isEmpty()) {
m_contactsToAppend.erase(it);

// This list has been processed - have we finished populating the group?
if (type == FilterFavorites && (m_populateProgress != FetchFavorites)) {
makePopulated(FilterFavorites);
qDebug() << "Favorites queried in" << m_timer.elapsed() << "ms";
} else if (type == FilterAll && (m_populateProgress != FetchMetadata)) {
makePopulated(FilterNone);
makePopulated(FilterAll);
qDebug() << "All queried in" << m_timer.elapsed() << "ms";
} else if (type == FilterOnline && (m_populateProgress != FetchOnline)) {
makePopulated(FilterOnline);
qDebug() << "Online queried in" << m_timer.elapsed() << "ms";
}
appendContacts(appendedContacts, type, partialFetch, detailTypes);

m_contactsToAppend.erase(it);

// This list has been processed - have we finished populating the group?
if (type == FilterFavorites && (m_populateProgress != FetchFavorites)) {
makePopulated(FilterFavorites);
qDebug() << "Favorites queried in" << m_timer.elapsed() << "ms";
} else if (type == FilterAll && (m_populateProgress != FetchMetadata)) {
makePopulated(FilterNone);
makePopulated(FilterAll);
qDebug() << "All queried in" << m_timer.elapsed() << "ms";
} else if (type == FilterOnline && (m_populateProgress != FetchOnline)) {
makePopulated(FilterOnline);
qDebug() << "Online queried in" << m_timer.elapsed() << "ms";
}
} else {
QList<QPair<QSet<DetailTypeId>, QList<QContact> > >::iterator it = m_contactsToUpdate.begin();
Expand Down

0 comments on commit fd74456

Please sign in to comment.