Fix sourceFilter in QML DataModel to actually

filter the sources of the dataengine

The sources were not getting filtered due to an
error in the loop that added all the sources
in any case

REVIEW: 105267
This commit is contained in:
Viranch Mehta 2012-06-16 20:10:08 +05:30
parent 62ddf21fb6
commit a60d6db013

View File

@ -187,6 +187,10 @@ void DataModel::dataUpdated(const QString &sourceName, const Plasma::DataEngine:
QVariantHash::const_iterator i = m_dataSource->data().constBegin(); QVariantHash::const_iterator i = m_dataSource->data().constBegin();
while (i != m_dataSource->data().constEnd()) { while (i != m_dataSource->data().constEnd()) {
if (!m_sourceFilter.isEmpty() && m_sourceFilterRE.isValid() && !m_sourceFilterRE.exactMatch(i.key())) {
++i;
continue;
}
QVariant value = i.value(); QVariant value = i.value();
if (value.isValid() && value.canConvert<Plasma::DataEngine::Data>()) { if (value.isValid() && value.canConvert<Plasma::DataEngine::Data>()) {
Plasma::DataEngine::Data data = value.value<Plasma::DataEngine::Data>(); Plasma::DataEngine::Data data = value.value<Plasma::DataEngine::Data>();