mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-19 00:11:21 +00:00
BUG: 164489
Make Dolphin benefit from new TerminalInterfaceV2 functions. svn path=/trunk/KDE/kdebase/apps/; revision=946382
This commit is contained in:
parent
87594350e8
commit
53a9373a38
|
@ -20,13 +20,15 @@
|
||||||
#include "terminalpanel.h"
|
#include "terminalpanel.h"
|
||||||
|
|
||||||
#include <klibloader.h>
|
#include <klibloader.h>
|
||||||
#include <kde_terminal_interface.h>
|
#include <kde_terminal_interface_v2.h>
|
||||||
#include <kparts/part.h>
|
#include <kparts/part.h>
|
||||||
#include <kshell.h>
|
#include <kshell.h>
|
||||||
|
|
||||||
#include <QBoxLayout>
|
#include <QBoxLayout>
|
||||||
#include <QShowEvent>
|
#include <QShowEvent>
|
||||||
|
|
||||||
|
#include <kdebug.h>
|
||||||
|
|
||||||
TerminalPanel::TerminalPanel(QWidget* parent) :
|
TerminalPanel::TerminalPanel(QWidget* parent) :
|
||||||
Panel(parent),
|
Panel(parent),
|
||||||
m_layout(0),
|
m_layout(0),
|
||||||
|
@ -55,9 +57,14 @@ void TerminalPanel::setUrl(const KUrl& url)
|
||||||
}
|
}
|
||||||
|
|
||||||
Panel::setUrl(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');
|
m_terminal->sendInput("cd " + KShell::quoteArg(url.toLocalFile()) + '\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TerminalPanel::terminalExited()
|
void TerminalPanel::terminalExited()
|
||||||
|
@ -80,9 +87,10 @@ void TerminalPanel::showEvent(QShowEvent* event)
|
||||||
connect(part, SIGNAL(destroyed(QObject*)), this, SLOT(terminalExited()));
|
connect(part, SIGNAL(destroyed(QObject*)), this, SLOT(terminalExited()));
|
||||||
m_terminalWidget = part->widget();
|
m_terminalWidget = part->widget();
|
||||||
m_layout->addWidget(m_terminalWidget);
|
m_layout->addWidget(m_terminalWidget);
|
||||||
m_terminal = qobject_cast<TerminalInterface *>(part);
|
m_terminal = qobject_cast<TerminalInterfaceV2 *>(part);
|
||||||
m_terminal->showShellInDir(url().path());
|
m_terminal->showShellInDir(url().path());
|
||||||
}
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (m_terminal != 0) {
|
if (m_terminal != 0) {
|
||||||
m_terminal->sendInput("cd " + KShell::quoteArg(url().path()) + '\n');
|
m_terminal->sendInput("cd " + KShell::quoteArg(url().path()) + '\n');
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
#include <panels/panel.h>
|
#include <panels/panel.h>
|
||||||
|
|
||||||
class TerminalInterface;
|
class TerminalInterfaceV2;
|
||||||
class QVBoxLayout;
|
class QVBoxLayout;
|
||||||
class QWidget;
|
class QWidget;
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QVBoxLayout* m_layout;
|
QVBoxLayout* m_layout;
|
||||||
TerminalInterface* m_terminal;
|
TerminalInterfaceV2* m_terminal;
|
||||||
QWidget* m_terminalWidget;
|
QWidget* m_terminalWidget;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue