]> cloud.milkyroute.net Git - dolphin.git/blob - src/dolphintabwidget.cpp
DolphinViewContainer: set searchPath on redirect, check for connected urlNavigator
[dolphin.git] / src / dolphintabwidget.cpp
1 /*
2 * SPDX-FileCopyrightText: 2014 Emmanuel Pescosta <emmanuelpescosta099@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7 #include "dolphintabwidget.h"
8
9 #include "dolphin_generalsettings.h"
10 #include "dolphintabbar.h"
11 #include "dolphinviewcontainer.h"
12 #include "views/draganddrophelper.h"
13
14 #include <KAcceleratorManager>
15 #include <KConfigGroup>
16 #include <KIO/CommandLauncherJob>
17 #include <KLocalizedString>
18 #include <KShell>
19 #include <KStringHandler>
20 #include <kio/global.h>
21
22 #include <QApplication>
23 #include <QDropEvent>
24 #include <QStackedWidget>
25
26 DolphinTabWidget::DolphinTabWidget(DolphinNavigatorsWidgetAction *navigatorsWidget, QWidget *parent)
27 : QTabWidget(parent)
28 , m_lastViewedTab(nullptr)
29 , m_navigatorsWidget{navigatorsWidget}
30 {
31 KAcceleratorManager::setNoAccel(this);
32
33 connect(this, &DolphinTabWidget::tabCloseRequested, this, QOverload<int>::of(&DolphinTabWidget::closeTab));
34 connect(this, &DolphinTabWidget::currentChanged, this, &DolphinTabWidget::currentTabChanged);
35
36 DolphinTabBar *tabBar = new DolphinTabBar(this);
37 connect(tabBar, &DolphinTabBar::openNewActivatedTab, this, QOverload<int>::of(&DolphinTabWidget::openNewActivatedTab));
38 connect(tabBar, &DolphinTabBar::tabDragMoveEvent, this, &DolphinTabWidget::tabDragMoveEvent);
39 connect(tabBar, &DolphinTabBar::tabDropEvent, this, &DolphinTabWidget::tabDropEvent);
40 connect(tabBar, &DolphinTabBar::tabDetachRequested, this, &DolphinTabWidget::detachTab);
41
42 setTabBar(tabBar);
43 setDocumentMode(true);
44 setElideMode(Qt::ElideRight);
45 setUsesScrollButtons(true);
46 setTabBarAutoHide(true);
47
48 auto stackWidget{findChild<QStackedWidget *>()};
49 // i18n: This accessible name will be announced any time the user moves keyboard focus e.g. from the toolbar or the places panel towards the main working
50 // area of Dolphin. It gives structure. This container does not only contain the main view but also the status bar, the search panel, filter, and selection
51 // mode bars, so calling it just a "View" is a bit wrong, but hopefully still gets the point across.
52 stackWidget->setAccessibleName(i18nc("accessible name of Dolphin's view container", "Location View")); // Without this call, the non-descript Qt provided
53 // "Layered Pane" role is announced.
54 }
55
56 DolphinTabPage *DolphinTabWidget::currentTabPage() const
57 {
58 return tabPageAt(currentIndex());
59 }
60
61 DolphinTabPage *DolphinTabWidget::nextTabPage() const
62 {
63 const int index = currentIndex() + 1;
64 return tabPageAt(index < count() ? index : 0);
65 }
66
67 DolphinTabPage *DolphinTabWidget::prevTabPage() const
68 {
69 const int index = currentIndex() - 1;
70 return tabPageAt(index >= 0 ? index : (count() - 1));
71 }
72
73 DolphinTabPage *DolphinTabWidget::tabPageAt(const int index) const
74 {
75 return static_cast<DolphinTabPage *>(widget(index));
76 }
77
78 void DolphinTabWidget::saveProperties(KConfigGroup &group) const
79 {
80 const int tabCount = count();
81 group.writeEntry("Tab Count", tabCount);
82 group.writeEntry("Active Tab Index", currentIndex());
83
84 for (int i = 0; i < tabCount; ++i) {
85 const DolphinTabPage *tabPage = tabPageAt(i);
86 group.writeEntry("Tab Data " % QString::number(i), tabPage->saveState());
87 }
88 }
89
90 void DolphinTabWidget::readProperties(const KConfigGroup &group)
91 {
92 const int tabCount = group.readEntry("Tab Count", 0);
93 for (int i = 0; i < tabCount; ++i) {
94 if (i >= count()) {
95 openNewActivatedTab();
96 }
97 const QByteArray state = group.readEntry("Tab Data " % QString::number(i), QByteArray());
98 tabPageAt(i)->restoreState(state);
99 }
100
101 const int index = group.readEntry("Active Tab Index", 0);
102 setCurrentIndex(index);
103 }
104
105 void DolphinTabWidget::refreshViews()
106 {
107 // Left-elision is better when showing full paths, since you care most
108 // about the current directory which is on the right
109 if (GeneralSettings::showFullPathInTitlebar()) {
110 setElideMode(Qt::ElideLeft);
111 } else {
112 setElideMode(Qt::ElideRight);
113 }
114
115 const int tabCount = count();
116 for (int i = 0; i < tabCount; ++i) {
117 updateTabName(i);
118 tabPageAt(i)->refreshViews();
119 }
120 }
121
122 void DolphinTabWidget::updateTabName(int index)
123 {
124 Q_ASSERT(index >= 0);
125 tabBar()->setTabText(index, tabName(tabPageAt(index)));
126 }
127
128 bool DolphinTabWidget::isUrlOpen(const QUrl &url) const
129 {
130 return viewOpenAtDirectory(url).has_value();
131 }
132
133 bool DolphinTabWidget::isItemVisibleInAnyView(const QUrl &urlOfItem) const
134 {
135 return viewShowingItem(urlOfItem).has_value();
136 }
137
138 void DolphinTabWidget::openNewActivatedTab()
139 {
140 std::unique_ptr<DolphinUrlNavigator::VisualState> oldNavigatorState;
141 if (currentTabPage()->primaryViewActive() || !m_navigatorsWidget->secondaryUrlNavigator()) {
142 oldNavigatorState = m_navigatorsWidget->primaryUrlNavigator()->visualState();
143 } else {
144 oldNavigatorState = m_navigatorsWidget->secondaryUrlNavigator()->visualState();
145 }
146
147 const DolphinViewContainer *oldActiveViewContainer = currentTabPage()->activeViewContainer();
148 Q_ASSERT(oldActiveViewContainer);
149
150 openNewActivatedTab(oldActiveViewContainer->url());
151
152 DolphinViewContainer *newActiveViewContainer = currentTabPage()->activeViewContainer();
153 Q_ASSERT(newActiveViewContainer);
154
155 // The URL navigator of the new tab should have the same editable state
156 // as the current tab
157 newActiveViewContainer->urlNavigator()->setVisualState(*oldNavigatorState.get());
158
159 // Always focus the new tab's view
160 newActiveViewContainer->view()->setFocus();
161 }
162
163 void DolphinTabWidget::openNewActivatedTab(const QUrl &primaryUrl, const QUrl &secondaryUrl)
164 {
165 openNewTab(primaryUrl, secondaryUrl);
166 if (GeneralSettings::openNewTabAfterLastTab()) {
167 setCurrentIndex(count() - 1);
168 } else {
169 setCurrentIndex(currentIndex() + 1);
170 }
171 }
172
173 void DolphinTabWidget::openNewTab(const QUrl &primaryUrl, const QUrl &secondaryUrl, DolphinTabWidget::NewTabPosition position)
174 {
175 QWidget *focusWidget = QApplication::focusWidget();
176
177 DolphinTabPage *tabPage = new DolphinTabPage(primaryUrl, secondaryUrl, this);
178 tabPage->setActive(false);
179 connect(tabPage, &DolphinTabPage::activeViewChanged, this, &DolphinTabWidget::activeViewChanged);
180 connect(tabPage, &DolphinTabPage::activeViewUrlChanged, this, &DolphinTabWidget::tabUrlChanged);
181 connect(tabPage->activeViewContainer(), &DolphinViewContainer::captionChanged, this, [this, tabPage]() {
182 updateTabName(indexOf(tabPage));
183 });
184
185 if (position == NewTabPosition::FollowSetting) {
186 if (GeneralSettings::openNewTabAfterLastTab()) {
187 position = NewTabPosition::AtEnd;
188 } else {
189 position = NewTabPosition::AfterCurrent;
190 }
191 }
192
193 int newTabIndex = -1;
194 if (position == NewTabPosition::AfterCurrent || (position == NewTabPosition::FollowSetting && !GeneralSettings::openNewTabAfterLastTab())) {
195 newTabIndex = currentIndex() + 1;
196 }
197
198 insertTab(newTabIndex, tabPage, QIcon() /* loaded in tabInserted */, tabName(tabPage));
199
200 if (focusWidget) {
201 // The DolphinViewContainer grabbed the keyboard focus. As the tab is opened
202 // in background, assure that the previous focused widget gets the focus back.
203 focusWidget->setFocus();
204 }
205 }
206
207 void DolphinTabWidget::openDirectories(const QList<QUrl> &dirs, bool splitView)
208 {
209 Q_ASSERT(dirs.size() > 0);
210
211 bool somethingWasAlreadyOpen = false;
212
213 QList<QUrl>::const_iterator it = dirs.constBegin();
214 while (it != dirs.constEnd()) {
215 const QUrl &primaryUrl = *(it++);
216 const std::optional<ViewIndex> viewIndexAtDirectory = viewOpenAtDirectory(primaryUrl);
217
218 // When the user asks for a URL that's already open,
219 // activate it instead of opening a new tab
220 if (viewIndexAtDirectory.has_value()) {
221 somethingWasAlreadyOpen = true;
222 activateViewContainerAt(viewIndexAtDirectory.value());
223 } else if (splitView && (it != dirs.constEnd())) {
224 const QUrl &secondaryUrl = *(it++);
225 if (somethingWasAlreadyOpen) {
226 openNewTab(primaryUrl, secondaryUrl);
227 } else {
228 openNewActivatedTab(primaryUrl, secondaryUrl);
229 }
230 } else {
231 if (somethingWasAlreadyOpen) {
232 openNewTab(primaryUrl);
233 } else {
234 openNewActivatedTab(primaryUrl);
235 }
236 }
237 }
238 }
239
240 void DolphinTabWidget::openFiles(const QList<QUrl> &files, bool splitView)
241 {
242 Q_ASSERT(files.size() > 0);
243
244 // Get all distinct directories from 'files'.
245 QList<QUrl> dirsThatNeedToBeOpened;
246 QList<QUrl> dirsThatWereAlreadyOpen;
247 for (const QUrl &file : files) {
248 const QUrl dir(file.adjusted(QUrl::RemoveFilename | QUrl::StripTrailingSlash));
249 if (dirsThatNeedToBeOpened.contains(dir) || dirsThatWereAlreadyOpen.contains(dir)) {
250 continue;
251 }
252
253 // The selecting of files that we do later will not work in views that already have items selected.
254 // So we check if dir is already open and clear the selection if it is. BUG: 417230
255 // We also make sure the view will be activated.
256 auto viewIndex = viewShowingItem(file);
257 if (viewIndex.has_value()) {
258 viewContainerAt(viewIndex.value())->view()->clearSelection();
259 activateViewContainerAt(viewIndex.value());
260 dirsThatWereAlreadyOpen.append(dir);
261 } else {
262 dirsThatNeedToBeOpened.append(dir);
263 }
264 }
265
266 const int oldTabCount = count();
267 // Open a tab for each directory. If the "split view" option is enabled,
268 // two directories are shown inside one tab (see openDirectories()).
269 if (dirsThatNeedToBeOpened.size() > 0) {
270 openDirectories(dirsThatNeedToBeOpened, splitView);
271 }
272 const int tabCount = count();
273
274 // Select the files. Although the files can be split between several
275 // tabs, there is no need to split 'files' accordingly, as
276 // the DolphinView will just ignore invalid selections.
277 for (int i = 0; i < tabCount; ++i) {
278 DolphinTabPage *tabPage = tabPageAt(i);
279 tabPage->markUrlsAsSelected(files);
280 tabPage->markUrlAsCurrent(files.first());
281 if (i < oldTabCount) {
282 // Force selection of file if directory was already open, BUG: 417230
283 tabPage->activeViewContainer()->view()->updateViewState();
284 }
285 }
286 }
287
288 void DolphinTabWidget::closeTab()
289 {
290 closeTab(currentIndex());
291 }
292
293 void DolphinTabWidget::closeTab(const int index)
294 {
295 Q_ASSERT(index >= 0);
296 Q_ASSERT(index < count());
297
298 if (count() < 2) {
299 // Close Dolphin when closing the last tab.
300 parentWidget()->close();
301 return;
302 }
303
304 DolphinTabPage *tabPage = tabPageAt(index);
305 Q_EMIT rememberClosedTab(tabPage->activeViewContainer()->url(), tabPage->saveState());
306
307 removeTab(index);
308 tabPage->deleteLater();
309 }
310
311 void DolphinTabWidget::activateTab(const int index)
312 {
313 if (index < count()) {
314 setCurrentIndex(index);
315 }
316 }
317
318 void DolphinTabWidget::activateLastTab()
319 {
320 setCurrentIndex(count() - 1);
321 }
322
323 void DolphinTabWidget::activateNextTab()
324 {
325 const int index = currentIndex() + 1;
326 setCurrentIndex(index < count() ? index : 0);
327 }
328
329 void DolphinTabWidget::activatePrevTab()
330 {
331 const int index = currentIndex() - 1;
332 setCurrentIndex(index >= 0 ? index : (count() - 1));
333 }
334
335 void DolphinTabWidget::restoreClosedTab(const QByteArray &state)
336 {
337 openNewActivatedTab();
338 currentTabPage()->restoreState(state);
339 }
340
341 void DolphinTabWidget::copyToInactiveSplitView()
342 {
343 const DolphinTabPage *tabPage = currentTabPage();
344 if (!tabPage->splitViewEnabled()) {
345 return;
346 }
347
348 const KFileItemList selectedItems = tabPage->activeViewContainer()->view()->selectedItems();
349 if (selectedItems.isEmpty()) {
350 return;
351 }
352
353 DolphinView *const inactiveView = tabPage->inactiveViewContainer()->view();
354 inactiveView->copySelectedItems(selectedItems, inactiveView->url());
355 }
356
357 void DolphinTabWidget::moveToInactiveSplitView()
358 {
359 const DolphinTabPage *tabPage = currentTabPage();
360 if (!tabPage->splitViewEnabled()) {
361 return;
362 }
363
364 const KFileItemList selectedItems = tabPage->activeViewContainer()->view()->selectedItems();
365 if (selectedItems.isEmpty()) {
366 return;
367 }
368
369 DolphinView *const inactiveView = tabPage->inactiveViewContainer()->view();
370 inactiveView->moveSelectedItems(selectedItems, inactiveView->url());
371 }
372
373 void DolphinTabWidget::detachTab(int index)
374 {
375 Q_ASSERT(index >= 0);
376
377 QStringList args;
378
379 const DolphinTabPage *tabPage = tabPageAt(index);
380 args << tabPage->primaryViewContainer()->url().url();
381 if (tabPage->splitViewEnabled()) {
382 args << tabPage->secondaryViewContainer()->url().url();
383 args << QStringLiteral("--split");
384 }
385 args << QStringLiteral("--new-window");
386
387 KIO::CommandLauncherJob *job = new KIO::CommandLauncherJob("dolphin", args, this);
388 job->setDesktopName(QStringLiteral("org.kde.dolphin"));
389 job->start();
390
391 closeTab(index);
392 }
393
394 void DolphinTabWidget::openNewActivatedTab(int index)
395 {
396 Q_ASSERT(index >= 0);
397 const DolphinTabPage *tabPage = tabPageAt(index);
398 openNewActivatedTab(tabPage->activeViewContainer()->url());
399 }
400
401 void DolphinTabWidget::tabDragMoveEvent(int index, QDragMoveEvent *event)
402 {
403 if (index >= 0) {
404 DolphinView *view = tabPageAt(index)->activeViewContainer()->view();
405 DragAndDropHelper::updateDropAction(event, view->url());
406 }
407 }
408
409 void DolphinTabWidget::tabDropEvent(int index, QDropEvent *event)
410 {
411 if (index >= 0) {
412 DolphinView *view = tabPageAt(index)->activeViewContainer()->view();
413 view->dropUrls(view->url(), event, view);
414 } else {
415 const auto urls = event->mimeData()->urls();
416
417 for (const QUrl &url : urls) {
418 auto *job = KIO::stat(url, KIO::StatJob::SourceSide, KIO::StatDetail::StatBasic, KIO::JobFlag::HideProgressInfo);
419 connect(job, &KJob::result, this, [this, job]() {
420 if (!job->error() && job->statResult().isDir()) {
421 openNewTab(job->url(), QUrl(), NewTabPosition::AtEnd);
422 }
423 });
424 }
425 }
426 }
427
428 void DolphinTabWidget::tabUrlChanged(const QUrl &url)
429 {
430 const int index = indexOf(qobject_cast<QWidget *>(sender()));
431 if (index >= 0) {
432 updateTabName(index);
433 tabBar()->setTabToolTip(index, url.toDisplayString(QUrl::PreferLocalFile));
434 if (tabBar()->isVisible()) {
435 // ensure the path url ends with a slash to have proper folder icon for remote folders
436 const QUrl pathUrl = QUrl(url.adjusted(QUrl::StripTrailingSlash).toString(QUrl::FullyEncoded).append("/"));
437 tabBar()->setTabIcon(index, QIcon::fromTheme(KIO::iconNameForUrl(pathUrl)));
438 } else {
439 // Mark as dirty, actually load once the tab bar actually gets shown
440 tabBar()->setTabIcon(index, QIcon());
441 }
442
443 // Emit the currentUrlChanged signal if the url of the current tab has been changed.
444 if (index == currentIndex()) {
445 Q_EMIT currentUrlChanged(url);
446 }
447
448 Q_EMIT urlChanged(url);
449 }
450 }
451
452 void DolphinTabWidget::currentTabChanged(int index)
453 {
454 DolphinTabPage *tabPage = tabPageAt(index);
455 if (tabPage == m_lastViewedTab) {
456 return;
457 }
458 if (m_lastViewedTab) {
459 m_lastViewedTab->disconnectNavigators();
460 m_lastViewedTab->setActive(false);
461 }
462 if (tabPage->splitViewEnabled() && !m_navigatorsWidget->secondaryUrlNavigator()) {
463 m_navigatorsWidget->createSecondaryUrlNavigator();
464 }
465 DolphinViewContainer *viewContainer = tabPage->activeViewContainer();
466 Q_EMIT activeViewChanged(viewContainer);
467 Q_EMIT currentUrlChanged(viewContainer->url());
468 tabPage->setActive(true);
469 tabPage->connectNavigators(m_navigatorsWidget);
470 m_navigatorsWidget->setSecondaryNavigatorVisible(tabPage->splitViewEnabled());
471 m_lastViewedTab = tabPage;
472 }
473
474 void DolphinTabWidget::tabInserted(int index)
475 {
476 QTabWidget::tabInserted(index);
477
478 if (tabBar()->isVisible()) {
479 // Resolve all pending tab icons
480 for (int i = 0; i < count(); ++i) {
481 const QUrl url = tabPageAt(i)->activeViewContainer()->url();
482 if (tabBar()->tabIcon(i).isNull()) {
483 // ensure the path url ends with a slash to have proper folder icon for remote folders
484 const QUrl pathUrl = QUrl(url.adjusted(QUrl::StripTrailingSlash).toString(QUrl::FullyEncoded).append("/"));
485 tabBar()->setTabIcon(i, QIcon::fromTheme(KIO::iconNameForUrl(pathUrl)));
486 }
487 if (tabBar()->tabToolTip(i).isEmpty()) {
488 tabBar()->setTabToolTip(index, url.toDisplayString(QUrl::PreferLocalFile));
489 }
490 }
491 }
492
493 Q_EMIT tabCountChanged(count());
494 }
495
496 void DolphinTabWidget::tabRemoved(int index)
497 {
498 QTabWidget::tabRemoved(index);
499
500 Q_EMIT tabCountChanged(count());
501 }
502
503 QString DolphinTabWidget::tabName(DolphinTabPage *tabPage) const
504 {
505 if (!tabPage) {
506 return QString();
507 }
508 // clang-format off
509 QString name;
510 if (tabPage->splitViewEnabled()) {
511 if (tabPage->primaryViewActive()) {
512 // 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
513 // left in the tab name. In right to left languages the primary view would be on the right so the tab name should match.
514 name = i18nc("@title:tab Active primary view | (Inactive secondary view)", "%1 | (%2)", tabPage->primaryViewContainer()->caption(), tabPage->secondaryViewContainer()->caption());
515 } else {
516 // 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
517 // left in the tab name. In right to left languages the primary view would be on the right so the tab name should match.
518 name = i18nc("@title:tab (Inactive primary view) | Active secondary view", "(%1) | %2", tabPage->primaryViewContainer()->caption(), tabPage->secondaryViewContainer()->caption());
519 }
520 } else {
521 name = tabPage->activeViewContainer()->caption();
522 }
523 // clang-format on
524
525 // Make sure that a '&' inside the directory name is displayed correctly
526 // and not misinterpreted as a keyboard shortcut in QTabBar::setTabText()
527 return KStringHandler::rsqueeze(name.replace('&', QLatin1String("&&")), 40 /* default maximum visible folder name visible */);
528 }
529
530 DolphinViewContainer *DolphinTabWidget::viewContainerAt(DolphinTabWidget::ViewIndex viewIndex) const
531 {
532 const auto tabPage = tabPageAt(viewIndex.tabIndex);
533 if (!tabPage) {
534 return nullptr;
535 }
536 return viewIndex.isInPrimaryView ? tabPage->primaryViewContainer() : tabPage->secondaryViewContainer();
537 }
538
539 DolphinViewContainer *DolphinTabWidget::activateViewContainerAt(DolphinTabWidget::ViewIndex viewIndex)
540 {
541 activateTab(viewIndex.tabIndex);
542 auto viewContainer = viewContainerAt(viewIndex);
543 if (!viewContainer) {
544 return nullptr;
545 }
546 viewContainer->setActive(true);
547 return viewContainer;
548 }
549
550 const std::optional<const DolphinTabWidget::ViewIndex> DolphinTabWidget::viewOpenAtDirectory(const QUrl &directory) const
551 {
552 int i = currentIndex();
553 if (i < 0) {
554 return std::nullopt;
555 }
556 // loop over the tabs starting from the current one
557 do {
558 const auto tabPage = tabPageAt(i);
559 if (tabPage->primaryViewContainer()->url() == directory) {
560 return std::optional(ViewIndex{i, true});
561 }
562
563 if (tabPage->splitViewEnabled() && tabPage->secondaryViewContainer()->url() == directory) {
564 return std::optional(ViewIndex{i, false});
565 }
566
567 i = (i + 1) % count();
568 } while (i != currentIndex());
569
570 return std::nullopt;
571 }
572
573 const std::optional<const DolphinTabWidget::ViewIndex> DolphinTabWidget::viewShowingItem(const QUrl &item) const
574 {
575 // The item might not be loaded yet even though it exists. So instead
576 // we check if the folder containing the item is showing its contents.
577 const QUrl dirContainingItem(item.adjusted(QUrl::RemoveFilename | QUrl::StripTrailingSlash));
578
579 // The dirContainingItem is either open directly or expanded in a tree-style view mode.
580 // Is dirContainingitem the base url of a view?
581 auto viewOpenAtContainingDirectory = viewOpenAtDirectory(dirContainingItem);
582 if (viewOpenAtContainingDirectory.has_value()) {
583 return viewOpenAtContainingDirectory;
584 }
585
586 // Is dirContainingItem expanded in some tree-style view?
587 // The rest of this method is about figuring this out.
588
589 int i = currentIndex();
590 if (i < 0) {
591 return std::nullopt;
592 }
593 // loop over the tabs starting from the current one
594 do {
595 const auto tabPage = tabPageAt(i);
596 if (tabPage->primaryViewContainer()->url().isParentOf(item)) {
597 const KFileItem fileItemContainingItem = tabPage->primaryViewContainer()->view()->items().findByUrl(dirContainingItem);
598 if (!fileItemContainingItem.isNull() && tabPage->primaryViewContainer()->view()->isExpanded(fileItemContainingItem)) {
599 return std::optional(ViewIndex{i, true});
600 }
601 }
602
603 if (tabPage->splitViewEnabled() && tabPage->secondaryViewContainer()->url().isParentOf(item)) {
604 const KFileItem fileItemContainingItem = tabPage->secondaryViewContainer()->view()->items().findByUrl(dirContainingItem);
605 if (!fileItemContainingItem.isNull() && tabPage->secondaryViewContainer()->view()->isExpanded(fileItemContainingItem)) {
606 return std::optional(ViewIndex{i, false});
607 }
608 }
609
610 i = (i + 1) % count();
611 } while (i != currentIndex());
612
613 return std::nullopt;
614 }
615
616 #include "moc_dolphintabwidget.cpp"