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
Merge pull request #105 from matthewvogt/mer-1249
Improve address resolution behavior
  • Loading branch information
matthewvogt committed Aug 20, 2015
2 parents 3b485da + 876808a commit 5c5a04e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/seasidecache.cpp
Expand Up @@ -575,10 +575,14 @@ SeasideCache::SeasideCache()
connect(config, SIGNAL(sortPropertyChanged(QString)), this, SLOT(sortPropertyChanged(QString)));
connect(config, SIGNAL(groupPropertyChanged(QString)), this, SLOT(groupPropertyChanged(QString)));

// 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) {
// 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,6 +2173,7 @@ bool SeasideCache::updateContactIndexing(const QContact &oldContact, const QCont
resolveUnknownAddresses(address.first, address.second, item);
}

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.