From 2b1906eeeabaf91b856d46e72390ae811747ec39 Mon Sep 17 00:00:00 2001 From: Jin Liu Date: Mon, 19 Aug 2024 11:15:23 +0000 Subject: Fix middle-click not following the "Open archives as folder" setting Previous to this commit middle-clicking an archive would always open it in a new tab. This contradicts the recent change d27ee07de7558470ef7b497fbe3d3504ce7cad07 which made it so middle-click would open an item in the second application that is available to open a file. With this commit, middle-clicking will treat the archive like a folder only when GeneralSettings::browseThroughArchives is enabled or when there is no second application available. Otherwise middle-click will open the archive in the second available application. --- src/dolphinviewcontainer.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/dolphinviewcontainer.cpp') diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp index f0035a857..ef76042b8 100644 --- a/src/dolphinviewcontainer.cpp +++ b/src/dolphinviewcontainer.cpp @@ -751,6 +751,18 @@ void DolphinViewContainer::slotfileMiddleClickActivated(const KFileItem &item) job->setUiDelegate(KIO::createDefaultJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this)); connect(job, &KIO::OpenUrlJob::finished, this, &DolphinViewContainer::slotOpenUrlFinished); job->start(); + } else { + // If no 2nd service available, try to open archives in new tabs, regardless of the "Open archives as folder" setting. + const QUrl &url = DolphinView::openItemAsFolderUrl(item); + const auto modifiers = QGuiApplication::keyboardModifiers(); + if (!url.isEmpty()) { + // keep in sync with KUrlNavigator::slotNavigatorButtonClicked + if (modifiers & Qt::ShiftModifier) { + Q_EMIT activeTabRequested(url); + } else { + Q_EMIT tabRequested(url); + } + } } } -- cgit v1.3