diff options
| author | Ramil Nurmanov <[email protected]> | 2026-06-18 07:53:18 +0000 |
|---|---|---|
| committer | Méven Car <[email protected]> | 2026-06-18 07:53:18 +0000 |
| commit | 91e7c0c1e032b6e3e0558b8048fce6a3b68d297a (patch) | |
| tree | bddc429c3ff455e11901298c3aa65d7a2cdca130 /src/dolphintabbar.cpp | |
| parent | 784bea5c6aef1a3d86613d77f00c7843814206d9 (diff) | |
dolphintabbar: Add actions to close tabs to the left or right
CCBUG: 499717
Diffstat (limited to 'src/dolphintabbar.cpp')
| -rw-r--r-- | src/dolphintabbar.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/dolphintabbar.cpp b/src/dolphintabbar.cpp index 85cfa0788..467d0e56f 100644 --- a/src/dolphintabbar.cpp +++ b/src/dolphintabbar.cpp @@ -185,11 +185,16 @@ void DolphinTabBar::contextMenuEvent(QContextMenuEvent *event) QAction *newTabAction = menu.addAction(QIcon::fromTheme(QStringLiteral("tab-new")), i18nc("@action:inmenu", "New Tab")); QAction *detachTabAction = menu.addAction(QIcon::fromTheme(QStringLiteral("tab-detach")), i18nc("@action:inmenu", "Detach Tab")); + menu.addSeparator(); + QAction *renameTabAction = menu.addAction(QIcon::fromTheme(QStringLiteral("edit-rename")), i18nc("@action:inmenu", "Rename Tab")); + menu.addSeparator(); QAction *closeOtherTabsAction = menu.addAction(QIcon::fromTheme(QStringLiteral("tab-close-other")), i18nc("@action:inmenu", "Close Other Tabs")); + QAction *closeTabsToLeftAction = menu.addAction(QIcon::fromTheme(QStringLiteral("go-previous")), i18nc("@action:inmenu", "Close Tabs to the Left")); + closeTabsToLeftAction->setEnabled(index > 0); + QAction *closeTabsToRightAction = menu.addAction(QIcon::fromTheme(QStringLiteral("go-next")), i18nc("@action:inmenu", "Close Tabs to the Right")); + closeTabsToRightAction->setEnabled(index < count() - 1); QAction *closeTabAction = menu.addAction(QIcon::fromTheme(QStringLiteral("tab-close")), i18nc("@action:inmenu", "Close Tab")); - QAction *renameTabAction = menu.addAction(QIcon::fromTheme(QStringLiteral("edit-rename")), i18nc("@action:inmenu", "Rename Tab")); - QAction *selectedAction = menu.exec(event->globalPos()); if (selectedAction == newTabAction) { Q_EMIT openNewActivatedTab(index); @@ -203,6 +208,15 @@ void DolphinTabBar::contextMenuEvent(QContextMenuEvent *event) for (int i = index + 1; i < tabCount; i++) { Q_EMIT tabCloseRequested(1); } + } else if (selectedAction == closeTabsToLeftAction) { + for (int i = 0; i < index; i++) { + Q_EMIT tabCloseRequested(0); + } + } else if (selectedAction == closeTabsToRightAction) { + const int tabCount = count(); + for (int i = index + 1; i < tabCount; i++) { + Q_EMIT tabCloseRequested(index + 1); + } } else if (selectedAction == closeTabAction) { Q_EMIT tabCloseRequested(index); } else if (selectedAction == renameTabAction) { |
