From: Rafael Fernández López Date: Wed, 19 Dec 2007 01:35:09 +0000 (+0000) Subject: Now the konsole part is autodestructed when no tabs do exist. This makes the desired... X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/73fbb1a3d1b32562ac9b217f7bf437b0366c49aa 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 --- diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index acd1282a2..6eb45ac0d 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -1274,6 +1274,8 @@ void DolphinMainWindow::setupDockWidgets() SidebarPage* terminalWidget = new TerminalSidebarPage(terminalDock); terminalDock->setWidget(terminalWidget); + connect(terminalWidget, SIGNAL(hideTerminalSidebarPage()), terminalDock, SLOT(hide())); + terminalDock->toggleViewAction()->setText(i18nc("@title:window", "Terminal")); terminalDock->toggleViewAction()->setShortcut(Qt::Key_F4); actionCollection()->addAction("show_terminal_panel", terminalDock->toggleViewAction()); 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); diff --git a/src/terminalsidebarpage.h b/src/terminalsidebarpage.h index 5a4d40bdb..875a6b706 100644 --- a/src/terminalsidebarpage.h +++ b/src/terminalsidebarpage.h @@ -44,6 +44,10 @@ public: public slots: /** @see SidebarPage::setUrl(). */ virtual void setUrl(const KUrl& url); + void terminalExited(); + +signals: + void hideTerminalSidebarPage(); protected: /** @see QWidget::showEvent() */