diff --git a/src/seasidecache.cpp b/src/seasidecache.cpp index f111e1c..49dfc72 100644 --- a/src/seasidecache.cpp +++ b/src/seasidecache.cpp @@ -564,7 +564,6 @@ SeasideCache::SeasideCache() connect(config, SIGNAL(displayLabelOrderChanged(CacheConfiguration::DisplayLabelOrder)), this, SLOT(displayLabelOrderChanged(CacheConfiguration::DisplayLabelOrder))); 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()) { @@ -585,7 +584,7 @@ SeasideCache::SeasideCache() this, SLOT(displayLabelGroupsChanged(QStringList))); displayLabelGroupsChanged(cme->displayLabelGroups()); - connect(mgr, SIGNAL(dataChanged()), this, SLOT(updateContacts())); + connect(mgr, SIGNAL(dataChanged()), this, SLOT(dataChanged())); connect(mgr, SIGNAL(contactsAdded(QList)), this, SLOT(contactsAdded(QList))); connect(mgr, SIGNAL(contactsChanged(QList)), @@ -2025,7 +2024,7 @@ void SeasideCache::contactsRemoved(const QList &ids) requestUpdate(); } -void SeasideCache::updateContacts() +void SeasideCache::dataChanged() { QList contactIds; @@ -2036,6 +2035,21 @@ void SeasideCache::updateContacts() } updateContacts(contactIds, &m_changedContacts); + + // The backend will automatically update, but notify the models of the change. + for (int i = 0; i < FilterTypesCount; ++i) { + const QList &models = m_models[i]; + for (int j = 0; j < models.count(); ++j) { + ListModel *model = models.at(j); + model->updateGroupProperty(); + model->sourceItemsChanged(); + model->sourceDataChanged(0, m_contacts[i].size()); + } + } + + // Update the sorted list order + m_refreshRequired = true; + requestUpdate(); } void SeasideCache::fetchContacts() @@ -2935,27 +2949,6 @@ void SeasideCache::sortPropertyChanged(const QString &sortProperty) requestUpdate(); } -void SeasideCache::groupPropertyChanged(const QString &) -{ - // It is unfortunate that this is required at all! - // Maybe handling for this could be added to dataChanged() - // instead? TODO: investigate that possibility. - - // The backend will automatically update, but notify the models of the change. - for (int i = 0; i < FilterTypesCount; ++i) { - const QList &models = m_models[i]; - for (int j = 0; j < models.count(); ++j) { - ListModel *model = models.at(j); - model->updateGroupProperty(); - model->sourceItemsChanged(); - } - } - - // Update the sorted list order - m_refreshRequired = true; - requestUpdate(); -} - void SeasideCache::displayStatusChanged(const QString &status) { const bool off = (status == QLatin1String(MCE_DISPLAY_OFF_STRING)); diff --git a/src/seasidecache.h b/src/seasidecache.h index af94380..23db869 100644 --- a/src/seasidecache.h +++ b/src/seasidecache.h @@ -345,7 +345,7 @@ private slots: void relationshipsAvailable(); void requestStateChanged(QContactAbstractRequest::State state); void addressRequestStateChanged(QContactAbstractRequest::State state); - void updateContacts(); + void dataChanged(); void contactsAdded(const QList &contactIds); void contactsChanged(const QList &contactIds); void contactsPresenceChanged(const QList &contactIds); @@ -353,7 +353,6 @@ private slots: void displayLabelGroupsChanged(const QStringList &groups); void displayLabelOrderChanged(CacheConfiguration::DisplayLabelOrder order); void sortPropertyChanged(const QString &sortProperty); - void groupPropertyChanged(const QString &groupProperty); void displayStatusChanged(const QString &); private: