diff --git a/src/ViewContainer.h b/src/ViewContainer.h --- a/src/ViewContainer.h +++ b/src/ViewContainer.h @@ -151,6 +151,8 @@ void connectTerminalDisplay(TerminalDisplay *view); void disconnectTerminalDisplay(TerminalDisplay *view); + void moveTabLeft(); + void moveTabRight(); Q_SIGNALS: /** Emitted when the container has no more children */ @@ -186,6 +188,7 @@ /** detach the specific tab */ void detachTab(int tabIdx); + protected: // close tabs and unregister void closeTerminalTab(int idx); diff --git a/src/ViewContainer.cpp b/src/ViewContainer.cpp --- a/src/ViewContainer.cpp +++ b/src/ViewContainer.cpp @@ -574,3 +574,19 @@ { activeViewSplitter()->restoreOtherTerminals(); } + +void TabbedViewContainer::moveTabLeft() +{ + if (currentIndex() == 0) { + return; + } + tabBar()->moveTab(currentIndex(), currentIndex() -1); +} + +void TabbedViewContainer::moveTabRight() +{ + if (currentIndex() == count() -1) { + return; + } + tabBar()->moveTab(currentIndex(), currentIndex() + 1); +} \ No newline at end of file diff --git a/src/ViewManager.cpp b/src/ViewManager.cpp --- a/src/ViewManager.cpp +++ b/src/ViewManager.cpp @@ -111,7 +111,6 @@ } KActionCollection *collection = _actionCollection; - // Let's reuse the pointer, no need not to. auto *action = new QAction(this); action->setIcon(QIcon::fromTheme(QStringLiteral("view-split-left-right"))); @@ -185,26 +184,26 @@ _multiTabOnlyActions << action; // _viewSplitter->addAction(previousViewAction); - action = new QAction(i18nc("@action Shortcut entry", "Next View Container"), this); + action = new QAction(i18nc("@action Shortcut entry", "Focus Above Terminal"), this); connect(action, &QAction::triggered, this, &ViewManager::focusUp); collection->addAction(QStringLiteral("next-container"), action); collection->setDefaultShortcut(action, Qt::SHIFT + Qt::CTRL + Qt::Key_Up); _viewContainer->addAction(action); _multiSplitterOnlyActions << action; - action = new QAction(QStringLiteral("Focus Down"), this); + action = new QAction(i18nc("@action Shortcut entry", "Focus Below Terminal"), this); collection->setDefaultShortcut(action, Qt::SHIFT + Qt::CTRL + Qt::Key_Down); connect(action, &QAction::triggered, this, &ViewManager::focusDown); _multiSplitterOnlyActions << action; _viewContainer->addAction(action); - action = new QAction(i18nc("@action Shortcut entry", "Move Tab Left"), this); + action = new QAction(i18nc("@action Shortcut entry", "Focus Left Terminal"), this); collection->setDefaultShortcut(action, Konsole::ACCEL + Qt::SHIFT + Konsole::LEFT); connect(action, &QAction::triggered, this, &ViewManager::focusLeft); collection->addAction(QStringLiteral("move-view-left"), action); _multiSplitterOnlyActions << action; - action = new QAction(i18nc("@action Shortcut entry", "Move Tab Right"), this); + action = new QAction(i18nc("@action Shortcut entry", "Move Right Terminal"), this); collection->setDefaultShortcut(action, Konsole::ACCEL + Qt::SHIFT + Konsole::RIGHT); connect(action, &QAction::triggered, this, &ViewManager::focusRight); collection->addAction(QStringLiteral("move-view-right"), action); @@ -246,6 +245,20 @@ _multiSplitterOnlyActions << action; _viewContainer->addAction(action); + action = new QAction(i18nc("@action Shortcut entry", "Move tab to the right"), this); + collection->addAction(QStringLiteral("restore-other-terminals"), action); + collection->setDefaultShortcut(action, Qt::CTRL + Qt::ALT + Qt::Key_Right); + connect(action, &QAction::triggered, _viewContainer, &TabbedViewContainer::moveTabRight); + _multiTabOnlyActions << action; + _viewContainer->addAction(action); + + action = new QAction(i18nc("@action Shortcut entry", "Move tab to the left"), this); + collection->addAction(QStringLiteral("restore-other-terminals"), action); + collection->setDefaultShortcut(action, Qt::CTRL + Qt::ALT + Qt::Key_Left); + connect(action, &QAction::triggered, _viewContainer, &TabbedViewContainer::moveTabLeft); + _multiTabOnlyActions << action; + _viewContainer->addAction(action); + // _viewSplitter->addAction(lastUsedViewReverseAction); const int SWITCH_TO_TAB_COUNT = 19; for (int i = 0; i < SWITCH_TO_TAB_COUNT; i++) { diff --git a/src/ViewSplitter.cpp b/src/ViewSplitter.cpp --- a/src/ViewSplitter.cpp +++ b/src/ViewSplitter.cpp @@ -147,7 +147,6 @@ const auto newPoint = QPoint(newX, newY); auto child = topSplitter->childAt(newPoint); - qDebug() << "Handling focus"; if (TerminalDisplay* terminal = qobject_cast(child)) { terminal->setFocus(Qt::OtherFocusReason); } else if (qobject_cast(child)) {