Clear filter bar on clicking current folder in places

Reset the filter bar when user clicks on the current folder in places
list, also rename slot function to be more clear.

BUG: 259382
This commit is contained in:
Serg Podtynnyi 2023-01-25 00:04:54 +07:00
parent 2ae4c7aafc
commit 96323e049c
5 changed files with 11 additions and 3 deletions

View 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();

View 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);

View file

@ -204,6 +204,7 @@ public:
*/
void disableUrlNavigatorSelectionRequests();
void enableUrlNavigatorSelectionRequests();
void clearFilterBar();
public Q_SLOTS:
/**

View file

@ -74,7 +74,7 @@ void FilterBar::clear()
m_filterInput->clear();
}
void FilterBar::slotUrlChanged()
void FilterBar::clearIfUnlocked()
{
if (!m_lockButton || !(m_lockButton->isChecked())) {
clear();

View 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);