From 73fbb1a3d1b32562ac9b217f7bf437b0366c49aa Mon Sep 17 00:00:00 2001 From: Rafael Fernández López Date: Wed, 19 Dec 2007 01:35:09 +0000 Subject: Now the konsole part is autodestructed when no tabs do exist. This makes the desired effect on dolphin when typing "exit" on the terminal, the dock will be hidden. BUG: 153648 svn path=/trunk/KDE/kdebase/apps/; revision=750276 --- src/terminalsidebarpage.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/terminalsidebarpage.cpp') diff --git a/src/terminalsidebarpage.cpp b/src/terminalsidebarpage.cpp index ced80ab95..61cc5aef8 100644 --- a/src/terminalsidebarpage.cpp +++ b/src/terminalsidebarpage.cpp @@ -58,6 +58,26 @@ void TerminalSidebarPage::setUrl(const KUrl& url) } } +void TerminalSidebarPage::terminalExited() +{ + emit hideTerminalSidebarPage(); + + KPluginFactory* factory = KPluginLoader("libkonsolepart").factory(); + KParts::ReadOnlyPart* part = factory ? (factory->create(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(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(); + } +} + void TerminalSidebarPage::showEvent(QShowEvent* event) { if (event->spontaneous()) { @@ -69,6 +89,7 @@ void TerminalSidebarPage::showEvent(QShowEvent* event) KPluginFactory* factory = KPluginLoader("libkonsolepart").factory(); KParts::ReadOnlyPart* part = factory ? (factory->create(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(part); -- cgit v1.3