┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dolphinmainwindow.cpp13
-rw-r--r--src/panels/terminal/terminalpanel.cpp6
2 files changed, 16 insertions, 3 deletions
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp
index 3ce1e9f2d..f5d175482 100644
--- a/src/dolphinmainwindow.cpp
+++ b/src/dolphinmainwindow.cpp
@@ -813,7 +813,18 @@ void DolphinMainWindow::toggleShowMenuBar()
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()
diff --git a/src/panels/terminal/terminalpanel.cpp b/src/panels/terminal/terminalpanel.cpp
index ae5e45f09..8ee46d7a4 100644
--- a/src/panels/terminal/terminalpanel.cpp
+++ b/src/panels/terminal/terminalpanel.cpp
@@ -23,6 +23,7 @@
#include <kde_terminal_interface_v2.h>
#include <kparts/part.h>
#include <kshell.h>
+#include <kio/netaccess.h>
#include <QBoxLayout>
#include <QShowEvent>
@@ -57,12 +58,13 @@ void TerminalPanel::setUrl(const KUrl& url)
}
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');
}
}