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 #13 from matthewvogt/name-group-update
Browse files Browse the repository at this point in the history
Name group update
  • Loading branch information
matthewvogt committed Aug 12, 2013
2 parents b01bcf6 + b36bd12 commit db88363
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 22 deletions.
29 changes: 8 additions & 21 deletions src/seasidecache.cpp
Expand Up @@ -828,6 +828,13 @@ void SeasideCache::removeContactData(

m_contacts[filter].remove(row);

if (filter == FilterAll) {
QList<QChar> modifiedNameGroups;
const QChar nameGroup = nameGroupForCacheItem(existingItem(contactId));
removeFromContactNameGroup(internalId(contactId), nameGroup, &modifiedNameGroups);
notifyNameGroupsChanged(modifiedNameGroups);
}

for (int i = 0; i < models.count(); ++i)
models.at(i)->sourceItemsRemoved();
}
Expand Down Expand Up @@ -1636,24 +1643,6 @@ void SeasideCache::relationshipsAvailable()
}
}

void SeasideCache::finalizeUpdate(FilterType filter)
{
const QList<ContactIdType> queryIds = m_contactIdRequest.ids();
QVector<ContactIdType> &cacheIds = m_contacts[filter];

if (m_cacheIndex < cacheIds.count())
removeRange(filter, m_cacheIndex, cacheIds.count() - m_cacheIndex);

if (m_queryIndex < queryIds.count()) {
const int count = queryIds.count() - m_queryIndex;
if (count)
insertRange(filter, cacheIds.count(), count, queryIds, m_queryIndex);
}

m_cacheIndex = 0;
m_queryIndex = 0;
}

void SeasideCache::removeRange(
FilterType filter, int index, int count)
{
Expand Down Expand Up @@ -1761,8 +1750,7 @@ void SeasideCache::appendContacts(const QList<QContact> &contacts, FilterType fi
for (int i = 0; i < models.count(); ++i)
models.at(i)->sourceItemsInserted(begin, end);

if (!m_nameGroupChangeListeners.isEmpty())
notifyNameGroupsChanged(m_contactNameGroups.keys());
notifyNameGroupsChanged(m_contactNameGroups.keys());
}
}
}
Expand Down Expand Up @@ -1841,7 +1829,6 @@ void SeasideCache::requestStateChanged(QContactAbstractRequest::State state)
} else if (m_syncFilter != FilterNone) {
// We have completed fetching this filter set
completeSynchronizeList(this, m_contacts[m_syncFilter], m_cacheIndex, m_contactIdRequest.ids(), m_queryIndex);
finalizeUpdate(m_syncFilter);

if (m_syncFilter == FilterFavorites) {
// Next, query for all contacts (including favorites)
Expand Down
1 change: 0 additions & 1 deletion src/seasidecache.h
Expand Up @@ -365,7 +365,6 @@ private slots:
bool updateContactIndexing(const QContact &oldContact, const QContact &contact, quint32 iid, const QSet<DetailTypeId> &queryDetailTypes);
void updateCache(CacheItem *item, const QContact &contact, bool partialFetch);

void finalizeUpdate(FilterType filter);
void removeRange(FilterType filter, int index, int count);
int insertRange(
FilterType filter,
Expand Down

0 comments on commit db88363

Please sign in to comment.