]> cloud.milkyroute.net Git - dolphin.git/commitdiff
BUG: 164489
authorRahman Duran <a.rahman.duran@gmail.com>
Sun, 29 Mar 2009 11:54:40 +0000 (11:54 +0000)
committerRahman Duran <a.rahman.duran@gmail.com>
Sun, 29 Mar 2009 11:54:40 +0000 (11:54 +0000)
Make Dolphin benefit from new TerminalInterfaceV2 functions.

svn path=/trunk/KDE/kdebase/apps/; revision=946382

src/panels/terminal/terminalpanel.cpp
src/panels/terminal/terminalpanel.h

index 59301514723b8538fd82bf7ecfb6872105361d3e..ae5e45f097c091ebbe01462fcf43e7341c50bf53 100644 (file)
 #include "terminalpanel.h"
 
 #include <klibloader.h>
-#include <kde_terminal_interface.h>
+#include <kde_terminal_interface_v2.h>
 #include <kparts/part.h>
 #include <kshell.h>
 
 #include <QBoxLayout>
 #include <QShowEvent>
 
+#include <kdebug.h>
+
 TerminalPanel::TerminalPanel(QWidget* parent) :
     Panel(parent),
     m_layout(0),
@@ -55,9 +57,14 @@ void TerminalPanel::setUrl(const KUrl& url)
     }
 
     Panel::setUrl(url);
-    if ((m_terminal != 0) && isVisible() && url.isLocalFile()) {
+    const bool sendInput = (m_terminal != 0)
+                           && (m_terminal->foregroundProcessId() == -1)
+                           && isVisible()
+                           && url.isLocalFile();
+    if (sendInput) {
         m_terminal->sendInput("cd " + KShell::quoteArg(url.toLocalFile()) + '\n');
     }
+
 }
 
 void TerminalPanel::terminalExited()
@@ -80,9 +87,10 @@ void TerminalPanel::showEvent(QShowEvent* event)
             connect(part, SIGNAL(destroyed(QObject*)), this, SLOT(terminalExited()));
             m_terminalWidget = part->widget();
             m_layout->addWidget(m_terminalWidget);
-            m_terminal = qobject_cast<TerminalInterface *>(part);
+            m_terminal = qobject_cast<TerminalInterfaceV2 *>(part);
             m_terminal->showShellInDir(url().path());
-        }
+
+        }        
     }
     if (m_terminal != 0) {
         m_terminal->sendInput("cd " + KShell::quoteArg(url().path()) + '\n');
index 672938c32c48910c1993bc56b1a85a0796426595..4e060bbefba73fad2bc860ca58c6edcfeebae100 100644 (file)
@@ -22,7 +22,7 @@
 
 #include <panels/panel.h>
 
-class TerminalInterface;
+class TerminalInterfaceV2;
 class QVBoxLayout;
 class QWidget;
 
@@ -55,7 +55,7 @@ protected:
 
 private:
     QVBoxLayout* m_layout;
-    TerminalInterface* m_terminal;
+    TerminalInterfaceV2* m_terminal;
     QWidget* m_terminalWidget;
 };