#include <konq_fileitemcapabilities.h>
#include <konq_operations.h>
#include <kurl.h>
+#include <krun.h>
#include "dolphinmodel.h"
#include "dolphincolumnview.h"
#include "dolphincontroller.h"
-#include "dolphindropcontroller.h"
#include "dolphinstatusbar.h"
#include "dolphinmainwindow.h"
#include "dolphindirlister.h"
#include "dolphindetailsview.h"
#include "dolphiniconsview.h"
#include "dolphincontextmenu.h"
+#include "draganddrophelper.h"
#include "filterbar.h"
#include "kurlnavigator.h"
#include "viewproperties.h"
this, SLOT(slotItemTriggered(KFileItem)));
connect(m_view, SIGNAL(startedPathLoading(const KUrl&)),
this, SLOT(saveRootUrl(const KUrl&)));
+ connect(m_view, SIGNAL(redirection(KUrl, KUrl)),
+ this, SLOT(redirect(KUrl, KUrl)));
connect(m_urlNavigator, SIGNAL(urlChanged(const KUrl&)),
this, SLOT(restoreView(const KUrl&)));
void DolphinViewContainer::restoreView(const KUrl& url)
{
- if (url.protocol().isEmpty()) {
- // The URL navigator only checks for validity, not
- // if the URL can be listed.
- showErrorMessage(i18nc("@info:status", "Protocol not supported"));
- } else {
+ if (KProtocolManager::supportsListing(url)) {
m_view->updateView(url, m_urlNavigator->savedRootUrl());
+ } 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::dropUrls(const KUrl& destination, QDropEvent* event)
{
- DolphinDropController::dropUrls(KFileItem(), destination, event, this);
+ 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::slotItemTriggered(const KFileItem& item)