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
Qt4 fixes
  • Loading branch information
matthewvogt committed Aug 5, 2013
1 parent 1561108 commit 46d4c66
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 15 deletions.
38 changes: 24 additions & 14 deletions src/seasidecache.cpp
Expand Up @@ -132,7 +132,7 @@ QString managerName()
typedef QList<DetailTypeId> DetailList;

template<typename T>
DetailList::value_type detailType()
DetailTypeId detailType()
{
#ifdef USING_QTPIM
return T::Type;
Expand All @@ -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();
Expand All @@ -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;
Expand Down Expand Up @@ -195,7 +213,7 @@ QContactFetchHint metadataFetchHint(quint32 fetchTypes = 0)
types << detailType<QContactEmailAddress>();
}

fetchHint.setDetailTypesHint(types);
setDetailTypesHint(fetchHint, types);
return fetchHint;
}

Expand All @@ -204,8 +222,7 @@ QContactFetchHint onlineFetchHint(quint32 fetchTypes = 0)
QContactFetchHint fetchHint(metadataFetchHint(fetchTypes));

// We also need global presence state
fetchHint.setDetailTypesHint(fetchHint.detailTypesHint() << detailType<QContactGlobalPresence>());

setDetailTypesHint(fetchHint, detailTypesHint(fetchHint) << detailType<QContactGlobalPresence>());
return fetchHint;
}

Expand All @@ -214,8 +231,7 @@ QContactFetchHint favoriteFetchHint(quint32 fetchTypes = 0)
QContactFetchHint fetchHint(onlineFetchHint(fetchTypes));

// We also need avatar info
fetchHint.setDetailTypesHint(fetchHint.detailTypesHint() << detailType<QContactAvatar>());

setDetailTypesHint(fetchHint, detailTypesHint(fetchHint) << detailType<QContactAvatar>());
return fetchHint;
}

Expand Down Expand Up @@ -1373,13 +1389,7 @@ void SeasideCache::contactsAvailable()
}

QSet<DetailTypeId> 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();
Expand Down
2 changes: 1 addition & 1 deletion src/seasidecache.h
Expand Up @@ -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
Expand Down

0 comments on commit 46d4c66

Please sign in to comment.