summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Mi <[email protected]>2017-09-21 15:41:26 +0200
committerEmmanuel Pescosta <[email protected]>2017-09-21 15:41:26 +0200
commit3749b5552729b434655ddc950b120bb14fe888c7 (patch)
treec674c90c2a117cb34e43490a5c05829091c96982
parent49396318f0f37f913a91bf02484a16e34fec6bf4 (diff)
Select child folder when navigating to a parent folder
Whenever the dolphin view is initialized to show the contents of a new URL (e.g. "/home/x/test") it will be checked if the new URL is a parent of the previous displayed URL (e.g. "/home/x/test/documents/aaa"). If the check is successful, then the common child (in this example: "/home/x/test/documents/") folder item will be selected and scrolled into view. REVIEW: 123253 BUG: 377392 CCBUG: 335616
-rw-r--r--CMakeLists.txt2
-rw-r--r--src/dolphinviewcontainer.cpp11
-rw-r--r--src/dolphinviewcontainer.h5
3 files changed, 17 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 81ffee6..bd0b175 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,7 +8,7 @@ set (KDE_APPLICATIONS_VERSION "${KDE_APPLICATIONS_VERSION_MAJOR}.${KDE_APPLICATI
project(Dolphin VERSION ${KDE_APPLICATIONS_VERSION})
set(QT_MIN_VERSION "5.5.0")
-set(KF5_MIN_VERSION "5.30.0")
+set(KF5_MIN_VERSION "5.37.0")
set(ECM_MIN_VERSION "1.6.0")
# ECM setup
diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp
index 198879f..d830166 100644
--- a/src/dolphinviewcontainer.cpp
+++ b/src/dolphinviewcontainer.cpp
@@ -24,6 +24,7 @@
#include <QTimer>
#include <QMimeData>
#include <QVBoxLayout>
+#include <QLoggingCategory>
#include <KFileItemActions>
#include <KFilePlacesModel>
@@ -41,6 +42,7 @@
#endif
#include "global.h"
+#include "dolphindebug.h"
#include "dolphin_generalsettings.h"
#include "filterbar/filterbar.h"
#include "search/dolphinsearchbox.h"
@@ -134,6 +136,8 @@ DolphinViewContainer::DolphinViewContainer(const QUrl& url, QWidget* parent) :
this, &DolphinViewContainer::slotUrlNavigatorLocationAboutToBeChanged);
connect(m_urlNavigator, &KUrlNavigator::urlChanged,
this, &DolphinViewContainer::slotUrlNavigatorLocationChanged);
+ connect(m_urlNavigator, &KUrlNavigator::urlSelectionRequested,
+ this, &DolphinViewContainer::slotUrlSelectionRequested);
connect(m_urlNavigator, &KUrlNavigator::returnPressed,
this, &DolphinViewContainer::slotReturnPressed);
connect(m_urlNavigator, &KUrlNavigator::urlsDropped, this, [=](const QUrl &destination, QDropEvent *event) {
@@ -600,6 +604,13 @@ void DolphinViewContainer::slotUrlNavigatorLocationChanged(const QUrl& url)
}
}
+void DolphinViewContainer::slotUrlSelectionRequested(const QUrl& url)
+{
+ qCDebug(DolphinDebug) << "slotUrlSelectionRequested: " << url;
+ m_view->markUrlsAsSelected({url});
+ m_view->markUrlAsCurrent(url); // makes the item scroll into view
+}
+
void DolphinViewContainer::redirect(const QUrl& oldUrl, const QUrl& newUrl)
{
Q_UNUSED(oldUrl);
diff --git a/src/dolphinviewcontainer.h b/src/dolphinviewcontainer.h
index e50386a..41c8f0b 100644
--- a/src/dolphinviewcontainer.h
+++ b/src/dolphinviewcontainer.h
@@ -257,6 +257,11 @@ private slots:
void slotUrlNavigatorLocationChanged(const QUrl& url);
/**
+ * @see KUrlNavigator::urlSelectionRequested
+ */
+ void slotUrlSelectionRequested(const QUrl& url);
+
+ /**
* Is invoked when a redirection is done and changes the
* URL of the URL navigator to \a newUrl without triggering
* a reloading of the directory.