Commit 29977a23 authored by Nathan Sprangers's avatar Nathan Sprangers Committed by Tomaz Canabrava
Browse files

Disconnect view/session after drag-and-drop

Adds a missing signal/slot connection for when a split-view is drag-and-
dropped to a new window. Use an existing method to handle it the same
way as drag-and-dropping or detaching a tab.

BUG: 442238
parent 2ab70959
Pipeline #97865 passed with stage
in 1 minute and 51 seconds
......@@ -640,11 +640,7 @@ SessionController *ViewManager::createController(Session *session, TerminalDispl
connect(session, &Konsole::Session::primaryScreenInUse, controller, &Konsole::SessionController::setupPrimaryScreenSpecificActions);
connect(session, &Konsole::Session::selectionChanged, controller, &Konsole::SessionController::selectionChanged);
connect(view, &Konsole::TerminalDisplay::destroyed, controller, &Konsole::SessionController::deleteLater);
// The controller is destroyed when the (split) view is drag-dropped to a different window
connect(controller, &QObject::destroyed, this, [this] {
connect(controller, &Konsole::SessionController::viewDragAndDropped, this, &Konsole::ViewManager::forgetController);
// if this is the first controller created then set it as the active controller
if (_pluggedController.isNull()) {
......@@ -654,9 +650,20 @@ SessionController *ViewManager::createController(Session *session, TerminalDispl
return controller;
void ViewManager::forgetController()
auto controller = static_cast<SessionController *>(sender());
Q_ASSERT(controller->session() != nullptr && controller->view() != nullptr);
// should this be handed by ViewManager::unplugController signal
void ViewManager::removeController(SessionController *controller)
Q_EMIT unplugController(controller);
if (_pluggedController == controller) {
......@@ -386,6 +386,13 @@ private Q_SLOTS:
// called when a SessionController gains focus
void controllerChanged(SessionController *controller);
* Disconnect this ViewManager and MainWindow from SessionController
* sender() and its associated view/session pair such as after a
* split-view has been drag-and-dropped to a new window.
void forgetController();
/* Detaches the tab at index tabIdx */
void detachTab(int tabIdx);
......@@ -173,6 +173,11 @@ Q_SIGNALS:
void requestPrint();
* Emitted when the TerminalDisplay is drag-and-dropped to a new window.
void viewDragAndDropped();
public Q_SLOTS:
* Issues a command to the session to navigate to the specified URL.
......@@ -258,7 +258,7 @@ void TabbedViewContainer::terminalDisplayDropped(TerminalDisplay *terminalDispla
// Terminal from another window - recreate SessionController for current ViewManager
Session *terminalSession = terminalDisplay->sessionController()->session();
Q_EMIT terminalDisplay->sessionController()->viewDragAndDropped();
connectedViewManager()->attachView(terminalDisplay, terminalSession);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment