+void DolphinPart::slotOpenTerminal()
+{
+ KConfigGroup confGroup(KGlobal::config(), "General"); // set by componentchooser kcm
+ const QString preferredTerminal = confGroup.readPathEntry("TerminalApplication", "konsole");
+
+ QString dir(QDir::homePath());
+
+ KUrl u(url());
+
+ // 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.
+ u = KIO::NetAccess::mostLocalUrl(u, widget());
+
+ //If the URL is local after the above conversion, set the directory.
+ if (u.isLocalFile()) {
+ dir = u.path();
+ }
+
+ // Compensate for terminal having arguments.
+ QStringList args = KShell::splitArgs(preferredTerminal);
+ if (args.isEmpty()) {
+ return;
+ }
+ const QString prog = args.takeFirst();
+ if (prog == "konsole") {
+ args << "--workdir";
+ args << dir;
+ }
+ QProcess::startDetached(prog, args);
+}
+