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
This commit is contained in:
Rafael Fernández López 2007-12-19 01:35:09 +00:00
parent 603681ba79
commit 73fbb1a3d1
3 changed files with 27 additions and 0 deletions

View file

@ -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());

View file

@ -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);

View file

@ -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() */