- const KUrl& primaryUrl = *(it++);
- if (hasSplitView && (it != dirs.constEnd())) {
- const KUrl& secondaryUrl = *(it++);
- openNewTab(primaryUrl, secondaryUrl);
+ const QUrl& primaryUrl = *(it++);
+ const QPair<int, bool> indexInfo = indexByUrl(primaryUrl);
+ const int index = indexInfo.first;
+ const bool isInPrimaryView = indexInfo.second;
+ if (index >= 0) {
+ setCurrentIndex(index);
+ const auto tabPage = tabPageAt(index);
+ if (isInPrimaryView) {
+ tabPage->primaryViewContainer()->setActive(true);
+ } else {
+ tabPage->secondaryViewContainer()->setActive(true);
+ }
+ // BUG: 147230
+ // Required for updateViewState() call in openFiles() to work as expected
+ // If there is a selection, updateViewState() calls are effectively a no-op
+ tabPage->activeViewContainer()->view()->clearSelection();
+ continue;
+ }
+ if (splitView && (it != dirs.constEnd())) {
+ const QUrl& secondaryUrl = *(it++);
+ openNewActivatedTab(primaryUrl, secondaryUrl);