]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/kitemviews/kitemlistview.cpp
Fixed empty files being erroneously grouped together with folders in "By size" grouping
[dolphin.git] / src / kitemviews / kitemlistview.cpp
index f906b7a13d7057ffb434bd71a2e332e5f3faec08..45f5851bf5d6c2e06bd592c09350058fea35a2a8 100644 (file)
@@ -550,6 +550,10 @@ void KItemListView::scrollToItem(int index, ViewItemPosition viewItemPosition)
     }
     QRectF currentRect = itemRect(index);
 
+    if (layoutDirection() == Qt::RightToLeft && scrollOrientation() == Qt::Horizontal) {
+        currentRect.moveLeft(m_layouter->size().width() - currentRect.right());
+    }
+
     // Fix for Bug 311099 - View the underscore when using Ctrl + PageDown
     currentRect.adjust(-m_styleOption.horizontalMargin, -m_styleOption.verticalMargin, m_styleOption.horizontalMargin, m_styleOption.verticalMargin);
 
@@ -1477,6 +1481,26 @@ void KItemListView::slotSortRoleChanged(const QByteArray &current, const QByteAr
     }
 }
 
+void KItemListView::slotGroupOrderChanged(Qt::SortOrder current, Qt::SortOrder previous)
+{
+    Q_UNUSED(current)
+    Q_UNUSED(previous)
+    if (m_grouped) {
+        updateVisibleGroupHeaders();
+        doLayout(NoAnimation);
+    }
+}
+
+void KItemListView::slotGroupRoleChanged(const QByteArray &current, const QByteArray &previous)
+{
+    Q_UNUSED(current)
+    Q_UNUSED(previous)
+    if (m_grouped) {
+        updateVisibleGroupHeaders();
+        doLayout(NoAnimation);
+    }
+}
+
 void KItemListView::slotCurrentChanged(int current, int previous)
 {
     Q_UNUSED(previous)
@@ -1739,6 +1763,8 @@ void KItemListView::setModel(KItemModelBase *model)
         disconnect(m_model, &KItemModelBase::groupedSortingChanged, this, &KItemListView::slotGroupedSortingChanged);
         disconnect(m_model, &KItemModelBase::sortOrderChanged, this, &KItemListView::slotSortOrderChanged);
         disconnect(m_model, &KItemModelBase::sortRoleChanged, this, &KItemListView::slotSortRoleChanged);
+        disconnect(m_model, &KItemModelBase::groupOrderChanged, this, &KItemListView::slotGroupOrderChanged);
+        disconnect(m_model, &KItemModelBase::groupRoleChanged, this, &KItemListView::slotGroupRoleChanged);
 
         m_sizeHintResolver->itemsRemoved(KItemRangeList() << KItemRange(0, m_model->count()));
     }
@@ -2181,7 +2207,7 @@ void KItemListView::updateGroupHeaderForWidget(KItemListWidget *widget)
     const int groupIndex = groupIndexForItem(index);
     Q_ASSERT(groupIndex >= 0);
     groupHeader->setData(groups.at(groupIndex).second);
-    groupHeader->setRole(model()->sortRole());
+    groupHeader->setRole(model()->groupRole());
     groupHeader->setStyleOption(m_styleOption);
     groupHeader->setScrollOrientation(scrollOrientation());
     groupHeader->setItemIndex(index);