diff options
| author | ambar chakravartty <[email protected]> | 2025-01-27 16:50:13 +0530 |
|---|---|---|
| committer | Méven Car <[email protected]> | 2025-02-06 14:32:35 +0000 |
| commit | 625599462a8ec82f0e43267d333b3ed74a4401bf (patch) | |
| tree | fea1bf6d046daa53c7e96940cb23ed7d6d2a7f1f /src/dolphintabbar.cpp | |
| parent | 529df26a3f99f186ffc8848d32d6ec8f2a4b2f5c (diff) | |
Added code for a "Rename Tab" feature.
BUG: 197009
Diffstat (limited to 'src/dolphintabbar.cpp')
| -rw-r--r-- | src/dolphintabbar.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
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 <KLocalizedString> #include <QDragEnterEvent> +#include <QInputDialog> #include <QMenu> #include <QMimeData> #include <QTimer> @@ -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; |
