From 9732b7c5032a5bf7f741aafe318490ffabaa4de0 Mon Sep 17 00:00:00 2001 From: Matt Vogt Date: Tue, 30 Jul 2013 17:09:09 +1000 Subject: [PATCH] [libcontacts] Filter contacts by address type without QContact data Allow address type filtering to be performed without retrieving the full QContact object. --- rpm/libcontacts-qt5.spec | 2 +- rpm/libcontacts.spec | 2 +- src/seasidecache.cpp | 4 ++++ src/seasidecache.h | 6 +++++- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/rpm/libcontacts-qt5.spec b/rpm/libcontacts-qt5.spec index f179460..9df646c 100644 --- a/rpm/libcontacts-qt5.spec +++ b/rpm/libcontacts-qt5.spec @@ -12,7 +12,7 @@ BuildRequires: pkgconfig(Qt5Test) BuildRequires: pkgconfig(Qt5Contacts) BuildRequires: pkgconfig(Qt5Versit) BuildRequires: pkgconfig(mlite5) -BuildRequires: pkgconfig(qtcontacts-sqlite-qt5-extensions) +BuildRequires: pkgconfig(qtcontacts-sqlite-qt5-extensions) >= 0.1.1 %description %{summary}. diff --git a/rpm/libcontacts.spec b/rpm/libcontacts.spec index eb3d731..469a8f3 100644 --- a/rpm/libcontacts.spec +++ b/rpm/libcontacts.spec @@ -11,7 +11,7 @@ BuildRequires: pkgconfig(QtCore) BuildRequires: pkgconfig(QtContacts) BuildRequires: pkgconfig(QtVersit) BuildRequires: pkgconfig(mlite) -BuildRequires: pkgconfig(qtcontacts-sqlite-extensions) +BuildRequires: pkgconfig(qtcontacts-sqlite-extensions) >= 0.1.1 %description %{summary}. diff --git a/src/seasidecache.cpp b/src/seasidecache.cpp index 451a6b9..d764971 100644 --- a/src/seasidecache.cpp +++ b/src/seasidecache.cpp @@ -34,6 +34,8 @@ #include "synchronizelists.h" #include "normalization_p.h" +#include "qcontactstatusflags_impl.h" + #include #ifdef USING_QTPIM #include @@ -1116,6 +1118,7 @@ void SeasideCache::contactsAvailable() } else { item.contact = contact; } + item.statusFlags = contact.detail().flagsValue(); item.contactState = ContactFetched; QList phoneNumbers = contact.details(); @@ -1323,6 +1326,7 @@ void SeasideCache::appendContacts(const QList &contacts) cacheIds.append(apiId); CacheItem &cacheItem = m_people[iid]; cacheItem.contact = contact; + cacheItem.statusFlags = contact.detail().flagsValue(); cacheItem.contactState = ContactFetched; if (m_fetchFilter == FilterAll) diff --git a/src/seasidecache.h b/src/seasidecache.h index ffa4c71..3254417 100644 --- a/src/seasidecache.h +++ b/src/seasidecache.h @@ -35,6 +35,7 @@ #include "contactcacheexport.h" #include +#include #include #include @@ -126,7 +127,9 @@ class CONTACTCACHE_EXPORT SeasideCache : public QObject struct CacheItem { CacheItem() : itemData(0), modelData(0), iid(0), contactState(ContactAbsent) {} - CacheItem(const QContact &contact) : contact(contact), itemData(0), modelData(0), iid(internalId(contact)), contactState(ContactAbsent) {} + CacheItem(const QContact &contact) + : contact(contact), itemData(0), modelData(0), iid(internalId(contact)), + statusFlags(contact.detail().flagsValue()), contactState(ContactAbsent) {} ContactIdType apiId() const { return SeasideCache::apiId(contact); } @@ -134,6 +137,7 @@ class CONTACTCACHE_EXPORT SeasideCache : public QObject ItemData *itemData; ModelData *modelData; quint32 iid; + quint64 statusFlags; ContactState contactState; };