mirror of
https://invent.kde.org/system/dolphin
synced 2024-10-28 03:21:56 +00:00
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
This commit is contained in:
parent
1a6b3c0a2b
commit
4e40fe810d
|
@ -629,6 +629,13 @@ void DolphinMainWindow::togglePanelLockState()
|
||||||
GeneralSettings::setLockPanels(newLockState);
|
GeneralSettings::setLockPanels(newLockState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DolphinMainWindow::slotTerminalPanelVisibilityChanged()
|
||||||
|
{
|
||||||
|
if (m_terminalPanel->isHiddenInVisibleWindow()) {
|
||||||
|
m_activeViewContainer->view()->setFocus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DolphinMainWindow::goBack()
|
void DolphinMainWindow::goBack()
|
||||||
{
|
{
|
||||||
KUrlNavigator* urlNavigator = m_activeViewContainer->urlNavigator();
|
KUrlNavigator* urlNavigator = m_activeViewContainer->urlNavigator();
|
||||||
|
@ -1297,6 +1304,8 @@ void DolphinMainWindow::setupDockWidgets()
|
||||||
connect(m_terminalPanel, &TerminalPanel::changeUrl, this, &DolphinMainWindow::slotTerminalDirectoryChanged);
|
connect(m_terminalPanel, &TerminalPanel::changeUrl, this, &DolphinMainWindow::slotTerminalDirectoryChanged);
|
||||||
connect(terminalDock, &DolphinDockWidget::visibilityChanged,
|
connect(terminalDock, &DolphinDockWidget::visibilityChanged,
|
||||||
m_terminalPanel, &TerminalPanel::dockVisibilityChanged);
|
m_terminalPanel, &TerminalPanel::dockVisibilityChanged);
|
||||||
|
connect(terminalDock, &DolphinDockWidget::visibilityChanged,
|
||||||
|
this, &DolphinMainWindow::slotTerminalPanelVisibilityChanged);
|
||||||
|
|
||||||
QAction* terminalAction = terminalDock->toggleViewAction();
|
QAction* terminalAction = terminalDock->toggleViewAction();
|
||||||
createPanelAction(QIcon::fromTheme(QStringLiteral("utilities-terminal")), Qt::Key_F4, terminalAction, QStringLiteral("show_terminal_panel"));
|
createPanelAction(QIcon::fromTheme(QStringLiteral("utilities-terminal")), Qt::Key_F4, terminalAction, QStringLiteral("show_terminal_panel"));
|
||||||
|
|
|
@ -261,6 +261,12 @@ private slots:
|
||||||
*/
|
*/
|
||||||
void togglePanelLockState();
|
void togglePanelLockState();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is invoked if the Terminal panel got visible/invisible and takes care
|
||||||
|
* that the active view has the focus if the Terminal panel is invisible.
|
||||||
|
*/
|
||||||
|
void slotTerminalPanelVisibilityChanged();
|
||||||
|
|
||||||
/** Goes back one step of the URL history. */
|
/** Goes back one step of the URL history. */
|
||||||
void goBack();
|
void goBack();
|
||||||
|
|
||||||
|
|
|
@ -73,12 +73,19 @@ void TerminalPanel::terminalExited()
|
||||||
emit hideTerminalPanel();
|
emit hideTerminalPanel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TerminalPanel::isHiddenInVisibleWindow()
|
||||||
|
{
|
||||||
|
return parentWidget()
|
||||||
|
&& parentWidget()->isHidden()
|
||||||
|
&& m_terminal
|
||||||
|
&& (m_terminal->foregroundProcessId() == -1);
|
||||||
|
}
|
||||||
|
|
||||||
void TerminalPanel::dockVisibilityChanged()
|
void TerminalPanel::dockVisibilityChanged()
|
||||||
{
|
{
|
||||||
// Only react when the DockWidget itself (not some parent) is hidden. This way we don't
|
// Only react when the DockWidget itself (not some parent) is hidden. This way we don't
|
||||||
// respond when e.g. Dolphin is minimized.
|
// respond when e.g. Dolphin is minimized.
|
||||||
if (parentWidget() && parentWidget()->isHidden() &&
|
if (isHiddenInVisibleWindow()) {
|
||||||
m_terminal && (m_terminal->foregroundProcessId() == -1)) {
|
|
||||||
// Make sure that the following "cd /" command will not affect the view.
|
// Make sure that the following "cd /" command will not affect the view.
|
||||||
disconnect(m_konsolePart, SIGNAL(currentDirectoryChanged(QString)),
|
disconnect(m_konsolePart, SIGNAL(currentDirectoryChanged(QString)),
|
||||||
this, SLOT(slotKonsolePartCurrentDirectoryChanged(QString)));
|
this, SLOT(slotKonsolePartCurrentDirectoryChanged(QString)));
|
||||||
|
|
|
@ -54,6 +54,7 @@ public:
|
||||||
*/
|
*/
|
||||||
void goHome();
|
void goHome();
|
||||||
QString currentWorkingDirectory();
|
QString currentWorkingDirectory();
|
||||||
|
bool isHiddenInVisibleWindow();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void terminalExited();
|
void terminalExited();
|
||||||
|
|
Loading…
Reference in a new issue