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

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #29 from matthewvogt/remove-from-name-groups
[libcontacts] Remove contacts from name groups on deletion
  • Loading branch information
matthewvogt committed Sep 4, 2013
2 parents cfadd18 + 83f878c commit dedbd89
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/seasidecache.cpp
Expand Up @@ -1777,26 +1777,34 @@ void SeasideCache::relationshipsAvailable()
}
}

void SeasideCache::removeRange(
FilterType filter, int index, int count)
void SeasideCache::removeRange(FilterType filter, int index, int count)
{
QVector<ContactIdType> &cacheIds = m_contacts[filter];
QList<ListModel *> &models = m_models[filter];

for (int i = 0; i < models.count(); ++i)
models[i]->sourceAboutToRemoveItems(index, index + count - 1);

QSet<QChar> modifiedNameGroups;

for (int i = 0; i < count; ++i) {
if (filter == FilterAll) {
const ContactIdType apiId = cacheIds.at(index);
m_expiredContacts[apiId] -= 1;

const QChar group(nameGroup(existingItem(apiId)));
if (!group.isNull()) {
removeFromContactNameGroup(internalId(apiId), group, &modifiedNameGroups);
}
}

cacheIds.remove(index);
}

for (int i = 0; i < models.count(); ++i)
models[i]->sourceItemsRemoved();

notifyNameGroupsChanged(modifiedNameGroups);
}

int SeasideCache::insertRange(
Expand Down

0 comments on commit dedbd89

Please sign in to comment.