X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/3df68fb667a9d0df0bfe53ff762c88b9fcde28f6..c71c1c94be2e5ab2e14162a15780d4d12bee307b:/src/dolphinviewcontainer.cpp diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp index 416a63e67..98b812497 100644 --- a/src/dolphinviewcontainer.cpp +++ b/src/dolphinviewcontainer.cpp @@ -396,10 +396,7 @@ void DolphinViewContainer::setSearchModeEnabled(bool enabled) m_searchBox->setVisible(enabled); m_navigatorWidget->setVisible(!enabled); - if (enabled) { - const QUrl& locationUrl = m_urlNavigator->locationUrl(); - m_searchBox->fromSearchUrl(locationUrl); - } else { + if (!enabled) { m_view->setViewPropertiesContext(QString()); // Restore the URL for the URL navigator. If Dolphin has been @@ -456,7 +453,7 @@ QString DolphinViewContainer::caption() const } KFilePlacesModel *placesModel = DolphinPlacesModelSingleton::instance().placesModel(); - const auto& matchedPlaces = placesModel->match(placesModel->index(0,0), KFilePlacesModel::UrlRole, url(), 1, Qt::MatchExactly); + const auto& matchedPlaces = placesModel->match(placesModel->index(0,0), KFilePlacesModel::UrlRole, QUrl(url().adjusted(QUrl::StripTrailingSlash).toString(QUrl::FullyEncoded).append("/?")), 1, Qt::MatchRegExp); if (!matchedPlaces.isEmpty()) { return placesModel->text(matchedPlaces.first()); @@ -676,11 +673,15 @@ void DolphinViewContainer::slotUrlNavigatorLocationChanged(const QUrl& url) slotReturnPressed(); if (KProtocolManager::supportsListing(url)) { - setSearchModeEnabled(isSearchUrl(url)); + const bool searchUrl = isSearchUrl(url); + if (searchUrl) { + m_searchBox->fromSearchUrl(url); + } + setSearchModeEnabled(searchUrl); m_view->setUrl(url); tryRestoreViewState(); - if (m_autoGrabFocus && isActive() && !isSearchUrl(url)) { + if (m_autoGrabFocus && isActive() && !searchUrl) { // 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. @@ -699,7 +700,7 @@ void DolphinViewContainer::slotUrlNavigatorLocationChanged(const QUrl& url) app = browser; if (app.startsWith('!')) { // a literal command has been configured, remove the '!' prefix - app = app.mid(1); + app.remove(0, 1); } } } else { @@ -787,7 +788,7 @@ void DolphinViewContainer::showErrorMessage(const QString& msg) bool DolphinViewContainer::isSearchUrl(const QUrl& url) const { - return url.scheme().contains(QStringLiteral("search")); + return url.scheme().contains(QLatin1String("search")); } void DolphinViewContainer::saveViewState()