X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/1318f16fd7b84de79c04eb468d61e1c9b7b52e15..1826f905d706925456763394de17294bcb6d1c35:/src/dolphinviewcontainer.cpp diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp index 63d5bd27b..076551e5d 100644 --- a/src/dolphinviewcontainer.cpp +++ b/src/dolphinviewcontainer.cpp @@ -84,6 +84,7 @@ DolphinViewContainer::DolphinViewContainer(const QUrl &url, QWidget *parent) m_searchBox = new DolphinSearchBox(this); m_searchBox->hide(); connect(m_searchBox, &DolphinSearchBox::activated, this, &DolphinViewContainer::activate); + connect(m_searchBox, &DolphinSearchBox::openRequest, this, &DolphinViewContainer::openSearchBox); connect(m_searchBox, &DolphinSearchBox::closeRequest, this, &DolphinViewContainer::closeSearchBox); connect(m_searchBox, &DolphinSearchBox::searchRequest, this, &DolphinViewContainer::startSearching); connect(m_searchBox, &DolphinSearchBox::focusViewRequest, this, &DolphinViewContainer::requestFocus); @@ -727,7 +728,8 @@ void DolphinViewContainer::slotItemActivated(const KFileItem &item) } KIO::OpenUrlJob *job = new KIO::OpenUrlJob(item.targetUrl(), item.mimetype()); - job->setUiDelegate(KIO::createDefaultJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this)); + // Auto*Warning*Handling, errors are put in a KMessageWidget by us in slotOpenUrlFinished. + job->setUiDelegate(KIO::createDefaultJobUiDelegate(KJobUiDelegate::AutoWarningHandlingEnabled, this)); job->setShowOpenOrExecuteDialog(true); connect(job, &KIO::OpenUrlJob::finished, this, &DolphinViewContainer::slotOpenUrlFinished); job->start(); @@ -817,11 +819,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. @@ -839,7 +843,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(); } } @@ -891,6 +899,11 @@ void DolphinViewContainer::startSearching() } } +void DolphinViewContainer::openSearchBox() +{ + setSearchModeEnabled(true); +} + void DolphinViewContainer::closeSearchBox() { setSearchModeEnabled(false);