┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dolphincontextmenu.cpp6
-rw-r--r--src/dolphinmainwindow.cpp4
-rw-r--r--src/dolphinmainwindow.h3
-rw-r--r--src/dolphintabwidget.cpp3
-rw-r--r--src/dolphintabwidget.h7
-rw-r--r--src/kitemviews/kitemlistcontainer.cpp12
-rw-r--r--src/kitemviews/private/kitemlistsmoothscroller.cpp8
-rw-r--r--src/kitemviews/private/kitemlistsmoothscroller.h1
8 files changed, 36 insertions, 8 deletions
diff --git a/src/dolphincontextmenu.cpp b/src/dolphincontextmenu.cpp
index 77034dadb..84023ddbd 100644
--- a/src/dolphincontextmenu.cpp
+++ b/src/dolphincontextmenu.cpp
@@ -216,7 +216,11 @@ void DolphinContextMenu::addOpenParentFolderActions()
});
addAction(QIcon::fromTheme(QStringLiteral("tab-new")), i18nc("@action:inmenu", "Open Path in New Tab"), [this]() {
- m_mainWindow->openNewTab(KIO::upUrl(m_fileInfo.targetUrl()));
+ const QUrl url = m_fileInfo.targetUrl();
+ const QUrl parentUrl = KIO::upUrl(url);
+ DolphinTabPage *tabPage = m_mainWindow->openNewTab(parentUrl);
+ tabPage->activeViewContainer()->view()->markUrlsAsSelected({url});
+ tabPage->activeViewContainer()->view()->markUrlAsCurrent(url);
});
addAction(QIcon::fromTheme(QStringLiteral("window-new")), i18nc("@action:inmenu", "Open Path in New Window"), [this]() {
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp
index 6f23581b4..ead46de30 100644
--- a/src/dolphinmainwindow.cpp
+++ b/src/dolphinmainwindow.cpp
@@ -489,9 +489,9 @@ void DolphinMainWindow::addToPlaces()
}
}
-void DolphinMainWindow::openNewTab(const QUrl &url)
+DolphinTabPage *DolphinMainWindow::openNewTab(const QUrl &url)
{
- m_tabWidget->openNewTab(url, QUrl());
+ return m_tabWidget->openNewTab(url, QUrl());
}
void DolphinMainWindow::openNewTabAndActivate(const QUrl &url)
diff --git a/src/dolphinmainwindow.h b/src/dolphinmainwindow.h
index 37994b85a..ceda3cb73 100644
--- a/src/dolphinmainwindow.h
+++ b/src/dolphinmainwindow.h
@@ -209,8 +209,9 @@ public Q_SLOTS:
/**
* Opens a new tab in the background showing the URL \a url.
+ * @return A pointer to the opened DolphinTabPage.
*/
- void openNewTab(const QUrl &url);
+ DolphinTabPage *openNewTab(const QUrl &url);
/**
* Opens a new tab showing the URL \a url and activate it.
diff --git a/src/dolphintabwidget.cpp b/src/dolphintabwidget.cpp
index 825ff3c7f..5ad2a368c 100644
--- a/src/dolphintabwidget.cpp
+++ b/src/dolphintabwidget.cpp
@@ -170,7 +170,7 @@ void DolphinTabWidget::openNewActivatedTab(const QUrl &primaryUrl, const QUrl &s
}
}
-void DolphinTabWidget::openNewTab(const QUrl &primaryUrl, const QUrl &secondaryUrl, DolphinTabWidget::NewTabPosition position)
+DolphinTabPage *DolphinTabWidget::openNewTab(const QUrl &primaryUrl, const QUrl &secondaryUrl, DolphinTabWidget::NewTabPosition position)
{
QWidget *focusWidget = QApplication::focusWidget();
@@ -202,6 +202,7 @@ void DolphinTabWidget::openNewTab(const QUrl &primaryUrl, const QUrl &secondaryU
// in background, assure that the previous focused widget gets the focus back.
focusWidget->setFocus();
}
+ return tabPage;
}
void DolphinTabWidget::openDirectories(const QList<QUrl> &dirs, bool splitView)
diff --git a/src/dolphintabwidget.h b/src/dolphintabwidget.h
index a28a6bea1..52d3fd626 100644
--- a/src/dolphintabwidget.h
+++ b/src/dolphintabwidget.h
@@ -132,10 +132,11 @@ public Q_SLOTS:
/**
* Opens a new tab in the background showing the URL \a primaryUrl and the
* optional URL \a secondaryUrl.
+ * @return A pointer to the opened DolphinTabPage.
*/
- void openNewTab(const QUrl &primaryUrl,
- const QUrl &secondaryUrl = QUrl(),
- DolphinTabWidget::NewTabPosition position = DolphinTabWidget::NewTabPosition::FollowSetting);
+ DolphinTabPage *openNewTab(const QUrl &primaryUrl,
+ const QUrl &secondaryUrl = QUrl(),
+ DolphinTabWidget::NewTabPosition position = DolphinTabWidget::NewTabPosition::FollowSetting);
/**
* Opens each directory in \p dirs in a separate tab unless it is already open.
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();
diff --git a/src/kitemviews/private/kitemlistsmoothscroller.cpp b/src/kitemviews/private/kitemlistsmoothscroller.cpp
index fd26d198f..517f6d983 100644
--- a/src/kitemviews/private/kitemlistsmoothscroller.cpp
+++ b/src/kitemviews/private/kitemlistsmoothscroller.cpp
@@ -214,4 +214,12 @@ void KItemListSmoothScroller::handleWheelEvent(QWheelEvent *event)
m_smoothScrolling = previous;
}
+bool KItemListSmoothScroller::isAnimating()
+{
+ if (m_animation) {
+ return (m_animation->state() == QAbstractAnimation::Running);
+ }
+ return false;
+}
+
#include "moc_kitemlistsmoothscroller.cpp"
diff --git a/src/kitemviews/private/kitemlistsmoothscroller.h b/src/kitemviews/private/kitemlistsmoothscroller.h
index 32effa3d6..9cbfbc1b8 100644
--- a/src/kitemviews/private/kitemlistsmoothscroller.h
+++ b/src/kitemviews/private/kitemlistsmoothscroller.h
@@ -68,6 +68,7 @@ public:
*/
void handleWheelEvent(QWheelEvent *event);
+ bool isAnimating();
Q_SIGNALS:
/**
* Emitted when the scrolling animation has finished