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()
#include <kde_terminal_interface_v2.h>
#include <kparts/part.h>
#include <kshell.h>
+#include <kio/netaccess.h>
#include <QBoxLayout>
#include <QShowEvent>
}
Panel::setUrl(url);
+ KUrl mostLocalUrl = KIO::NetAccess::mostLocalUrl(url, 0);
const bool sendInput = (m_terminal != 0)
&& (m_terminal->foregroundProcessId() == -1)
&& isVisible()
- && url.isLocalFile();
+ && mostLocalUrl.isLocalFile();
if (sendInput) {
- m_terminal->sendInput("cd " + KShell::quoteArg(url.toLocalFile()) + '\n');
+ m_terminal->sendInput("cd " + KShell::quoteArg(mostLocalUrl.toLocalFile()) + '\n');
}
}