Skip to content
This repository has been archived by the owner on Sep 4, 2021. It is now read-only.

Commit

Permalink
[libcontacts] Select best match from resolution request results
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewvogt committed Oct 24, 2013
1 parent 7b112bd commit 9e381af
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/seasidecache.cpp
Expand Up @@ -2319,8 +2319,21 @@ void SeasideCache::requestStateChanged(QContactAbstractRequest::State state)
// Result of a specific query
if (m_activeResolve) {
CacheItem *item = 0;
if (!m_fetchRequest.contacts().isEmpty()) {
item = itemById(apiId(m_fetchRequest.contacts().first()), false);
const QList<QContact> &resolvedContacts(m_fetchRequest.contacts());
if (!resolvedContacts.isEmpty()) {
if (resolvedContacts.count() == 1) {
item = itemById(apiId(resolvedContacts.first()), false);
} else {
// Lookup the result in our updated indexes
ResolveData data(*m_activeResolve);
if (data.first == QString()) {
item = itemByPhoneNumber(data.second, false);
} else if (data.second == QString()) {
item = itemByEmailAddress(data.first, false);
} else {
item = itemByOnlineAccount(data.first, data.second, false);
}
}
} else {
// This address is unknown - keep it for later resolution
ResolveData data(*m_activeResolve);
Expand Down

0 comments on commit 9e381af

Please sign in to comment.