diff --git a/src/seasidecache.cpp b/src/seasidecache.cpp index a5908fa..edee2cc 100644 --- a/src/seasidecache.cpp +++ b/src/seasidecache.cpp @@ -63,6 +63,7 @@ #include #include #include +#include #include #include @@ -187,19 +188,29 @@ QContactFetchHint presenceFetchHint() return fetchHint; } -QContactFetchHint metadataFetchHint(quint32 fetchTypes = 0) +DetailList contactsTableDetails() { - QContactFetchHint fetchHint(basicFetchHint()); - - // Include all detail types which come from the main contacts table DetailList types; + + // These details are reported in every query types << detailType() << detailType() << detailType() << detailType() << + detailType() << detailType() << detailType(); + return types; +} + +QContactFetchHint metadataFetchHint(quint32 fetchTypes = 0) +{ + QContactFetchHint fetchHint(basicFetchHint()); + + // Include all detail types which come from the main contacts table + DetailList types(contactsTableDetails()); + // Include nickname, as some contacts have no other name types << detailType(); @@ -2206,7 +2217,13 @@ void updateDetailsFromCache(QContact &contact, SeasideCache::CacheItem *item, co { // Copy any existing detail types that are in the current record to the new instance foreach (const QContactDetail &existing, item->contact.details()) { - if (!queryDetailTypes.contains(detailType(existing))) { + const DetailTypeId existingType(detailType(existing)); + + static const DetailList contactsTableTypes(contactsTableDetails()); + + // The queried contact already contains any types in the contacts table, and those + // types explicitly fetched by the query + if (!queryDetailTypes.contains(existingType) && !contactsTableTypes.contains(existingType)) { QContactDetail copy(existing); contact.saveDetail(©); }