Commit 822c48c2 authored by Nathan Sprangers's avatar Nathan Sprangers Committed by Tomaz Canabrava
Browse files

Enable/Disable "detach-view" correctly after DnD

Enables detach-view in the target window if dropping creates the first split.

Disables in the original window if one view is left after DnD.
parent aa6193b0
......@@ -642,6 +642,11 @@ SessionController *ViewManager::createController(Session *session, TerminalDispl
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] {
toggleActionsBasedOnState();
});
// if this is the first controller created then set it as the active controller
if (_pluggedController.isNull()) {
controllerChanged(controller);
......
......@@ -378,10 +378,12 @@ void Konsole::ViewSplitter::dropEvent(QDropEvent *ev)
Qt::Orientation orientation = droppedEdge == Qt::LeftEdge || droppedEdge == Qt::RightEdge ? Qt::Horizontal : Qt::Vertical;
// Add the display so it can be counted correctly by ViewManager
addTerminalDisplay(source, orientation, behavior);
// topLevel is the splitter that's connected with the ViewManager
// that in turn can call the SessionController.
Q_EMIT getToplevelSplitter()->terminalDisplayDropped(source);
addTerminalDisplay(source, orientation, behavior);
source->setVisible(true);
currentDragTarget = nullptr;
}
......
Markdown is supported
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