┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Fernández López <[email protected]>2007-12-19 01:35:09 +0000
committerRafael Fernández López <[email protected]>2007-12-19 01:35:09 +0000
commit73fbb1a3d1b32562ac9b217f7bf437b0366c49aa (patch)
treee30db51ad20507714b2be7ed4472d72547710bf7
parent603681ba79d6fc313c8e3152249d63cdcbdb2c89 (diff)
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
-rw-r--r--src/dolphinmainwindow.cpp2
-rw-r--r--src/terminalsidebarpage.cpp21
-rw-r--r--src/terminalsidebarpage.h4
3 files changed, 27 insertions, 0 deletions
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<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();
+ }
+}
+
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<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);
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() */