Bug 407979

Summary: Keyboard input focus lost after closing terminal panel
Product: [Applications] dolphin Reporter: Dmitry <dmitry.a.kuzmenko>
Component: panels: terminalAssignee: Dolphin Bug Assignee <dolphin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: dmitry.a.kuzmenko, elvis.angelaccio, mail, nate
Priority: NOR Keywords: usability
Version: 19.04.1   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 19.11.80
Sentry Crash Report:

Description Dmitry 2019-05-27 06:27:36 UTC
SUMMARY
After leaving terminal with Ctrl-D or exit commands the input focus isn't set back to the folder view. So not Tab nor Arrow keys allow to navigate. You need to click to the folder view with mouse to continue work with the folder.


STEPS TO REPRODUCE
1. Open Dolphin
2. Press F4 to open the terminal panel
3. Type exit<Enter> or pres Ctrl-D

OBSERVED RESULT
Pressing Tab, arrow keys, typing file/folder name results to nothing.


EXPECTED RESULT
Focus should return to the folder view so you can navigate with arrows.


SOFTWARE/OS VERSIONS
Linux: Arch Linux
KDE Plasma Version: 5.15.5
KDE Frameworks Version: 5.58.0
Qt Version: 5.12.3

ADDITIONAL INFORMATION
Dolphin version 19.04.1 (the bug exists in previous versions)
Comment 1 Julian Steinmann 2019-05-27 07:06:09 UTC
Confirmed with Dolphin 19.04.1 on KDE Neon Stable Edition.
Comment 2 Elvis Angelaccio 2019-07-14 21:10:10 UTC

*** This bug has been marked as a duplicate of bug 298467 ***
Comment 3 Elvis Angelaccio 2019-08-11 11:19:19 UTC
(In reply to Elvis Angelaccio from comment #2)
> 
> *** This bug has been marked as a duplicate of bug 298467 ***

Actually #298467 is not exactly the same issue, as in that case we do not exit the terminal process with exit or Ctrl-D.
Comment 4 Elvis Angelaccio 2019-08-11 11:23:52 UTC
Git commit ec1a0c2543a590dd5bd49c3dfe27f77a27fcb05f by Elvis Angelaccio, on behalf of Andrey Yashkin.
Committed on 11/08/2019 at 11:14.
Pushed by elvisangelaccio into branch 'master'.

Fix an issue with focus lost after closing terminal panel

Summary:
After leaving terminal with Ctrl-D or exit commands the input focus isn't set back to the folder view.
The problem appears, because `TerminalPanel::isHiddenInVisibleWindow` returns not what it supposed to return,
since when the terminal process exits, `m_terminal` is set to nullptr.

I moved unwanted checks from it inside `TerminalPanel::dockVisibilityChanged`

This change also exposes a crash in `DolphinMainWindow::slotTerminalPanelVisibilityChanged()`,
which was previously working only by luck.
Now we check whether `m_activeViewContainer` is not null before using it.
FIXED-IN: 19.11.80

Test Plan:
1. Open Dolphin
2. Press F4 to open the terminal panel
3. Type exit<Enter> or press Ctrl-D
4. Check current focus widget

Reviewers: #dolphin

Subscribers: ngraham, elvisangelaccio, kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D22420

M  +1    -1    src/dolphinmainwindow.cpp
M  +2    -4    src/panels/terminal/terminalpanel.cpp

https://commits.kde.org/dolphin/ec1a0c2543a590dd5bd49c3dfe27f77a27fcb05f