From d3fa26f65bae04084c9681fcdfbb2ffa5bc818a2 Mon Sep 17 00:00:00 2001 From: Magno Lomardo Date: Mon, 6 Mar 2023 22:41:41 +0000 Subject: [PATCH] Add the context menu options to split the view left-right and top-bottom FEATURE: 415724 --- desktop/sessionui.rc | 7 ++++++- src/ViewManager.cpp | 2 ++ src/session/SessionController.cpp | 8 ++++++++ src/session/SessionController.h | 7 +++++++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/desktop/sessionui.rc b/desktop/sessionui.rc index 926d0e03b..2b239f1b8 100644 --- a/desktop/sessionui.rc +++ b/desktop/sessionui.rc @@ -1,7 +1,7 @@ - + @@ -57,6 +57,11 @@ + Split View + + + + diff --git a/src/ViewManager.cpp b/src/ViewManager.cpp index 17ffb6050..1637ba43f 100644 --- a/src/ViewManager.cpp +++ b/src/ViewManager.cpp @@ -820,6 +820,8 @@ SessionController *ViewManager::createController(Session *session, TerminalDispl connect(session, &Konsole::Session::selectionChanged, controller, &Konsole::SessionController::selectionChanged); connect(view, &Konsole::TerminalDisplay::destroyed, controller, &Konsole::SessionController::deleteLater); connect(controller, &Konsole::SessionController::viewDragAndDropped, this, &Konsole::ViewManager::forgetController); + connect(controller, &Konsole::SessionController::requestSplitViewLeftRight, this, &Konsole::ViewManager::splitLeftRight); + connect(controller, &Konsole::SessionController::requestSplitViewTopBotton, this, &Konsole::ViewManager::splitTopBottom); // if this is the first controller created then set it as the active controller if (_pluggedController.isNull()) { diff --git a/src/session/SessionController.cpp b/src/session/SessionController.cpp index 93d806057..84d23b5a5 100644 --- a/src/session/SessionController.cpp +++ b/src/session/SessionController.cpp @@ -672,6 +672,14 @@ void SessionController::setupCommonActions() action->setVisible(false); connect(action, &QAction::triggered, this, &SessionController::copy); + action = collection->addAction(QStringLiteral("split-view-left-right")); + action->setText(i18n("Split View Left-Right")); + connect(action, &QAction::triggered, this, &SessionController::requestSplitViewLeftRight); + + action = collection->addAction(QStringLiteral("split-view-top-bottom")); + action->setText(i18n("Split View Top-Bottom")); + connect(action, &QAction::triggered, this, &SessionController::requestSplitViewTopBotton); + action = collection->addAction(QStringLiteral("edit_copy_contextmenu_in_out")); action->setText(i18n("Copy except prompts")); action->setIcon(QIcon::fromTheme(QStringLiteral("edit-copy"))); diff --git a/src/session/SessionController.h b/src/session/SessionController.h index 39473bc12..6e78f8c2a 100644 --- a/src/session/SessionController.h +++ b/src/session/SessionController.h @@ -157,6 +157,13 @@ Q_SIGNALS: void rawTitleChanged(); + /* + * Emitted when the user requests to split the view from the context menu. + */ + + void requestSplitViewLeftRight(); + void requestSplitViewTopBotton(); + /** * Emitted when the current working directory of the session associated with * the controller is changed.