Commit 621f652a authored by Andrew den Exter's avatar Andrew den Exter

Merge branch 'jb50910' into 'master'

[contacts] Allow contact listenters to specify required properties. Contributes to JB#50910

See merge request mer-core/libcontacts!20
parents d5f27cc0 ddc23704
...@@ -258,6 +258,9 @@ QContactFetchHint metadataFetchHint(quint32 fetchTypes = 0) ...@@ -258,6 +258,9 @@ QContactFetchHint metadataFetchHint(quint32 fetchTypes = 0)
if (fetchTypes & SeasideCache::FetchOrganization) { if (fetchTypes & SeasideCache::FetchOrganization) {
types << detailType<QContactOrganization>(); types << detailType<QContactOrganization>();
} }
if (fetchTypes & SeasideCache::FetchAvatar) {
types << detailType<QContactAvatar>();
}
setDetailTypesHint(fetchHint, types); setDetailTypesHint(fetchHint, types);
return fetchHint; return fetchHint;
...@@ -300,6 +303,9 @@ QContactFetchHint extendedMetadataFetchHint(quint32 fetchTypes) ...@@ -300,6 +303,9 @@ QContactFetchHint extendedMetadataFetchHint(quint32 fetchTypes)
if (fetchTypes & SeasideCache::FetchOrganization) { if (fetchTypes & SeasideCache::FetchOrganization) {
types << detailType<QContactOrganization>(); types << detailType<QContactOrganization>();
} }
if (fetchTypes & SeasideCache::FetchAvatar) {
types << detailType<QContactAvatar>();
}
setDetailTypesHint(fetchHint, types); setDetailTypesHint(fetchHint, types);
return fetchHint; return fetchHint;
...@@ -707,6 +713,15 @@ void SeasideCache::registerChangeListener(ChangeListener *listener) ...@@ -707,6 +713,15 @@ void SeasideCache::registerChangeListener(ChangeListener *listener)
instancePtr->m_changeListeners.append(listener); instancePtr->m_changeListeners.append(listener);
} }
void SeasideCache::registerChangeListener(ChangeListener *listener, FetchDataType requiredTypes, FetchDataType extraTypes)
{
// Ensure the cache has been instantiated
instance();
instancePtr->m_changeListeners.append(listener);
instancePtr->keepPopulated(requiredTypes, extraTypes);
}
void SeasideCache::unregisterChangeListener(ChangeListener *listener) void SeasideCache::unregisterChangeListener(ChangeListener *listener)
{ {
if (!instancePtr) if (!instancePtr)
......
...@@ -88,10 +88,12 @@ public: ...@@ -88,10 +88,12 @@ public:
FetchPhoneNumber = (1 << 1), FetchPhoneNumber = (1 << 1),
FetchEmailAddress = (1 << 2), FetchEmailAddress = (1 << 2),
FetchOrganization = (1 << 3), FetchOrganization = (1 << 3),
FetchAvatar = (1 << 4),
FetchTypesMask = (FetchAccountUri | FetchTypesMask = (FetchAccountUri |
FetchPhoneNumber | FetchPhoneNumber |
FetchEmailAddress | FetchEmailAddress |
FetchOrganization) FetchOrganization |
FetchAvatar)
}; };
enum DisplayLabelOrder { enum DisplayLabelOrder {
...@@ -291,6 +293,7 @@ public: ...@@ -291,6 +293,7 @@ public:
static void unregisterDisplayLabelGroupChangeListener(SeasideDisplayLabelGroupChangeListener *listener); static void unregisterDisplayLabelGroupChangeListener(SeasideDisplayLabelGroupChangeListener *listener);
static void registerChangeListener(ChangeListener *listener); static void registerChangeListener(ChangeListener *listener);
static void registerChangeListener(ChangeListener *listener, FetchDataType requiredTypes, FetchDataType extraTypes = FetchNone);
static void unregisterChangeListener(ChangeListener *listener); static void unregisterChangeListener(ChangeListener *listener);
static void unregisterResolveListener(ResolveListener *listener); static void unregisterResolveListener(ResolveListener *listener);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment