]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Clear filter bar on clicking current folder in places
authorSerg Podtynnyi <serg@podtynnyi.com>
Tue, 24 Jan 2023 17:04:54 +0000 (00:04 +0700)
committerSerg Podtynnyi <serg@podtynnyi.com>
Wed, 25 Jan 2023 11:37:55 +0000 (18:37 +0700)
Reset the filter bar when user clicks on the current folder in places
list, also rename slot function to be more clear.

BUG: 259382

src/dolphinmainwindow.cpp
src/dolphinviewcontainer.cpp
src/dolphinviewcontainer.h
src/filterbar/filterbar.cpp
src/filterbar/filterbar.h

index 9f021684c89a4ec0ca5b930d09d96bda65567a0d..d69514b7a36a767c00b1825518d09b7a7406437a 100644 (file)
@@ -1414,6 +1414,8 @@ void DolphinMainWindow::slotPlaceActivated(const QUrl& url)
     DolphinViewContainer* view = activeViewContainer();
 
     if (view->url() == url) {
+        view->clearFilterBar(); // Fixes bug 259382.
+
         // We can end up here if the user clicked a device in the Places Panel
         // which had been unmounted earlier, see https://bugs.kde.org/show_bug.cgi?id=161385.
         reloadView();
index a388334819c9b40d11f13fba33cffd075fc71c29..10e88601867f2bdbadc5920d91eb406592336bc3 100644 (file)
@@ -125,7 +125,7 @@ DolphinViewContainer::DolphinViewContainer(const QUrl& url, QWidget* parent) :
     // Initialize the main view
     m_view = new DolphinView(url, this);
     connect(m_view, &DolphinView::urlChanged,
-            m_filterBar, &FilterBar::slotUrlChanged);
+            m_filterBar, &FilterBar::clearIfUnlocked);
     connect(m_view, &DolphinView::urlChanged,
             m_messageWidget, &KMessageWidget::hide);
     // m_urlNavigator stays in sync with m_view's location changes and
@@ -797,6 +797,11 @@ void DolphinViewContainer::closeFilterBar()
     Q_EMIT showFilterBarChanged(false);
 }
 
+void DolphinViewContainer::clearFilterBar()
+{
+    m_filterBar->clearIfUnlocked();
+}
+
 void DolphinViewContainer::setNameFilter(const QString& nameFilter)
 {
     m_view->hideToolTip(ToolTipManager::HideBehavior::Instantly);
index 83d3ed1a1be89dd27872720b467461cbbab97ace..dbaf18261a8e93dc8822ad26f29566e3896b8c50 100644 (file)
@@ -204,6 +204,7 @@ public:
      */
     void disableUrlNavigatorSelectionRequests();
     void enableUrlNavigatorSelectionRequests();
+    void clearFilterBar();
 
 public Q_SLOTS:
     /**
index 6d8b1e485f6705adc3037eaa0b5453713c5e668b..c1fb344b1ef10d7bdac25c8aa4f07c04089e55fe 100644 (file)
@@ -74,7 +74,7 @@ void FilterBar::clear()
     m_filterInput->clear();
 }
 
-void FilterBar::slotUrlChanged()
+void FilterBar::clearIfUnlocked()
 {
     if (!m_lockButton || !(m_lockButton->isChecked())) {
         clear();
index d6ca402afd0b0acc1fa736c32b01887a45abd52d..73b1c566ec40edb2b944c5af0223cb98d3c79b68 100644 (file)
@@ -39,7 +39,7 @@ public Q_SLOTS:
     /** Clears the input field. */
     void clear();
     /** Clears the input field if the "lock button" is disabled. */
-    void slotUrlChanged();
+    void clearIfUnlocked();
     /** The input field is cleared also if the "lock button" is released. */
     void slotToggleLockButton(bool checked);