From 74aa135a334bdfd08db973bb58663c8f44dd09a1 Mon Sep 17 00:00:00 2001 From: Chris Adams Date: Thu, 16 May 2019 19:46:32 +1000 Subject: [PATCH] [libcontacts] Also update section bucket index cache during list synchronisation. Contributes to JB#45836 Batch updates are handled via list synchronisation. We need to ensure that we update the section bucket index cache of any model after a list synchronisation occurs. --- src/seasidecache.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/seasidecache.cpp b/src/seasidecache.cpp index f7464d2..8524eab 100644 --- a/src/seasidecache.cpp +++ b/src/seasidecache.cpp @@ -2574,8 +2574,10 @@ void SeasideCache::removeRange(FilterType filter, int index, int count) cacheIds.removeAt(index); } - for (int i = 0; i < models.count(); ++i) + for (int i = 0; i < models.count(); ++i) { models[i]->sourceItemsRemoved(); + models[i]->updateSectionBucketIndexCache(); + } } int SeasideCache::insertRange(FilterType filter, int index, int count, const QList &queryIds, int queryIndex) @@ -2602,8 +2604,10 @@ int SeasideCache::insertRange(FilterType filter, int index, int count, const QLi cacheIds.insert(index + i, iid); } - for (int i = 0; i < models.count(); ++i) + for (int i = 0; i < models.count(); ++i) { models[i]->sourceItemsInserted(index, end); + models[i]->updateSectionBucketIndexCache(); + } return end - index + 1; }