┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphinmainwindow.cpp
diff options
context:
space:
mode:
authorNate Graham <[email protected]>2019-03-20 23:06:28 +0100
committerNate Graham <[email protected]>2019-12-05 15:53:19 -0700
commit69838a1cdd6a10d9d6ca6572962c438a97d46b36 (patch)
tree83b3d3f5347faf92e52ed5770108055df6b3bc9e /src/dolphinmainwindow.cpp
parent8b0c12a59ccb23fdb6393f640693d21afaeb02a1 (diff)
Add action for focusing Terminal Panel
Summary: Add an action for focusing and de-focusing the Terminal Panel. FEATURE: 185096 FIXED-IN 20.04.0 Test Plan: - Hit {key Ctrl Shift F4} or click {nav Tools > Focus Terminal Panel} or {nav Control > Tools > Focus Terminal Panel} - If the Terminal Panel was closed, it opens and gains focus - If the Terminal Panel was open but unfocused, it gains focus - If the Terminal Panel was open and focused, focus returns to the view {F6630289, size=full} Reviewers: #dolphin, elvisangelaccio, rominf Reviewed By: #dolphin, elvisangelaccio, rominf Subscribers: kfm-devel, elvisangelaccio, rkflx, ngraham, #dolphin Tags: #dolphin Differential Revision: https://phabricator.kde.org/D10959
Diffstat (limited to 'src/dolphinmainwindow.cpp')
-rw-r--r--src/dolphinmainwindow.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp
index 54cd1f0ef..30c903bb5 100644
--- a/src/dolphinmainwindow.cpp
+++ b/src/dolphinmainwindow.cpp
@@ -1554,6 +1554,12 @@ void DolphinMainWindow::setupActions()
openTerminal->setIcon(QIcon::fromTheme(QStringLiteral("dialog-scripts")));
actionCollection()->setDefaultShortcut(openTerminal, Qt::SHIFT + Qt::Key_F4);
connect(openTerminal, &QAction::triggered, this, &DolphinMainWindow::openTerminal);
+
+ QAction* focusTerminalPanel = actionCollection()->addAction(QStringLiteral("focus_terminal_panel"));
+ focusTerminalPanel->setText(i18nc("@action:inmenu Tools", "Focus Terminal Panel"));
+ focusTerminalPanel->setIcon(QIcon::fromTheme(QStringLiteral("swap-panels")));
+ actionCollection()->setDefaultShortcut(focusTerminalPanel, Qt::CTRL + Qt::SHIFT + Qt::Key_F4);
+ connect(focusTerminalPanel, &QAction::triggered, this, &DolphinMainWindow::focusTerminalPanel);
}
#endif
@@ -2305,6 +2311,22 @@ bool DolphinMainWindow::eventFilter(QObject* obj, QEvent* event)
return false;
}
+void DolphinMainWindow::focusTerminalPanel()
+{
+ if (m_terminalPanel->isVisible()) {
+ if (m_terminalPanel->terminalHasFocus()) {
+ m_activeViewContainer->view()->setFocus(Qt::FocusReason::ShortcutFocusReason);
+ actionCollection()->action(QStringLiteral("focus_terminal_panel"))->setText(i18nc("@action:inmenu Tools", "Focus Terminal Panel"));
+ } else {
+ m_terminalPanel->setFocus(Qt::FocusReason::ShortcutFocusReason);
+ actionCollection()->action(QStringLiteral("focus_terminal_panel"))->setText(i18nc("@action:inmenu Tools", "Defocus Terminal Panel"));
+ }
+ } else {
+ actionCollection()->action(QStringLiteral("show_terminal_panel"))->trigger();
+ actionCollection()->action(QStringLiteral("focus_terminal_panel"))->setText(i18nc("@action:inmenu Tools", "Defocus Terminal Panel"));
+ }
+}
+
DolphinMainWindow::UndoUiInterface::UndoUiInterface() :
KIO::FileUndoManager::UiInterface()
{