diff --git a/src/ViewContainer.h b/src/ViewContainer.h --- a/src/ViewContainer.h +++ b/src/ViewContainer.h @@ -148,6 +148,8 @@ void connectTerminalDisplay(TerminalDisplay *view); void disconnectTerminalDisplay(TerminalDisplay *view); + void moveTabLeft(); + void moveTabRight(); Q_SIGNALS: /** Emitted when the container has no more children */ diff --git a/src/ViewContainer.cpp b/src/ViewContainer.cpp --- a/src/ViewContainer.cpp +++ b/src/ViewContainer.cpp @@ -563,3 +563,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"))); @@ -182,29 +181,30 @@ _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->addAction(QStringLiteral("focus-view-above"), 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); + collection->addAction(QStringLiteral("focus-view-below"), action); 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); + collection->addAction(QStringLiteral("focus-view-left"), action); _multiSplitterOnlyActions << action; - action = new QAction(i18nc("@action Shortcut entry", "Move Tab Right"), this); + action = new QAction(i18nc("@action Shortcut entry", "Focus 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); + collection->addAction(QStringLiteral("focus-view-right"), action); _multiSplitterOnlyActions << action; action = new QAction(i18nc("@action Shortcut entry", "Switch to Last Tab"), this); @@ -243,6 +243,20 @@ _multiSplitterOnlyActions << action; _viewContainer->addAction(action); + action = new QAction(i18nc("@action Shortcut entry", "Move tab to the right"), this); + collection->addAction(QStringLiteral("move-tab-to-right"), 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("move-tab-to-left"), 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 @@ -148,7 +148,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)) {