X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/43ea7052e15b1cb917bcc6cd2bd3a8046179e45c..37df39b93bf23b89ca760d4dd793788833d9a3e1:/src/dolphintabwidget.cpp diff --git a/src/dolphintabwidget.cpp b/src/dolphintabwidget.cpp index ec0c783bc..89c54baf5 100644 --- a/src/dolphintabwidget.cpp +++ b/src/dolphintabwidget.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -37,6 +38,8 @@ DolphinTabWidget::DolphinTabWidget(QWidget* parent) : m_placesSelectorVisible(true), m_lastViewedTab(0) { + KAcceleratorManager::setNoAccel(this); + connect(this, &DolphinTabWidget::tabCloseRequested, this, QOverload::of(&DolphinTabWidget::closeTab)); connect(this, &DolphinTabWidget::currentChanged, @@ -203,6 +206,10 @@ void DolphinTabWidget::openDirectories(const QList& dirs, bool splitView) } else { tabPage->secondaryViewContainer()->setActive(true); } + // BUG: 417230 + // 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())) { @@ -236,10 +243,14 @@ void DolphinTabWidget::openFiles(const QList& files, bool splitView) // Select the files. Although the files can be split between several // tabs, there is no need to split 'files' accordingly, as // the DolphinView will just ignore invalid selections. - for (int i = oldTabCount; i < tabCount; ++i) { + for (int i = 0; i < tabCount; ++i) { DolphinTabPage* tabPage = tabPageAt(i); tabPage->markUrlsAsSelected(files); tabPage->markUrlAsCurrent(files.first()); + if (i < oldTabCount) { + // Force selection of file if directory was already open, BUG: 417230 + tabPage->activeViewContainer()->view()->updateViewState(); + } } } @@ -266,6 +277,18 @@ void DolphinTabWidget::closeTab(const int index) tabPage->deleteLater(); } +void DolphinTabWidget::activateTab(const int index) +{ + if (index < count()) { + setCurrentIndex(index); + } +} + +void DolphinTabWidget::activateLastTab() +{ + setCurrentIndex(count() - 1); +} + void DolphinTabWidget::activateNextTab() { const int index = currentIndex() + 1;