X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/37a98417cd64008b63b95b80ecbedc84d487bd25..579eadeb6ddffb03e8043090a330c6dba0717299:/src/dolphintabwidget.cpp diff --git a/src/dolphintabwidget.cpp b/src/dolphintabwidget.cpp index 04653f33c..8f78dc227 100644 --- a/src/dolphintabwidget.cpp +++ b/src/dolphintabwidget.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -204,13 +205,13 @@ void DolphinTabWidget::openDirectories(const QList& dirs, bool splitView) QList::const_iterator it = dirs.constBegin(); while (it != dirs.constEnd()) { const QUrl& primaryUrl = *(it++); - const std::optional alreadyOpenDirectory = viewOpenAtDirectory(primaryUrl); + const std::optional viewIndexAtDirectory = viewOpenAtDirectory(primaryUrl); // When the user asks for a URL that's already open, // activate it instead of opening a new tab - if (alreadyOpenDirectory.has_value()) { + if (viewIndexAtDirectory.has_value()) { somethingWasAlreadyOpen = true; - activateViewContainerAt(alreadyOpenDirectory.value()); + activateViewContainerAt(viewIndexAtDirectory.value()); } else if (splitView && (it != dirs.constEnd())) { const QUrl& secondaryUrl = *(it++); if (somethingWasAlreadyOpen) { @@ -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("&&"));