diff options
Diffstat (limited to 'src/views')
| -rw-r--r-- | src/views/dolphinview.cpp | 30 | ||||
| -rw-r--r-- | src/views/dolphinview.h | 16 |
2 files changed, 38 insertions, 8 deletions
diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index 9a063d857..bb537b982 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -974,12 +974,14 @@ void DolphinView::slotItemActivated(int index) } } -void DolphinView::slotItemsActivated(const KItemSet& indexes) +void DolphinView::slotItemsActivated(const KItemSet &indexes) { Q_ASSERT(indexes.count() >= 2); abortTwoClicksRenaming(); + const auto modifiers = QGuiApplication::keyboardModifiers(); + if (indexes.count() > 5) { QString question = i18np("Are you sure you want to open 1 item?", "Are you sure you want to open %1 items?", indexes.count()); const int answer = KMessageBox::warningYesNo(this, question); @@ -995,8 +997,15 @@ void DolphinView::slotItemsActivated(const KItemSet& indexes) KFileItem item = m_model->fileItem(index); const QUrl& url = openItemAsFolderUrl(item); - if (!url.isEmpty()) { // Open folders in new tabs - Q_EMIT tabRequested(url); + if (!url.isEmpty()) { + // Open folders in new tabs or in new windows depending on the modifier + // The ctrl+shift behavior is ignored because we are handling multiple items + // keep in sync with KUrlNavigator::slotNavigatorButtonClicked + if (modifiers & Qt::ShiftModifier && !(modifiers & Qt::ControlModifier)) { + Q_EMIT windowRequested(url); + } else { + Q_EMIT tabRequested(url); + } } else { items.append(item); } @@ -1013,10 +1022,21 @@ void DolphinView::slotItemMiddleClicked(int index) { const KFileItem& item = m_model->fileItem(index); const QUrl& url = openItemAsFolderUrl(item); + const auto modifiers = QGuiApplication::keyboardModifiers(); if (!url.isEmpty()) { - Q_EMIT tabRequested(url); + // keep in sync with KUrlNavigator::slotNavigatorButtonClicked + if (modifiers & Qt::ShiftModifier) { + Q_EMIT activeTabRequested(url); + } else { + Q_EMIT tabRequested(url); + } } else if (isTabsForFilesEnabled()) { - Q_EMIT tabRequested(item.url()); + // keep in sync with KUrlNavigator::slotNavigatorButtonClicked + if (modifiers & Qt::ShiftModifier) { + Q_EMIT activeTabRequested(item.url()); + } else { + Q_EMIT tabRequested(item.url()); + } } } diff --git a/src/views/dolphinview.h b/src/views/dolphinview.h index 11926d558..0f288f942 100644 --- a/src/views/dolphinview.h +++ b/src/views/dolphinview.h @@ -425,13 +425,13 @@ Q_SIGNALS: /** * Is emitted when clicking on an item with the left mouse button. */ - void itemActivated(const KFileItem& item); + void itemActivated(const KFileItem &item); /** * Is emitted when multiple items have been activated by e. g. * context menu open with. */ - void itemsActivated(const KFileItemList& items); + void itemsActivated(const KFileItemList &items); /** * Is emitted if items have been added or deleted. @@ -444,6 +444,16 @@ Q_SIGNALS: void tabRequested(const QUrl& url); /** + * Is emitted if a new tab should be opened for the URL \a url and set as active. + */ + void activeTabRequested(const QUrl &url); + + /** + * Is emitted if a new window should be opened for the URL \a url. + */ + void windowRequested(const QUrl &url); + + /** * Is emitted if the view mode (IconsView, DetailsView, * PreviewsView) has been changed. */ @@ -619,7 +629,7 @@ private Q_SLOTS: void activate(); void slotItemActivated(int index); - void slotItemsActivated(const KItemSet& indexes); + void slotItemsActivated(const KItemSet &indexes); void slotItemMiddleClicked(int index); void slotItemContextMenuRequested(int index, const QPointF& pos); void slotViewContextMenuRequested(const QPointF& pos); |
