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

Commit

Permalink
Merge pull request #105 from matthewvogt/mer-1249
Browse files Browse the repository at this point in the history
Improve address resolution behavior
  • Loading branch information
matthewvogt committed Aug 20, 2015
2 parents 3b485da + 876808a commit 5c5a04e
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions src/seasidecache.cpp
Expand Up @@ -575,9 +575,13 @@ SeasideCache::SeasideCache()
connect(config, SIGNAL(sortPropertyChanged(QString)), this, SLOT(sortPropertyChanged(QString)));
connect(config, SIGNAL(groupPropertyChanged(QString)), this, SLOT(groupPropertyChanged(QString)));

if (!QDBusConnection::systemBus().connect(MCE_SERVICE, MCE_SIGNAL_PATH, MCE_SIGNAL_IF,
MCE_DISPLAY_SIG, this, SLOT(displayStatusChanged(QString)))) {
qWarning() << "Unable to connect to MCE displayStatusChanged signal";
// Is this a GUI application? If so, we want to defer some processing when the display is off
if (qApp && qApp->property("applicationDisplayName").isValid()) {
// Only QGuiApplication has this property
if (!QDBusConnection::systemBus().connect(MCE_SERVICE, MCE_SIGNAL_PATH, MCE_SIGNAL_IF,
MCE_DISPLAY_SIG, this, SLOT(displayStatusChanged(QString)))) {
qWarning() << "Unable to connect to MCE displayStatusChanged signal";
}
}

QContactManager *mgr(manager());
Expand Down Expand Up @@ -997,7 +1001,11 @@ SeasideCache::CacheItem *SeasideCache::resolvePhoneNumber(ResolveListener *liste
{
CacheItem *item = itemByPhoneNumber(number, requireComplete);
if (!item) {
instancePtr->resolveAddress(listener, QString(), number, requireComplete);
// Don't bother trying to resolve an invalid number
const QString normalized(normalizePhoneNumber(number));
if (!normalized.isEmpty()) {
instancePtr->resolveAddress(listener, QString(), number, requireComplete);
}
} else if (requireComplete) {
ensureCompletion(item);
}
Expand Down Expand Up @@ -1919,7 +1927,9 @@ void SeasideCache::timerEvent(QTimerEvent *event)

void SeasideCache::contactsAdded(const QList<QContactId> &ids)
{
if (m_keepPopulated) {
// These additions may change address resolutions, so we may need to process them
const bool relevant(m_keepPopulated || !instancePtr->m_changeListeners.isEmpty());
if (relevant) {
updateContacts(ids, &m_changedContacts);
}
}
Expand Down Expand Up @@ -2163,7 +2173,8 @@ bool SeasideCache::updateContactIndexing(const QContact &oldContact, const QCont
resolveUnknownAddresses(address.first, address.second, item);
}

m_phoneNumberIds.insert(address.second, iid);
if (!m_phoneNumberIds.contains(address.second, iid))
m_phoneNumberIds.insert(address.second, iid);
}
}

Expand Down

0 comments on commit 5c5a04e

Please sign in to comment.