diff options
| author | Oliver Beard <[email protected]> | 2022-10-30 17:23:19 +0000 |
|---|---|---|
| committer | Oliver Beard <[email protected]> | 2023-01-19 22:33:10 +0000 |
| commit | 86d89c3bd13a8e2ea56b065b060a614698be7176 (patch) | |
| tree | e3854f7446ef90633cfa0180d7c027e50b5737e4 /src | |
| parent | c7093861857ec02f0845d1387099457f34e58ddd (diff) | |
Use both split view names in tab names
When the tab is a split view, use the name of both views rather than only the active view.
Diffstat (limited to 'src')
| -rw-r--r-- | src/dolphintabwidget.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/dolphintabwidget.cpp b/src/dolphintabwidget.cpp index 13619a5f9..8f78dc227 100644 --- a/src/dolphintabwidget.cpp +++ b/src/dolphintabwidget.cpp @@ -15,6 +15,7 @@ #include <kio/global.h> #include <KIO/CommandLauncherJob> #include <KAcceleratorManager> +#include <KLocalizedString> #include <QApplication> #include <QDropEvent> @@ -496,7 +497,22 @@ QString DolphinTabWidget::tabName(DolphinTabPage* tabPage) const if (!tabPage) { return QString(); } - QString name = tabPage->activeViewContainer()->caption(); + + QString name; + if (tabPage->splitViewEnabled()) { + if (tabPage->primaryViewActive()) { + // i18n: %1 is the primary view and %2 the secondary view. For left to right languages the primary view is on the left so we also want it to be on the + // left in the tab name. In right to left languages the primary view would be on the right so the tab name should match. + name = i18nc("@title:tab Active primary view | (Inactive secondary view)", "%1 | (%2)", tabPage->primaryViewContainer()->caption(), tabPage->secondaryViewContainer()->caption()); + } else { + // i18n: %1 is the primary view and %2 the secondary view. For left to right languages the primary view is on the left so we also want it to be on the + // left in the tab name. In right to left languages the primary view would be on the right so the tab name should match. + name = i18nc("@title:tab (Inactive primary view) | Active secondary view", "(%1) | %2", tabPage->primaryViewContainer()->caption(), tabPage->secondaryViewContainer()->caption()); + } + } else { + name = tabPage->activeViewContainer()->caption(); + } + // Make sure that a '&' inside the directory name is displayed correctly // and not misinterpreted as a keyboard shortcut in QTabBar::setTabText() return name.replace('&', QLatin1String("&&")); |
