┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews
diff options
context:
space:
mode:
authorFrank Reininghaus <[email protected]>2012-10-30 07:26:30 +0100
committerFrank Reininghaus <[email protected]>2012-10-30 07:26:30 +0100
commit1d9d83b4342031c94a55cc4e6b73ade461b7c17d (patch)
tree1bb4152fc2a358c1d22767e24ded5eb35bf7763f /src/kitemviews
parentc503452d56003ddb05e3266865abf02b04e0b785 (diff)
parent37a54c053e4712ffc9fc39fb0d8809f70c6bf9a9 (diff)
Merge remote-tracking branch 'origin/KDE/4.9'
Diffstat (limited to 'src/kitemviews')
-rw-r--r--src/kitemviews/kfileitemmodelrolesupdater.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/kitemviews/kfileitemmodelrolesupdater.cpp b/src/kitemviews/kfileitemmodelrolesupdater.cpp
index ae9358192..936e6a740 100644
--- a/src/kitemviews/kfileitemmodelrolesupdater.cpp
+++ b/src/kitemviews/kfileitemmodelrolesupdater.cpp
@@ -438,9 +438,22 @@ void KFileItemModelRolesUpdater::slotSortRoleChanged(const QByteArray& current,
void KFileItemModelRolesUpdater::slotGotPreview(const KFileItem& item, const QPixmap& pixmap)
{
+ const int oldNumberOfPendingItems = m_pendingVisibleItems.count() + m_pendingInvisibleItems.count();
+
m_pendingVisibleItems.remove(item);
m_pendingInvisibleItems.remove(item);
+ const int newNumberOfPendingItems = m_pendingVisibleItems.count() + m_pendingInvisibleItems.count();
+
+ if (oldNumberOfPendingItems == newNumberOfPendingItems) {
+ // 'item' could not be removed from either of the sets. It looks like
+ // we have hit bug 304986. Replace the items in the sets by the items
+ // in the model to work around the problem.
+ // NOTE: This workaround is not needed any more in KDE 4.10.
+ m_pendingVisibleItems = sortedItems(m_pendingVisibleItems).toSet();
+ m_pendingInvisibleItems = sortedItems(m_pendingInvisibleItems).toSet();
+ }
+
const int index = m_model->index(item);
if (index < 0) {
return;
@@ -498,9 +511,22 @@ void KFileItemModelRolesUpdater::slotGotPreview(const KFileItem& item, const QPi
void KFileItemModelRolesUpdater::slotPreviewFailed(const KFileItem& item)
{
+ const int oldNumberOfPendingItems = m_pendingVisibleItems.count() + m_pendingInvisibleItems.count();
+
m_pendingVisibleItems.remove(item);
m_pendingInvisibleItems.remove(item);
+ const int newNumberOfPendingItems = m_pendingVisibleItems.count() + m_pendingInvisibleItems.count();
+
+ if (oldNumberOfPendingItems == newNumberOfPendingItems) {
+ // 'item' could not be removed from either of the sets. It looks like
+ // we have hit bug 304986. Replace the items in the sets by the items
+ // in the model to work around the problem.
+ // NOTE: This workaround is not needed any more in KDE 4.10.
+ m_pendingVisibleItems = sortedItems(m_pendingVisibleItems).toSet();
+ m_pendingInvisibleItems = sortedItems(m_pendingInvisibleItems).toSet();
+ }
+
const bool clearPreviews = m_clearPreviews;
m_clearPreviews = true;
applyResolvedRoles(item, ResolveAll);