From 4f4e3d392c9645e3d43c362af72e2066430890f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A9ven=20Car?= Date: Sun, 8 Nov 2020 08:21:56 +0100 Subject: [PATCH] PlacesPanel: activating a place does not select its previously selected children BUG: 421347 --- src/dolphinmainwindow.cpp | 2 ++ src/dolphinviewcontainer.cpp | 12 ++++++++++++ src/dolphinviewcontainer.h | 9 +++++++++ 3 files changed, 23 insertions(+) diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index e7c402b885..0ff7e77e55 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -1243,7 +1243,9 @@ void DolphinMainWindow::slotPlaceActivated(const QUrl& url) // which had been unmounted earlier, see https://bugs.kde.org/show_bug.cgi?id=161385. reloadView(); } else { + view->disableUrlNavigatorSelectionRequests(); changeUrl(url); + view->enableUrlNavigatorSelectionRequests(); } } diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp index 549b62b039..1a608669f6 100644 --- a/src/dolphinviewcontainer.cpp +++ b/src/dolphinviewcontainer.cpp @@ -727,6 +727,18 @@ void DolphinViewContainer::slotUrlSelectionRequested(const QUrl& url) m_view->markUrlAsCurrent(url); // makes the item scroll into view } +void DolphinViewContainer::disableUrlNavigatorSelectionRequests() +{ + disconnect(m_urlNavigator.get(), &KUrlNavigator::urlSelectionRequested, + this, &DolphinViewContainer::slotUrlSelectionRequested); +} + +void DolphinViewContainer::enableUrlNavigatorSelectionRequests() +{ + connect(m_urlNavigator.get(), &KUrlNavigator::urlSelectionRequested, + this, &DolphinViewContainer::slotUrlSelectionRequested); +} + void DolphinViewContainer::redirect(const QUrl& oldUrl, const QUrl& newUrl) { Q_UNUSED(oldUrl) diff --git a/src/dolphinviewcontainer.h b/src/dolphinviewcontainer.h index 40e4978d9c..1a92e1fa6d 100644 --- a/src/dolphinviewcontainer.h +++ b/src/dolphinviewcontainer.h @@ -174,6 +174,15 @@ public: */ QString caption() const; + /** + * Disable/enable the behavior of "select child when moving to parent folder" + * offered by KUrlNavigator. + * + * See KUrlNavigator::urlSelectionRequested + */ + void disableUrlNavigatorSelectionRequests(); + void enableUrlNavigatorSelectionRequests(); + public Q_SLOTS: /** * Sets the current active URL, where all actions are applied. The