]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/panels/terminal/terminalpanel.cpp
The &-shortcut from another action is not set until the action has been shown at...
[dolphin.git] / src / panels / terminal / terminalpanel.cpp
index 856eed4c0fdbfce6a435a0108eb41578992b6549..12b319f3c6da0a270d2296af65116ef1f1580ed6 100644 (file)
@@ -52,26 +52,26 @@ QSize TerminalPanel::sizeHint() const
     return size;
 }
 
-void TerminalPanel::setUrl(const KUrl& url)
+void TerminalPanel::terminalExited()
 {
-    if (!url.isValid() || (url == Panel::url())) {
-        return;
-    }
+    emit hideTerminalPanel();
+    m_terminal = 0;
+}
 
-    Panel::setUrl(url);
+bool TerminalPanel::urlChanged()
+{
+    if (!url().isValid()) {
+        return false;
+    }
 
     const bool sendInput = (m_terminal != 0)
                            && (m_terminal->foregroundProcessId() == -1)
                            && isVisible();
     if (sendInput) {
-        changeDir(url);
+        changeDir(url());
     }
-}
 
-void TerminalPanel::terminalExited()
-{
-    emit hideTerminalPanel();
-    m_terminal = 0;
+    return true;
 }
 
 void TerminalPanel::showEvent(QShowEvent* event)
@@ -121,12 +121,11 @@ void TerminalPanel::sendCdToTerminal(const QString& dir)
         // The TerminalV2 interface does not provide a way to delete the
         // current line before sending a new input. This is mandatory,
         // otherwise sending a 'cd x' to a existing 'rm -rf *' might
-        // result in data loss. As workaround backspaces are send...
-        QString clearLine;
-        for (int i = 0; i < 256; ++i) {
-            clearLine.append(QChar(8));
-        }
-        m_terminal->sendInput(clearLine);
+        // result in data loss. As workaround Ctrl+C is send.
+        QString cancel;
+        cancel.append(QChar(3));
+        cancel.append(QChar('c'));
+        m_terminal->sendInput(cancel);
     }
 
     m_terminal->sendInput("cd " + KShell::quoteArg(dir) + '\n');