diff options
| author | Alexander Saoutkin <[email protected]> | 2019-09-02 23:15:08 +0200 |
|---|---|---|
| committer | Elvis Angelaccio <[email protected]> | 2019-09-02 23:15:08 +0200 |
| commit | a6403716439ae72bfdf86a14af94ea9d212f08ee (patch) | |
| tree | c2e41bbdfa5278cdac5e3a605d7cdc8261dff17a /src/dolphintabwidget.cpp | |
| parent | 56b3059f774ae5917185d91a380c9f0a95e7584f (diff) | |
Fixing bugs in new folders in tabs feature
Summary:
Fixing bug where urls in secondary view containers would not be considered
for the open new folders in tabs feature.
Test Plan: Manual testing. Testing for no regressions. Testing that URL is found if in secondary view container
Reviewers: elvisangelaccio
Reviewed By: elvisangelaccio
Subscribers: kfm-devel, ngraham
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D23655
Diffstat (limited to 'src/dolphintabwidget.cpp')
| -rw-r--r-- | src/dolphintabwidget.cpp | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/src/dolphintabwidget.cpp b/src/dolphintabwidget.cpp index defd089c1..7928c510e 100644 --- a/src/dolphintabwidget.cpp +++ b/src/dolphintabwidget.cpp @@ -186,9 +186,15 @@ void DolphinTabWidget::openDirectories(const QList<QUrl>& dirs, bool splitView) QList<QUrl>::const_iterator it = dirs.constBegin(); while (it != dirs.constEnd()) { const QUrl& primaryUrl = *(it++); - const int index = getIndexByUrl(primaryUrl); - if (index >= 0) { - setCurrentIndex(index); + const QPair<int, bool> viewLocation = getIndexByUrl(primaryUrl); + if (viewLocation.first >= 0) { + setCurrentIndex(viewLocation.first); + const auto tabPage = tabPageAt(viewLocation.first); + if (viewLocation.second) { + tabPage->primaryViewContainer()->setActive(true); + } else { + tabPage->secondaryViewContainer()->setActive(true); + } continue; } if (splitView && (it != dirs.constEnd())) { @@ -381,16 +387,17 @@ QString DolphinTabWidget::tabName(DolphinTabPage* tabPage) const return name.replace('&', QLatin1String("&&")); } -int DolphinTabWidget::getIndexByUrl(const QUrl& url) const +QPair<int, bool> DolphinTabWidget::getIndexByUrl(const QUrl& url) const { for (int i = 0; i < count(); i++) { - // Conversion to display string is necessary to deal with the '~' alias. - // i.e. to acknowledge that ~/ is equivalent to /home/user/ - const QUrl tabUrl = tabPageAt(i)->activeViewContainer()->url(); - if (url == tabUrl || - url.toDisplayString(QUrl::StripTrailingSlash) == tabUrl.toDisplayString(QUrl::StripTrailingSlash)) { - return i; + const auto tabPage = tabPageAt(i); + if (url == tabPage->primaryViewContainer()->url()) { + return qMakePair(i, true); + } + + if (tabPage->splitViewEnabled() && url == tabPage->secondaryViewContainer()->url()) { + return qMakePair(i, false); } } - return -1; + return qMakePair(-1, false); } |
