┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews/kfileitemmodelrolesupdater.cpp
diff options
context:
space:
mode:
authorEmmanuel Pescosta <[email protected]>2013-07-18 17:07:34 +0200
committerEmmanuel Pescosta <[email protected]>2013-07-18 17:07:34 +0200
commitaa2dda8cb4df1da0171dd34f34dacf94c958f21e (patch)
treec468f026a1ce6f7154ad8885fc3566e67d23fa19 /src/kitemviews/kfileitemmodelrolesupdater.cpp
parent63b26cbf2c849f724b7e2f5c8f40f6883d6278e5 (diff)
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
Diffstat (limited to 'src/kitemviews/kfileitemmodelrolesupdater.cpp')
-rw-r--r--src/kitemviews/kfileitemmodelrolesupdater.cpp12
1 files changed, 10 insertions, 2 deletions
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<QByteArray>& 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<QByteArray, QVariant> 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<QByteArray, QVariant> it(rolesProvider.roleValues(resource, m_roles));
while (it.hasNext()) {
it.next();