]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinviewcontainer.cpp
Mention invalid protocol name
[dolphin.git] / src / dolphinviewcontainer.cpp
index 66a9a116ac3cf487fe65aa74e3ab21f7d782b564..85e7dc2baea8a8a39a38da41f48fa1742aef8d2a 100644 (file)
@@ -818,11 +818,13 @@ void DolphinViewContainer::slotUrlNavigatorLocationChanged(const QUrl &url)
     }
 
     if (KProtocolManager::supportsListing(url)) {
-        setSearchModeEnabled(isSearchUrl(url));
+        const bool searchBoxInitialized = isSearchModeEnabled() && m_searchBox->text().isEmpty();
+        setSearchModeEnabled(isSearchUrl(url) || searchBoxInitialized);
+
         m_view->setUrl(url);
         tryRestoreViewState();
 
-        if (m_autoGrabFocus && isActive() && !isSearchUrl(url)) {
+        if (m_autoGrabFocus && isActive() && !isSearchModeEnabled()) {
             // When an URL has been entered, the view should get the focus.
             // The focus must be requested asynchronously, as changing the URL might create
             // a new view widget.
@@ -840,7 +842,11 @@ void DolphinViewContainer::slotUrlNavigatorLocationChanged(const QUrl &url)
         QDesktopServices::openUrl(url);
         redirect(QUrl(), m_urlNavigator->locationUrl(1));
     } else {
-        showMessage(i18nc("@info:status", "Invalid protocol"), Error);
+        if (!url.scheme().isEmpty()) {
+            showMessage(i18nc("@info:status", "Invalid protocol '%1'", url.scheme()), Error);
+        } else {
+            showMessage(i18nc("@info:status", "Invalid protocol"), Error);
+        }
         m_urlNavigator->goBack();
     }
 }