]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/klistview.cpp
Fix the scrollbar issue. We can live with the setSingleStep nasty workaround for...
[dolphin.git] / src / klistview.cpp
index 1cba47b1bd44c2c8e785beaa0f5b03bf359a3d4f..553c4e400c3e31f99e3474f6115c869b4ebadb2d 100644 (file)
@@ -21,7 +21,8 @@
 #include "klistview.h"
 #include "klistview_p.h"
 
-#include <math.h> // trunc
+#include <math.h> // trunc on C99 compliant systems
+#include <kdefakes.h> // trunc for not C99 compliant systems
 
 #include <QApplication>
 #include <QPainter>
@@ -385,6 +386,9 @@ void KListView::Private::updateScrollbars()
 {
     int lastItemBottom = cachedRectIndex(lastIndex).bottom() +
                            listView->spacing() - listView->viewport()->height();
+
+    listView->verticalScrollBar()->setSingleStep(listView->viewport()->height() / 10);
+    listView->verticalScrollBar()->setPageStep(listView->viewport()->height());
     listView->verticalScrollBar()->setRange(0, lastItemBottom);
 }
 
@@ -955,11 +959,11 @@ void KListView::updateGeometries()
 
 void KListView::slotSortingRoleChanged()
 {
-    if (d->proxyModel)
+    if ((viewMode() == KListView::IconMode) && d->proxyModel &&
+        d->itemCategorizer)
     {
         // Force the view to update all elements
-        rowsInsertedArtifficial(QModelIndex(), 0, d->proxyModel->rowCount() -
-                                                                             1);
+        rowsInsertedArtifficial(QModelIndex(), 0, d->proxyModel->rowCount() - 1);
     }
 }