this, SLOT(showInfoMessage(const QString&)));
connect(m_dirLister, SIGNAL(errorMessage(const QString&)),
this, SLOT(showErrorMessage(const QString&)));
+ connect(m_dirLister, SIGNAL(urlIsFileError(const KUrl&)),
+ this, SLOT(openFile(const KUrl&)));
m_view = new DolphinView(this,
url,
void DolphinViewContainer::setUrl(const KUrl& newUrl)
{
m_urlNavigator->setUrl(newUrl);
-
- // Temporary disable the 'File'->'Create New...' menu until
- // the write permissions can be checked in a fast way at
- // DolphinViewContainer::slotDirListerCompleted().
- m_mainWindow->newMenu()->menu()->setEnabled(false);
+ if (newUrl != m_urlNavigator->url()) {
+ // Temporary disable the 'File'->'Create New...' menu until
+ // the write permissions can be checked in a fast way at
+ // DolphinViewContainer::slotDirListerCompleted().
+ m_mainWindow->newMenu()->menu()->setEnabled(false);
+ }
}
const KUrl& DolphinViewContainer::url() const
}
updateStatusBar();
- QTimer::singleShot(100, this, SLOT(restoreContentsPos()));
+ QMetaObject::invokeMethod(this, "restoreContentsPos", Qt::QueuedConnection);
// Enable the 'File'->'Create New...' menu only if the directory
// supports writing.
{
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 {
- // The URL navigator only checks for validity, not
- // if the URL can be listed.
- showErrorMessage(i18nc("@info:status", "Protocol not supported by Dolphin, Konqueror has been launched"));
- QString command = "konqueror " + url.pathOrUrl();
- KRun::runCommand(command, "konqueror", "konqueror", this);
+ showErrorMessage(i18nc("@info:status", "Invalid protocol"));
}
}
item.run();
}
+void DolphinViewContainer::openFile(const KUrl& url)
+{
+ // Using m_dolphinModel for getting the file item instance is not possible
+ // here: openFile() is triggered by an error of the directory lister
+ // job, so the file item must be received "manually".
+ const KFileItem item(KFileItem::Unknown, KFileItem::Unknown, url);
+ slotItemTriggered(item);
+}
+
#include "dolphinviewcontainer.moc"