BUG: 164489

Make Dolphin benefit from new TerminalInterfaceV2 functions.


svn path=/trunk/KDE/kdebase/apps/; revision=946382
This commit is contained in:
Rahman Duran 2009-03-29 11:54:40 +00:00
parent 87594350e8
commit 53a9373a38
2 changed files with 14 additions and 6 deletions

View file

@ -20,13 +20,15 @@
#include "terminalpanel.h"
#include <klibloader.h>
#include <kde_terminal_interface.h>
#include <kde_terminal_interface_v2.h>
#include <kparts/part.h>
#include <kshell.h>
#include <QBoxLayout>
#include <QShowEvent>
#include <kdebug.h>
TerminalPanel::TerminalPanel(QWidget* parent) :
Panel(parent),
m_layout(0),
@ -55,9 +57,14 @@ void TerminalPanel::setUrl(const KUrl& url)
}
Panel::setUrl(url);
if ((m_terminal != 0) && isVisible() && url.isLocalFile()) {
const bool sendInput = (m_terminal != 0)
&& (m_terminal->foregroundProcessId() == -1)
&& isVisible()
&& url.isLocalFile();
if (sendInput) {
m_terminal->sendInput("cd " + KShell::quoteArg(url.toLocalFile()) + '\n');
}
}
void TerminalPanel::terminalExited()
@ -80,9 +87,10 @@ void TerminalPanel::showEvent(QShowEvent* event)
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 = qobject_cast<TerminalInterfaceV2 *>(part);
m_terminal->showShellInDir(url().path());
}
}
}
if (m_terminal != 0) {
m_terminal->sendInput("cd " + KShell::quoteArg(url().path()) + '\n');

View file

@ -22,7 +22,7 @@
#include <panels/panel.h>
class TerminalInterface;
class TerminalInterfaceV2;
class QVBoxLayout;
class QWidget;
@ -55,7 +55,7 @@ protected:
private:
QVBoxLayout* m_layout;
TerminalInterface* m_terminal;
TerminalInterfaceV2* m_terminal;
QWidget* m_terminalWidget;
};