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/dolphincontextmenu.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/dolphincontextmenu.cpp') 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]() { -- cgit v1.3