From 625599462a8ec82f0e43267d333b3ed74a4401bf Mon Sep 17 00:00:00 2001 From: ambar chakravartty Date: Mon, 27 Jan 2025 16:50:13 +0530 Subject: Added code for a "Rename Tab" feature. BUG: 197009 --- src/dolphintabbar.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/dolphintabbar.cpp') diff --git a/src/dolphintabbar.cpp b/src/dolphintabbar.cpp index f6af9932d..b942c4fd3 100644 --- a/src/dolphintabbar.cpp +++ b/src/dolphintabbar.cpp @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -157,6 +158,8 @@ void DolphinTabBar::contextMenuEvent(QContextMenuEvent *event) QAction *closeOtherTabsAction = menu.addAction(QIcon::fromTheme(QStringLiteral("tab-close-other")), i18nc("@action:inmenu", "Close Other Tabs")); 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); @@ -172,6 +175,13 @@ void DolphinTabBar::contextMenuEvent(QContextMenuEvent *event) } } else if (selectedAction == closeTabAction) { Q_EMIT tabCloseRequested(index); + } else if (selectedAction == renameTabAction) { + bool renamed = false; + const QString tabNewName = QInputDialog::getText(this, i18n("Rename Tab"), i18n("New tab name:"), QLineEdit::Normal, tabText(index), &renamed); + + if (renamed) { + Q_EMIT tabRenamed(index, tabNewName); + } } return; -- cgit v1.3