From 15e0c2a98f480f203ce168b6fa9a2e1f2b0ed8f8 Mon Sep 17 00:00:00 2001 From: Akseli Lahtinen Date: Fri, 29 Nov 2024 09:24:55 +0000 Subject: Make "open path" and "open path in new tab" scroll to the selected item **Open Path** When user clicks on "Open Path" after searching for an item, user expects the view to show the item immediately. We wait for the KItemListSmoothScroller to be done with its animation before the scrollbar sizes are being changed. **Open Path in New Tab** When user selects "Open Path in New Tab", we open a new tab to the folder where the file is, then select and set the file current. We need to get the correct tab when opening one, so it has been added as a return value. BUG:495613 --- src/kitemviews/kitemlistcontainer.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/kitemviews/kitemlistcontainer.cpp') diff --git a/src/kitemviews/kitemlistcontainer.cpp b/src/kitemviews/kitemlistcontainer.cpp index 65250832b..ff12aee7c 100644 --- a/src/kitemviews/kitemlistcontainer.cpp +++ b/src/kitemviews/kitemlistcontainer.cpp @@ -291,6 +291,9 @@ void KItemListContainer::updateScrollOffsetScrollBar() int maximum = 0; if (view->scrollOrientation() == Qt::Vertical) { smoothScroller = m_verticalSmoothScroller; + if (smoothScroller->isAnimating()) { + return; + } scrollOffsetScrollBar = verticalScrollBar(); // Don't scroll super fast when using a wheel mouse: @@ -311,6 +314,9 @@ void KItemListContainer::updateScrollOffsetScrollBar() maximum = qMax(0, int(view->maximumScrollOffset() - view->size().height())); } else { smoothScroller = m_horizontalSmoothScroller; + if (smoothScroller->isAnimating()) { + return; + } scrollOffsetScrollBar = horizontalScrollBar(); singleStep = view->itemSize().width(); pageStep = view->size().width(); @@ -347,11 +353,17 @@ void KItemListContainer::updateItemOffsetScrollBar() int pageStep = 0; if (view->scrollOrientation() == Qt::Vertical) { smoothScroller = m_horizontalSmoothScroller; + if (smoothScroller->isAnimating()) { + return; + } itemOffsetScrollBar = horizontalScrollBar(); singleStep = view->size().width() / 10; pageStep = view->size().width(); } else { smoothScroller = m_verticalSmoothScroller; + if (smoothScroller->isAnimating()) { + return; + } itemOffsetScrollBar = verticalScrollBar(); singleStep = view->size().height() / 10; pageStep = view->size().height(); -- cgit v1.3