+void DolphinViewContainer::restoreView(const KUrl& url)
+{
+ if (KProtocolManager::supportsListing(url)) {
+ m_view->updateView(url, m_urlNavigator->savedRootUrl());
+ if (isActive()) {
+ // 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. Using QTimer::singleShow() works reliable, however
+ // QMetaObject::invokeMethod() with a queued connection does not work, which might
+ // indicate that we should pass a hint to DolphinView::updateView()
+ // regarding the focus instead. To test: Enter an URL and press CTRL+Enter.
+ // Expected result: The view should get the focus.
+ 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;
+ }
+ } else {
+ showErrorMessage(i18nc("@info:status",
+ "Protocol not supported by Dolphin, Konqueror has been launched"));
+ }
+ const QString command = app + ' ' + url.pathOrUrl();
+ KRun::runCommand(command, app, app, this);
+ } else {
+ showErrorMessage(i18nc("@info:status", "Invalid protocol"));
+ }
+}
+
+void DolphinViewContainer::saveRootUrl(const KUrl& url)
+{
+ Q_UNUSED(url);
+ m_urlNavigator->saveRootUrl(m_view->rootUrl());
+}
+
+void DolphinViewContainer::dropUrls(const KUrl& destination, QDropEvent* event)
+{
+ DragAndDropHelper::instance().dropUrls(KFileItem(), destination, event, this);
+}
+
+void DolphinViewContainer::redirect(const KUrl& oldUrl, const KUrl& newUrl)
+{
+ Q_UNUSED(oldUrl);
+ const bool block = m_urlNavigator->signalsBlocked();
+ m_urlNavigator->blockSignals(true);
+ m_urlNavigator->setUrl(newUrl);
+ m_urlNavigator->blockSignals(block);
+}
+
+void DolphinViewContainer::requestFocus()
+{
+ m_view->setFocus();
+}
+