+void DolphinViewContainer::setSearchModeEnabled(bool enabled)
+{
+ m_searchBox->setVisible(enabled);
+ m_urlNavigator->setVisible(!enabled);
+
+ if (enabled) {
+ // Remember the current URL, so that it can be restored
+ // when switching back to the URL navigator
+ const KUrl url = m_urlNavigator->locationUrl();
+ m_searchBox->setSearchPath(url);
+ } else {
+ // 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() && !isSearchUrl(url)) {
+ m_urlNavigator->setLocationUrl(url);
+ } else {
+ m_urlNavigator->goHome();
+ }
+ }
+}
+
+bool DolphinViewContainer::isSearchModeEnabled() const
+{
+ return m_searchBox->isVisible();
+}
+