From 46d4c66184be0b4c0a5cc8eaf0f866c795c7ff35 Mon Sep 17 00:00:00 2001 From: Matt Vogt Date: Mon, 5 Aug 2013 16:33:29 +1000 Subject: [PATCH] Qt4 fixes --- src/seasidecache.cpp | 38 ++++++++++++++++++++++++-------------- src/seasidecache.h | 2 +- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/src/seasidecache.cpp b/src/seasidecache.cpp index 17e9500..324c709 100644 --- a/src/seasidecache.cpp +++ b/src/seasidecache.cpp @@ -132,7 +132,7 @@ QString managerName() typedef QList DetailList; template -DetailList::value_type detailType() +DetailTypeId detailType() { #ifdef USING_QTPIM return T::Type; @@ -141,7 +141,7 @@ DetailList::value_type detailType() #endif } -DetailList::value_type detailType(const QContactDetail &detail) +DetailTypeId detailType(const QContactDetail &detail) { #ifdef USING_QTPIM return detail.type(); @@ -160,6 +160,24 @@ void setDetailType(Filter &filter, Field field) #endif } +DetailList detailTypesHint(const QContactFetchHint &hint) +{ +#ifdef USING_QTPIM + return hint.detailTypesHint(); +#else + return hint.detailDefinitionsHint(); +#endif +} + +void setDetailTypesHint(QContactFetchHint &hint, const DetailList &types) +{ +#ifdef USING_QTPIM + hint.setDetailTypesHint(types); +#else + hint.setDetailDefinitionsHint(types); +#endif +} + QContactFetchHint basicFetchHint() { QContactFetchHint fetchHint; @@ -195,7 +213,7 @@ QContactFetchHint metadataFetchHint(quint32 fetchTypes = 0) types << detailType(); } - fetchHint.setDetailTypesHint(types); + setDetailTypesHint(fetchHint, types); return fetchHint; } @@ -204,8 +222,7 @@ QContactFetchHint onlineFetchHint(quint32 fetchTypes = 0) QContactFetchHint fetchHint(metadataFetchHint(fetchTypes)); // We also need global presence state - fetchHint.setDetailTypesHint(fetchHint.detailTypesHint() << detailType()); - + setDetailTypesHint(fetchHint, detailTypesHint(fetchHint) << detailType()); return fetchHint; } @@ -214,8 +231,7 @@ QContactFetchHint favoriteFetchHint(quint32 fetchTypes = 0) QContactFetchHint fetchHint(onlineFetchHint(fetchTypes)); // We also need avatar info - fetchHint.setDetailTypesHint(fetchHint.detailTypesHint() << detailType()); - + setDetailTypesHint(fetchHint, detailTypesHint(fetchHint) << detailType()); return fetchHint; } @@ -1373,13 +1389,7 @@ void SeasideCache::contactsAvailable() } QSet queryDetailTypes; - foreach (const DetailTypeId &typeId, -#ifdef USING_QTPIM - fetchHint.detailTypesHint() -#else - fetchHint.detailDefinitionsHint() -#endif - ) { + foreach (const DetailTypeId &typeId, detailTypesHint(fetchHint)) { queryDetailTypes.insert(typeId); } const bool partialFetch = !queryDetailTypes.isEmpty(); diff --git a/src/seasidecache.h b/src/seasidecache.h index 7583da3..900dc30 100644 --- a/src/seasidecache.h +++ b/src/seasidecache.h @@ -70,7 +70,7 @@ USE_CONTACTS_NAMESPACE #ifdef USING_QTPIM typedef QContactDetail::DetailType DetailTypeId; #else -typedef QLatin1String DetailTypeId; +typedef QString DetailTypeId; #endif class CONTACTCACHE_EXPORT SeasideNameGroupChangeListener