+void DolphinViewContainer::slotUrlNavigatorLocationChanged(const KUrl& url)
+{
+ if (KProtocolManager::supportsListing(url)) {
+ // Assure that the search box is shown instead of the URL navigator in case
+ // that the URL \p url is a search URL (e. g. nepomuksearch:// or filenamesearch://).
+ if (isSearchUrl(url)) {
+ if (!m_searchBox->isVisible()) {
+ m_searchBox->setVisible(true);
+ m_urlNavigator->setVisible(false);
+ }
+ } else if (!m_urlNavigator->isVisible()) {
+ m_urlNavigator->setVisible(true);
+ m_searchBox->setVisible(false);
+ }
+
+ m_view->setUrl(url);
+ if (isActive() && !isSearchUrl(url)) {
+ // 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.
+ QTimer::singleShot(0, this, SLOT(requestFocus()));
+ }
+ } else if (KProtocolManager::isSourceProtocol(url)) {
+ QString app = "konqueror";
+ if (url.protocol().startsWith(QLatin1String("http"))) {
+ showErrorMessage(i18nc("@info:status",
+ "Dolphin does not support web pages, the web browser has been launched"));
+ const KConfigGroup config(KSharedConfig::openConfig("kdeglobals"), "General");
+ const QString browser = config.readEntry("BrowserApplication");
+ if (!browser.isEmpty()) {
+ app = browser;
+ if (app.startsWith('!')) {
+ // a literal command has been configured, remove the '!' prefix
+ app = app.mid(1);
+ }
+ }