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
[libcontacts] Name grouper fixes.
Allow grouper to override default set of groups. Ensure
returned group is in the valid list of groups.
  • Loading branch information
mbrasser-jolla committed Oct 22, 2013
1 parent f9ded72 commit 7faaae0
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/seasidecache.cpp
Expand Up @@ -575,13 +575,9 @@ void SeasideCache::setNameGrouper(SeasideNameGrouper *grouper)
new SeasideCache;
instancePtr->m_nameGrouper.reset(grouper);

allContactNameGroups = getAllContactNameGroups();
QStringList groups = instancePtr->m_nameGrouper->allNameGroups();
for (int i = groups.count() - 1; i > -1; --i) {
const QString &group = groups.at(i);
if (!allContactNameGroups.contains(group))
allContactNameGroups.prepend(group);
}
allContactNameGroups = instancePtr->m_nameGrouper->allNameGroups();
if (!allContactNameGroups.contains(QLatin1String("#")))
allContactNameGroups << QLatin1String("#");
}

QString SeasideCache::nameGroup(const CacheItem *cacheItem)
Expand All @@ -599,7 +595,7 @@ QString SeasideCache::determineNameGroup(const CacheItem *cacheItem)

if (!instancePtr->m_nameGrouper.isNull()) {
QString group = instancePtr->m_nameGrouper->nameGroupForContact(cacheItem->contact, instancePtr->m_groupProperty);
if (!group.isNull()) {
if (!group.isNull() && allContactNameGroups.contains(group)) {
return group;
}
}
Expand Down

0 comments on commit 7faaae0

Please sign in to comment.