diff options
| author | Julian Schraner <[email protected]> | 2017-12-03 07:58:02 -0700 |
|---|---|---|
| committer | Nathaniel Graham <[email protected]> | 2017-12-03 08:00:22 -0700 |
| commit | 702429ac8e64a5aff4e110a56f526b96ecb795fd (patch) | |
| tree | dd8b404f543d8365620edd661b981617ca4ca87a | |
| parent | d0277c710819511a59f77e0afd4f43b271ab1efb (diff) | |
Change window title when searching
Summary:
When you search for a file (e.g. "hello world") the window title of Dolphin will now change to "Search for [input]" instead of "baloosearch - /".
BUG: 321575
Test Plan:
- Disables it iself after search bar is hidden
- Works with multiple word searches
Reviewers: #dolphin, ngraham, elvisangelaccio
Reviewed By: #dolphin, ngraham, elvisangelaccio
Subscribers: anthonyfieroni, elvisangelaccio, rkflx, emmanuelp, ngraham, #dolphin
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D8273
| -rw-r--r-- | src/dolphinmainwindow.cpp | 10 | ||||
| -rw-r--r-- | src/dolphinviewcontainer.cpp | 5 | ||||
| -rw-r--r-- | src/dolphinviewcontainer.h | 2 |
3 files changed, 17 insertions, 0 deletions
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index de43bab4c..067d4a6e1 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -1001,6 +1001,16 @@ void DolphinMainWindow::setUrlAsCaption(const QUrl& url) fileName = '/'; } + if (m_activeViewContainer->isSearchModeEnabled()) { + if(m_activeViewContainer->currentSearchText().isEmpty()){ + setWindowTitle(i18n("Empty Search")); + } else { + const auto searchText = i18n("Search for %1", m_activeViewContainer->currentSearchText()); + setWindowTitle(searchText); + } + return; + } + setWindowTitle(schemePrefix + fileName); } diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp index 36959a871..83b9f4343 100644 --- a/src/dolphinviewcontainer.cpp +++ b/src/dolphinviewcontainer.cpp @@ -245,6 +245,11 @@ bool DolphinViewContainer::autoGrabFocus() const return m_autoGrabFocus; } +QString DolphinViewContainer::currentSearchText() const +{ + return m_searchBox->text(); +} + const DolphinStatusBar* DolphinViewContainer::statusBar() const { return m_statusBar; diff --git a/src/dolphinviewcontainer.h b/src/dolphinviewcontainer.h index 877089e4c..837b168d7 100644 --- a/src/dolphinviewcontainer.h +++ b/src/dolphinviewcontainer.h @@ -93,6 +93,8 @@ public: void setAutoGrabFocus(bool grab); bool autoGrabFocus() const; + QString currentSearchText() const; + const DolphinStatusBar* statusBar() const; DolphinStatusBar* statusBar(); |
