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.
wilder
Nathan Sprangers 5 years ago committed by Tomaz Canabrava
parent aa6193b0a8
commit 822c48c225
  1. 5
      src/ViewManager.cpp
  2. 4
      src/widgets/ViewSplitter.cpp

@ -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;
}

Loading…
Cancel
Save