Commit d7703be9 authored by mvogt's avatar mvogt

[libcontacts] Fix qt4 build

parent 4ff8b7c5
......@@ -166,6 +166,13 @@ bool SeasideCache::validId(const ContactIdType &id)
#endif
}
#ifndef USING_QTPIM
bool SeasideCache::validId(const QContactId &id)
{
return (id.localId() != 0);
}
#endif
quint32 SeasideCache::internalId(const QContact &contact)
{
return internalId(contact.id());
......@@ -459,9 +466,17 @@ SeasideCache::CacheItem *SeasideCache::itemById(int id)
SeasideCache::CacheItem *SeasideCache::existingItem(const ContactIdType &id)
{
#ifdef USING_QTPIM
return existingItem(internalId(id));
#else
QHash<quint32, CacheItem>::iterator it = instancePtr->m_people.find(id);
return it != instancePtr->m_people.end()
? &(*it)
: 0;
#endif
}
#ifdef USING_QTPIM
SeasideCache::CacheItem *SeasideCache::existingItem(quint32 iid)
{
QHash<quint32, CacheItem>::iterator it = instancePtr->m_people.find(iid);
......@@ -469,6 +484,7 @@ SeasideCache::CacheItem *SeasideCache::existingItem(quint32 iid)
? &(*it)
: 0;
}
#endif
QContact SeasideCache::contactById(const ContactIdType &id)
{
......@@ -535,10 +551,9 @@ void SeasideCache::updateContactData(
bool SeasideCache::removeContact(const QContact &contact)
{
if (!validId(contact.id()))
return false;
ContactIdType id = apiId(contact);
if (!validId(id))
return false;
instancePtr->m_contactsToRemove.append(id);
instancePtr->removeContactData(id, FilterFavorites);
......
......@@ -170,6 +170,9 @@ public:
static ContactIdType apiId(quint32 iid);
static bool validId(const ContactIdType &id);
#ifndef USING_QTPIM
static bool validId(const QContactId &id);
#endif
static quint32 internalId(const QContact &contact);
static quint32 internalId(const QContactId &id);
......@@ -191,7 +194,9 @@ public:
static int contactId(const QContact &contact);
static CacheItem *existingItem(const ContactIdType &id);
#ifdef USING_QTPIM
static CacheItem *existingItem(quint32 iid);
#endif
static CacheItem *itemById(const ContactIdType &id);
#ifdef USING_QTPIM
static CacheItem *itemById(int id);
......
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