]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/panels/terminal/terminalpanel.cpp
Set the focus to the active view, after leaving the terminal panel
[dolphin.git] / src / panels / terminal / terminalpanel.cpp
index c205374cdc87e7437cf159543c8d6f2c38dfcfa0..849d3f8c903965f6e62e5dfd138c76bb1726abca 100644 (file)
@@ -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)));