]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/terminalsidebarpage.cpp
backport: fixed issue that the item height does not match to the number of lines...
[dolphin.git] / src / terminalsidebarpage.cpp
index 61cc5aef885708e6b890fe1b3a35f55e414c2aef..4749e7714c49fbf9eb634d533c4628a3ba2d2ced 100644 (file)
@@ -50,11 +50,13 @@ QSize TerminalSidebarPage::sizeHint() const
 
 void TerminalSidebarPage::setUrl(const KUrl& url)
 {
-    if (!SidebarPage::url().equals(url, KUrl::CompareWithoutTrailingSlash)) {
-        SidebarPage::setUrl(url);
-        if ((m_terminal != 0) && isVisible()) {
-            m_terminal->sendInput("cd " + KShell::quoteArg(url.path()) + '\n');
-        }
+    if (!url.isValid() || (url == SidebarPage::url())) {
+        return;
+    }
+
+    SidebarPage::setUrl(url);
+    if ((m_terminal != 0) && isVisible() && url.isLocalFile()) {
+        m_terminal->sendInput("cd " + KShell::quoteArg(url.path()) + '\n');
     }
 }
 
@@ -62,20 +64,7 @@ void TerminalSidebarPage::terminalExited()
 {
     emit hideTerminalSidebarPage();
 
-    KPluginFactory* factory = KPluginLoader("libkonsolepart").factory();
-    KParts::ReadOnlyPart* part = factory ? (factory->create<KParts::ReadOnlyPart>(this)) : 0;
-    if (part != 0) {
-        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->showShellInDir(url().path());
-    }
-    if (m_terminal != 0) {
-        m_terminal->sendInput("cd " + KShell::quoteArg(url().path()) + '\n');
-        m_terminal->sendInput("clear\n");
-        m_terminalWidget->setFocus();
-    }
+    m_terminal = 0;
 }
 
 void TerminalSidebarPage::showEvent(QShowEvent* event)