┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphinviewcontainer.cpp
diff options
context:
space:
mode:
authorEmmanuel Pescosta <[email protected]>2014-03-28 18:48:48 +0100
committerEmmanuel Pescosta <[email protected]>2014-03-28 18:48:48 +0100
commit5d63b9a111e6ae76ff7b9f5ba9cd26be873aa115 (patch)
tree2ea10c0569e29c258330d6fe19fbe24dd5d88b7f /src/dolphinviewcontainer.cpp
parent5c2f52e62a7cfef961c2f67585c84c04b4193370 (diff)
When you open a new tab while the search mode is enabled, the
newly opened tab also starts the same search (Because new tab is opened with the current view url), but the search box is in read-only mode. So you cannot close the search bar nor edit the search text. This patch fixes this by parsing the search url. The value of the "search" parameter is used as search text and the value of the "url" parameter is used for the search path ("root" folder for the search when "Search from here" mode is enabled). In case of Baloo search urls, we use Baloo::Query::fromSearchUrl. Removed everything related to read only mode in DolphinSearchBox, not needed anymore. REVIEW: 111968 BUG: 311950 FIXED-IN: 4.13.0
Diffstat (limited to 'src/dolphinviewcontainer.cpp')
-rw-r--r--src/dolphinviewcontainer.cpp30
1 files changed, 6 insertions, 24 deletions
diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp
index 768fd5ef9..57452b9e4 100644
--- a/src/dolphinviewcontainer.cpp
+++ b/src/dolphinviewcontainer.cpp
@@ -314,36 +314,18 @@ void DolphinViewContainer::setSearchModeEnabled(bool enabled)
m_urlNavigator->setVisible(!enabled);
if (enabled) {
- KUrl url = m_urlNavigator->locationUrl();
- m_searchBox->setText(QString());
- m_searchBox->setReadOnly(isSearchUrl(url), url);
-
- // Remember the most recent non-search URL as search path
- // of the search-box, so that it can be restored
- // when switching back to the URL navigator.
- int index = m_urlNavigator->historyIndex();
- const int historySize = m_urlNavigator->historySize();
- while (isSearchUrl(url) && (index < historySize)) {
- ++index;
- url = m_urlNavigator->locationUrl(index);
- }
-
- if (!isSearchUrl(url)) {
- m_searchBox->setSearchPath(url);
- }
+ const KUrl& locationUrl = m_urlNavigator->locationUrl();
+ m_searchBox->fromSearchUrl(locationUrl);
} else {
m_view->setViewPropertiesContext(QString());
// Restore the URL for the URL navigator. If Dolphin has been
// started with a search-URL, the home URL is used as fallback.
- const KUrl url = m_searchBox->searchPath();
- if (url.isValid() && !url.isEmpty()) {
- if (isSearchUrl(url)) {
- m_urlNavigator->goHome();
- } else {
- m_urlNavigator->setLocationUrl(url);
- }
+ KUrl url = m_searchBox->searchPath();
+ if (url.isEmpty() || !url.isValid() || isSearchUrl(url)) {
+ url = GeneralSettings::self()->homeUrl();
}
+ m_urlNavigator->setLocationUrl(url);
}
}