Changeset View
Changeset View
Standalone View
Standalone View
app/terminal.cpp
Show All 36 Lines | |||||
37 | #include <QLabel> | 37 | #include <QLabel> | ||
38 | #include <QWidget> | 38 | #include <QWidget> | ||
39 | 39 | | |||
40 | #include <QKeyEvent> | 40 | #include <QKeyEvent> | ||
41 | 41 | | |||
42 | 42 | | |||
43 | int Terminal::m_availableTerminalId = 0; | 43 | int Terminal::m_availableTerminalId = 0; | ||
44 | 44 | | |||
45 | Terminal::Terminal(QWidget* parent) : QObject(parent) | 45 | Terminal::Terminal(QWidget* parent, const QString& workingDir) : QObject(parent) | ||
46 | { | 46 | { | ||
47 | m_terminalId = m_availableTerminalId; | 47 | m_terminalId = m_availableTerminalId; | ||
48 | m_availableTerminalId++; | 48 | m_availableTerminalId++; | ||
49 | 49 | | |||
50 | m_keyboardInputEnabled = true; | 50 | m_keyboardInputEnabled = true; | ||
51 | 51 | | |||
52 | m_monitorActivityEnabled = false; | 52 | m_monitorActivityEnabled = false; | ||
53 | m_monitorSilenceEnabled = false; | 53 | m_monitorSilenceEnabled = false; | ||
Show All 27 Lines | 71 | { | |||
81 | { | 81 | { | ||
82 | m_terminalWidget->setFocusPolicy(Qt::WheelFocus); | 82 | m_terminalWidget->setFocusPolicy(Qt::WheelFocus); | ||
83 | m_terminalWidget->installEventFilter(this); | 83 | m_terminalWidget->installEventFilter(this); | ||
84 | } | 84 | } | ||
85 | 85 | | |||
86 | disableOffendingPartActions(); | 86 | disableOffendingPartActions(); | ||
87 | 87 | | |||
88 | m_terminalInterface = qobject_cast<TerminalInterface*>(m_part); | 88 | m_terminalInterface = qobject_cast<TerminalInterface*>(m_part); | ||
89 | if (m_terminalInterface) m_terminalInterface->showShellInDir(QDir::homePath()); | 89 | if (m_terminalInterface) m_terminalInterface->showShellInDir(workingDir); | ||
90 | } | 90 | } | ||
91 | else | 91 | else | ||
92 | displayKPartLoadError(); | 92 | displayKPartLoadError(); | ||
93 | } | 93 | } | ||
94 | 94 | | |||
95 | Terminal::~Terminal() | 95 | Terminal::~Terminal() | ||
96 | { | 96 | { | ||
97 | emit destroyed(m_terminalId); | 97 | emit destroyed(m_terminalId); | ||
▲ Show 20 Lines • Show All 130 Lines • ▼ Show 20 Line(s) | 225 | { | |||
228 | emit titleChanged(m_terminalId, m_title); | 228 | emit titleChanged(m_terminalId, m_title); | ||
229 | } | 229 | } | ||
230 | 230 | | |||
231 | void Terminal::runCommand(const QString& command) | 231 | void Terminal::runCommand(const QString& command) | ||
232 | { | 232 | { | ||
233 | m_terminalInterface->sendInput(command + QStringLiteral("\n")); | 233 | m_terminalInterface->sendInput(command + QStringLiteral("\n")); | ||
234 | } | 234 | } | ||
235 | 235 | | |||
236 | QString Terminal::getCwd() | ||||
237 | { | ||||
238 | return m_terminalInterface->currentWorkingDirectory(); | ||||
239 | } | ||||
240 | | ||||
236 | void Terminal::manageProfiles() | 241 | void Terminal::manageProfiles() | ||
237 | { | 242 | { | ||
238 | QMetaObject::invokeMethod(m_part, "showManageProfilesDialog", | 243 | QMetaObject::invokeMethod(m_part, "showManageProfilesDialog", | ||
239 | Qt::QueuedConnection, Q_ARG(QWidget*, QApplication::activeWindow())); | 244 | Qt::QueuedConnection, Q_ARG(QWidget*, QApplication::activeWindow())); | ||
240 | } | 245 | } | ||
241 | 246 | | |||
242 | void Terminal::editProfile() | 247 | void Terminal::editProfile() | ||
243 | { | 248 | { | ||
▲ Show 20 Lines • Show All 60 Lines • Show Last 20 Lines |