From 4e40fe810d324e69eeb824e40011e509e6676aaf Mon Sep 17 00:00:00 2001 From: "Adrián Chaves Fernández (Gallaecio)" Date: Thu, 18 Jan 2018 18:49:54 +0100 Subject: Set the focus to the active view, after leaving the terminal panel Summary: BUG: 298467 Set the focus to the active view, after leaving the terminal panel. This is a fork of the patch at https://git.reviewboard.kde.org/r/116118/ by @emmanuelp which should fix the issue with the original patch reported by Frank Reininghaus. Test Plan: Works for me. Reviewers: #dolphin, emmanuelp, ngraham Reviewed By: #dolphin, ngraham Subscribers: ngraham, emmanuelp Differential Revision: https://phabricator.kde.org/D9955 --- src/panels/terminal/terminalpanel.cpp | 11 +++++++++-- src/panels/terminal/terminalpanel.h | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'src/panels') diff --git a/src/panels/terminal/terminalpanel.cpp b/src/panels/terminal/terminalpanel.cpp index c205374cd..849d3f8c9 100644 --- a/src/panels/terminal/terminalpanel.cpp +++ b/src/panels/terminal/terminalpanel.cpp @@ -73,12 +73,19 @@ void TerminalPanel::terminalExited() emit hideTerminalPanel(); } +bool TerminalPanel::isHiddenInVisibleWindow() +{ + return parentWidget() + && parentWidget()->isHidden() + && m_terminal + && (m_terminal->foregroundProcessId() == -1); +} + void TerminalPanel::dockVisibilityChanged() { // Only react when the DockWidget itself (not some parent) is hidden. This way we don't // respond when e.g. Dolphin is minimized. - if (parentWidget() && parentWidget()->isHidden() && - m_terminal && (m_terminal->foregroundProcessId() == -1)) { + if (isHiddenInVisibleWindow()) { // Make sure that the following "cd /" command will not affect the view. disconnect(m_konsolePart, SIGNAL(currentDirectoryChanged(QString)), this, SLOT(slotKonsolePartCurrentDirectoryChanged(QString))); diff --git a/src/panels/terminal/terminalpanel.h b/src/panels/terminal/terminalpanel.h index 4c0b93a17..edaa2a6f3 100644 --- a/src/panels/terminal/terminalpanel.h +++ b/src/panels/terminal/terminalpanel.h @@ -54,6 +54,7 @@ public: */ void goHome(); QString currentWorkingDirectory(); + bool isHiddenInVisibleWindow(); public slots: void terminalExited(); -- cgit v1.3