X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/db1b90e4fa6b3f59c2f7bd0bc0d472332072980a..ac73af7bedeebe2afa451249e8a6500651a6ec00:/src/terminalsidebarpage.cpp diff --git a/src/terminalsidebarpage.cpp b/src/terminalsidebarpage.cpp index d3673b164..4a82599f0 100644 --- a/src/terminalsidebarpage.cpp +++ b/src/terminalsidebarpage.cpp @@ -30,7 +30,8 @@ TerminalSidebarPage::TerminalSidebarPage(QWidget* parent) : SidebarPage(parent), m_layout(0), - m_terminal(0) + m_terminal(0), + m_terminalWidget(0) { m_layout = new QVBoxLayout(this); m_layout->setMargin(0); @@ -57,6 +58,13 @@ void TerminalSidebarPage::setUrl(const KUrl& url) } } +void TerminalSidebarPage::terminalExited() +{ + emit hideTerminalSidebarPage(); + + m_terminal = 0; +} + void TerminalSidebarPage::showEvent(QShowEvent* event) { if (event->spontaneous()) { @@ -65,16 +73,20 @@ void TerminalSidebarPage::showEvent(QShowEvent* event) } if (m_terminal == 0) { - KPluginFactory* factory = KLibLoader::self()->factory("libkonsolepart"); + KPluginFactory* factory = KPluginLoader("libkonsolepart").factory(); KParts::ReadOnlyPart* part = factory ? (factory->create(this)) : 0; if (part != 0) { - m_layout->addWidget(part->widget()); + connect(part, SIGNAL(destroyed(QObject*)), this, SLOT(terminalExited())); + m_terminalWidget = part->widget(); + m_layout->addWidget(m_terminalWidget); m_terminal = qobject_cast(part); + m_terminal->showShellInDir(url().path()); } } if (m_terminal != 0) { - m_terminal->showShellInDir(url().path()); + m_terminal->sendInput("cd " + KShell::quoteArg(url().path()) + '\n'); m_terminal->sendInput("clear\n"); + m_terminalWidget->setFocus(); } SidebarPage::showEvent(event);