]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Scroll when pressing PageUp/PageDown
authorTranter Madi <trmdi@yandex.com>
Tue, 4 Jun 2019 08:49:39 +0000 (15:49 +0700)
committerTranter Madi <trmdi@yandex.com>
Wed, 5 Jun 2019 09:40:54 +0000 (16:40 +0700)
Summary:
Add `PageUp/PageDown` to the `navigationPressed` variable.
Remove the `m_view->firstVisibleIndex()` and `m_view->lastVisibleIndex()` tests because sometimes it does not work correctly.

BUG: 407118

Test Plan:
Press PageUp/PageDOwn: it scrolls
Press Up/DOwn: it always scrolls

Reviewers: #dolphin, Zren, cfeck, elvisangelaccio

Reviewed By: #dolphin, elvisangelaccio

Subscribers: elvisangelaccio, kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D21573

src/kitemviews/kitemlistcontroller.cpp

index 6fb6a5132964de116cfb64cff1a025ffb6946e0c..4bfd5b4cb2315ce9db954bc232f2c91ef5541a12 100644 (file)
@@ -232,7 +232,8 @@ bool KItemListController::keyPressEvent(QKeyEvent* event)
     const bool controlPressed = event->modifiers() & Qt::ControlModifier;
     const bool shiftOrControlPressed = shiftPressed || controlPressed;
     const bool navigationPressed = key == Qt::Key_Home || key == Qt::Key_End  ||
-                                   key == Qt::Key_Up   || key == Qt::Key_Down ||
+                                   key == Qt::Key_PageUp || key == Qt::Key_PageDown ||
+                                   key == Qt::Key_Up || key == Qt::Key_Down ||
                                    key == Qt::Key_Left || key == Qt::Key_Right;
 
     const int itemCount = m_model->count();
@@ -461,9 +462,7 @@ bool KItemListController::keyPressEvent(QKeyEvent* event)
     }
 
     if (navigationPressed) {
-        if (index < m_view->firstVisibleIndex() || index > m_view->lastVisibleIndex()) {
-            m_view->scrollToItem(index);
-        }
+        m_view->scrollToItem(index);
     }
     return true;
 }