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
[libcontacts] Filter contacts by address type without QContact data
Allow address type filtering to be performed without retrieving the
full QContact object.
  • Loading branch information
matthewvogt committed Jul 30, 2013
1 parent 27adfdb commit 9732b7c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion rpm/libcontacts-qt5.spec
Expand Up @@ -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}.
Expand Down
2 changes: 1 addition & 1 deletion rpm/libcontacts.spec
Expand Up @@ -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}.
Expand Down
4 changes: 4 additions & 0 deletions src/seasidecache.cpp
Expand Up @@ -34,6 +34,8 @@
#include "synchronizelists.h"
#include "normalization_p.h"

#include "qcontactstatusflags_impl.h"

#include <QCoreApplication>
#ifdef USING_QTPIM
#include <QStandardPaths>
Expand Down Expand Up @@ -1116,6 +1118,7 @@ void SeasideCache::contactsAvailable()
} else {
item.contact = contact;
}
item.statusFlags = contact.detail<QContactStatusFlags>().flagsValue();
item.contactState = ContactFetched;

QList<QContactPhoneNumber> phoneNumbers = contact.details<QContactPhoneNumber>();
Expand Down Expand Up @@ -1323,6 +1326,7 @@ void SeasideCache::appendContacts(const QList<QContact> &contacts)
cacheIds.append(apiId);
CacheItem &cacheItem = m_people[iid];
cacheItem.contact = contact;
cacheItem.statusFlags = contact.detail<QContactStatusFlags>().flagsValue();
cacheItem.contactState = ContactFetched;

if (m_fetchFilter == FilterAll)
Expand Down
6 changes: 5 additions & 1 deletion src/seasidecache.h
Expand Up @@ -35,6 +35,7 @@
#include "contactcacheexport.h"

#include <qtcontacts-extensions.h>
#include <QContactStatusFlags>

#include <QContact>
#include <QContactManager>
Expand Down Expand Up @@ -126,14 +127,17 @@ 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<QContactStatusFlags>().flagsValue()), contactState(ContactAbsent) {}

ContactIdType apiId() const { return SeasideCache::apiId(contact); }

QContact contact;
ItemData *itemData;
ModelData *modelData;
quint32 iid;
quint64 statusFlags;
ContactState contactState;
};

Expand Down

0 comments on commit 9732b7c

Please sign in to comment.