diff options
Diffstat (limited to 'src/panels/terminal')
| -rw-r--r-- | src/panels/terminal/terminalpanel.cpp | 16 | ||||
| -rw-r--r-- | src/panels/terminal/terminalpanel.h | 4 |
2 files changed, 16 insertions, 4 deletions
diff --git a/src/panels/terminal/terminalpanel.cpp b/src/panels/terminal/terminalpanel.cpp index b6c30c29c..3377bab24 100644 --- a/src/panels/terminal/terminalpanel.cpp +++ b/src/panels/terminal/terminalpanel.cpp @@ -79,12 +79,12 @@ void TerminalPanel::terminalExited() emit hideTerminalPanel(); } -bool TerminalPanel::isHiddenInVisibleWindow() +bool TerminalPanel::isHiddenInVisibleWindow() const { return parentWidget() && parentWidget()->isHidden() && m_terminal - && (m_terminal->foregroundProcessId() == -1); + && !hasProgramRunning(); } void TerminalPanel::dockVisibilityChanged() @@ -107,13 +107,23 @@ void TerminalPanel::dockVisibilityChanged() } } +QString TerminalPanel::runningProgramName() const +{ + return m_terminal ? m_terminal->foregroundProcessName() : QString(); +} + +bool TerminalPanel::hasProgramRunning() const +{ + return m_terminal && (m_terminal->foregroundProcessId() != -1); +} + bool TerminalPanel::urlChanged() { if (!url().isValid()) { return false; } - const bool sendInput = m_terminal && (m_terminal->foregroundProcessId() == -1) && isVisible(); + const bool sendInput = m_terminal && !hasProgramRunning() && isVisible(); if (sendInput) { changeDir(url()); } diff --git a/src/panels/terminal/terminalpanel.h b/src/panels/terminal/terminalpanel.h index a6f93d767..f5d66e548 100644 --- a/src/panels/terminal/terminalpanel.h +++ b/src/panels/terminal/terminalpanel.h @@ -55,7 +55,9 @@ public: */ void goHome(); QString currentWorkingDirectory(); - bool isHiddenInVisibleWindow(); + bool isHiddenInVisibleWindow() const; + bool hasProgramRunning() const; + QString runningProgramName() const; public slots: void terminalExited(); |
