"file:" URL, but is nevertheless local (e.g., "desktop:").
This fix is also applied to the new "Open external Terminal" action
which will be in KDE 4.3.
BUG: 167810
svn path=/trunk/KDE/kdebase/apps/; revision=969265
void DolphinMainWindow::openTerminal()
{
void DolphinMainWindow::openTerminal()
{
- KToolInvocation::invokeTerminal(QString(), m_activeViewContainer->url().path());
+ QString dir(QDir::homePath());
+
+ // If the given directory is not local, it can still be the URL of an
+ // ioslave using UDS_LOCAL_PATH which to be converted first.
+ KUrl url = KIO::NetAccess::mostLocalUrl(m_activeViewContainer->url(), this);
+
+ //If the URL is local after the above conversion, set the directory.
+ if (url.isLocalFile()) {
+ dir = url.toLocalFile();
+ }
+
+ KToolInvocation::invokeTerminal(QString(), dir);
}
void DolphinMainWindow::editSettings()
}
void DolphinMainWindow::editSettings()
#include <kde_terminal_interface_v2.h>
#include <kparts/part.h>
#include <kshell.h>
#include <kde_terminal_interface_v2.h>
#include <kparts/part.h>
#include <kshell.h>
+#include <kio/netaccess.h>
#include <QBoxLayout>
#include <QShowEvent>
#include <QBoxLayout>
#include <QShowEvent>
+ KUrl mostLocalUrl = KIO::NetAccess::mostLocalUrl(url, 0);
const bool sendInput = (m_terminal != 0)
&& (m_terminal->foregroundProcessId() == -1)
&& isVisible()
const bool sendInput = (m_terminal != 0)
&& (m_terminal->foregroundProcessId() == -1)
&& isVisible()
+ && mostLocalUrl.isLocalFile();
- m_terminal->sendInput("cd " + KShell::quoteArg(url.toLocalFile()) + '\n');
+ m_terminal->sendInput("cd " + KShell::quoteArg(mostLocalUrl.toLocalFile()) + '\n');