From aa2dda8cb4df1da0171dd34f34dacf94c958f21e Mon Sep 17 00:00:00 2001 From: Emmanuel Pescosta Date: Thu, 18 Jul 2013 17:07:34 +0200 Subject: Overwrite the changed role value with an empty QVariant, because the nepomuk roles provider doesn't overwrite it when the property value list is empty. BUG: 322348 REVIEW: 111505 FIXED-IN: 4.11.0 --- src/kitemviews/kfileitemmodelrolesupdater.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/kitemviews/kfileitemmodelrolesupdater.cpp') diff --git a/src/kitemviews/kfileitemmodelrolesupdater.cpp b/src/kitemviews/kfileitemmodelrolesupdater.cpp index 317a7a352..698a6c5f0 100644 --- a/src/kitemviews/kfileitemmodelrolesupdater.cpp +++ b/src/kitemviews/kfileitemmodelrolesupdater.cpp @@ -294,7 +294,7 @@ void KFileItemModelRolesUpdater::setRoles(const QSet& roles) m_nepomukResourceWatcher = new Nepomuk2::ResourceWatcher(this); connect(m_nepomukResourceWatcher, SIGNAL(propertyChanged(Nepomuk2::Resource,Nepomuk2::Types::Property,QVariantList,QVariantList)), - this, SLOT(applyChangedNepomukRoles(Nepomuk2::Resource))); + this, SLOT(applyChangedNepomukRoles(Nepomuk2::Resource,Nepomuk2::Types::Property))); } else if (!hasNepomukRole && m_nepomukResourceWatcher) { delete m_nepomukResourceWatcher; m_nepomukResourceWatcher = 0; @@ -721,7 +721,7 @@ void KFileItemModelRolesUpdater::resolveRecentlyChangedItems() updateChangedItems(); } -void KFileItemModelRolesUpdater::applyChangedNepomukRoles(const Nepomuk2::Resource& resource) +void KFileItemModelRolesUpdater::applyChangedNepomukRoles(const Nepomuk2::Resource& resource, const Nepomuk2::Types::Property& property) { #ifdef HAVE_NEPOMUK if (!Nepomuk2::ResourceManager::instance()->initialized()) { @@ -740,6 +740,14 @@ void KFileItemModelRolesUpdater::applyChangedNepomukRoles(const Nepomuk2::Resour QHash data = rolesData(item); const KNepomukRolesProvider& rolesProvider = KNepomukRolesProvider::instance(); + const QByteArray role = rolesProvider.roleForPropertyUri(property.uri()); + if (!role.isEmpty() && m_roles.contains(role)) { + // Overwrite the changed role value with an empty QVariant, because the roles + // provider doesn't overwrite it when the property value list is empty. + // See bug 322348 + data.insert(role, QVariant()); + } + QHashIterator it(rolesProvider.roleValues(resource, m_roles)); while (it.hasNext()) { it.next(); -- cgit v1.3