]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Never emit the fileMiddleClickActivated signal if isTabsForFilesEnabled is true
authorStefano Crocco <stefano.crocco@alice.it>
Sun, 14 Jan 2024 09:36:32 +0000 (09:36 +0000)
committerMéven Car <meven.car@kdemail.net>
Sun, 14 Jan 2024 09:36:32 +0000 (09:36 +0000)
Commit d27ee07d makes it impossible for applications embedding Dolphin part (for example, Konqueror) to react to middle mouse click on a file. If I understand correctly (I'm not familiar with Dolphin code) the `fileMiddleClickActivated` signal is connected with a slot in `DolphinViewContainer`, which is only used by Dolphin itself and not by `DolphinPart`. The result is that middle clicking on a file (except archives) from a Dolphin part has no effect.

To avoid this situation, I removed the check for `!archiveProtocolIsEmpty()` in the `else if` condition. This way, if `isTabsForFilesEnabled()` is `true`, which should be true if and only if the view is inside a `DolphinPart`, the `activeTabRequested` or `tabRequested` signal will be emitted, allowing the embedding application to respond however it wants. When the view is inside the Dolphin application, instead, `isTabsForFilesEnabled()` will always be `false`, so the new behavior will be used.

src/views/dolphinview.cpp

index ae0aa903c02aee9382794c131a10f1465cf9ef94..c06c49b63c1af065cba7d3047c767eb642a35d03 100644 (file)
@@ -1121,7 +1121,6 @@ void DolphinView::slotItemMiddleClicked(int index)
     const KFileItem &item = m_model->fileItem(index);
     const QUrl &url = openItemAsFolderUrl(item);
     const auto modifiers = QGuiApplication::keyboardModifiers();
-    const QString &archiveProtocol = KProtocolManager::protocolForArchiveMimetype(item.mimetype());
     if (!url.isEmpty()) {
         // keep in sync with KUrlNavigator::slotNavigatorButtonClicked
         if (modifiers & Qt::ShiftModifier) {
@@ -1129,7 +1128,7 @@ void DolphinView::slotItemMiddleClicked(int index)
         } else {
             Q_EMIT tabRequested(url);
         }
-    } else if (!archiveProtocol.isEmpty() && isTabsForFilesEnabled()) {
+    } else if (isTabsForFilesEnabled()) {
         // keep in sync with KUrlNavigator::slotNavigatorButtonClicked
         if (modifiers & Qt::ShiftModifier) {
             Q_EMIT activeTabRequested(item.url());