Merge pull request #16486 from Rmys/master

dolphin rebuild
This commit is contained in:
Rmys
2025-04-28 18:07:42 +03:00
committed by GitHub
5 changed files with 41 additions and 385 deletions
@@ -1,310 +0,0 @@
From 2cd3d58eec5695899c26ca66a631fb79867b6584 Mon Sep 17 00:00:00 2001
From: Nicolas Fella <nicolas.fella@gmx.de>
Date: Tue, 7 Nov 2023 15:45:01 +0100
Subject: [PATCH] Port away from KMoreTools
The idea behind KMoreTools was to point the user at external tools for a given job.
It provides a rather complex framework for that, including suggesting not-yet-installed tools.
The UX behind that isn't great though, which somewhat deep menu hierarchies and a somewhat arbitrary list of tools.
Most KDE apps have moved away from it, with only Dolphin remaining.
Instead provide direct integration with relevant KDE tools (Filelight, KDiskFree, KFind)
---
.kde-ci.yml | 1 -
CMakeLists.txt | 1 -
src/CMakeLists.txt | 2 -
src/dolphinmainwindow.cpp | 20 +++++----
src/dolphinpart.cpp | 16 ++-----
src/search/dolphinsearchbox.cpp | 37 ++++++++++------
src/search/dolphinsearchbox.h | 2 -
src/statusbar/statusbarspaceinfo.cpp | 66 +++++++++++++++++++++++++---
8 files changed, 98 insertions(+), 47 deletions(-)
diff --git a/.kde-ci.yml b/.kde-ci.yml
index 28fcaac569..500b80c569 100644
--- a/.kde-ci.yml
+++ b/.kde-ci.yml
@@ -28,7 +28,6 @@ Dependencies:
'frameworks/kuserfeedback': '@latest'
'plasma/kactivities': '@latest'
'libraries/phonon': '@latest'
- 'libraries/kmoretools': '@latest'
- 'on': ['Linux/Qt6', 'FreeBSD/Qt6']
'require':
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d9e574f2cb..a14d6895b7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -75,7 +75,6 @@ find_package(KF6 ${KF6_MIN_VERSION} REQUIRED COMPONENTS
WindowSystem
WidgetsAddons
Codecs
- MoreTools
)
find_package(KUserFeedbackQt6 1.2.1)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 0792af0c0b..8eb5a0e9f0 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -212,8 +212,6 @@ target_link_libraries(
KF6::Codecs
KF6::KCMUtils
- KF6::MoreTools
-
${FTS_LIB}
)
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp
index 0d31df2da0..635121062a 100644
--- a/src/dolphinmainwindow.cpp
+++ b/src/dolphinmainwindow.cpp
@@ -48,7 +48,6 @@
#include <KJobWidgets>
#include <KLocalizedString>
#include <KMessageBox>
-#include <KMoreToolsMenuFactory>
#include <KProtocolInfo>
#include <KProtocolManager>
#include <KShell>
@@ -1127,15 +1126,20 @@ void DolphinMainWindow::toggleShowMenuBar()
QPointer<QAction> DolphinMainWindow::preferredSearchTool()
{
m_searchTools.clear();
- KMoreToolsMenuFactory("dolphin/search-tools").fillMenuFromGroupingNames(&m_searchTools, {"files-find"}, m_activeViewContainer->url());
- QList<QAction *> actions = m_searchTools.actions();
- if (actions.isEmpty()) {
- return nullptr;
- }
- QAction *action = actions.first();
- if (action->isSeparator()) {
+
+ KService::Ptr kfind = KService::serviceByDesktopName(QStringLiteral("org.kde.kfind"));
+
+ if (!kfind) {
return nullptr;
}
+
+ auto *action = new QAction(QIcon::fromTheme(kfind->icon()), kfind->name(), this);
+
+ connect(action, &QAction::triggered, this, [kfind] {
+ auto *job = new KIO::ApplicationLauncherJob(kfind);
+ job->start();
+ });
+
return action;
}
diff --git a/src/dolphinpart.cpp b/src/dolphinpart.cpp
index 4ba1f07420..bb27e0a5e4 100644
--- a/src/dolphinpart.cpp
+++ b/src/dolphinpart.cpp
@@ -28,7 +28,6 @@
#include <KLocalizedString>
#include <KMessageBox>
#include <KMimeTypeEditor>
-#include <KMoreToolsMenuFactory>
#include <KPluginFactory>
#include <KPluginMetaData>
#include <KSharedConfig>
@@ -527,17 +526,10 @@ void DolphinPart::slotOpenTerminal()
void DolphinPart::slotFindFile()
{
- QMenu searchTools;
- KMoreToolsMenuFactory("dolphin/search-tools").fillMenuFromGroupingNames(&searchTools, {"files-find"}, QUrl::fromLocalFile(localFilePathOrHome()));
- QList<QAction *> actions = searchTools.actions();
- if (!(actions.isEmpty())) {
- actions.first()->trigger();
- } else {
- KIO::CommandLauncherJob *job = new KIO::CommandLauncherJob(QStringLiteral("kfind"), {url().toString()}, this);
- job->setDesktopName(QStringLiteral("org.kde.kfind"));
- job->setUiDelegate(new KDialogJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, widget()));
- job->start();
- }
+ KIO::CommandLauncherJob *job = new KIO::CommandLauncherJob(QStringLiteral("kfind"), {url().toString()}, this);
+ job->setDesktopName(QStringLiteral("org.kde.kfind"));
+ job->setUiDelegate(new KDialogJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, widget()));
+ job->start();
}
void DolphinPart::updateNewMenu()
diff --git a/src/search/dolphinsearchbox.cpp b/src/search/dolphinsearchbox.cpp
index a3cec6fe7e..dfd733e5da 100644
--- a/src/search/dolphinsearchbox.cpp
+++ b/src/search/dolphinsearchbox.cpp
@@ -13,9 +13,10 @@
#include "dolphinquery.h"
#include "config-dolphin.h"
+#include <KIO/ApplicationLauncherJob>
#include <KLocalizedString>
-#include <KMoreToolsMenuFactory>
#include <KSeparator>
+#include <KService>
#if HAVE_BALOO
#include <Baloo/IndexerConfig>
#include <Baloo/Query>
@@ -395,18 +396,24 @@ void DolphinSearchBox::init()
searchLocationGroup->addButton(m_fromHereButton);
searchLocationGroup->addButton(m_everywhereButton);
- auto moreSearchToolsButton = new QToolButton(this);
- moreSearchToolsButton->setAutoRaise(true);
- moreSearchToolsButton->setPopupMode(QToolButton::InstantPopup);
- moreSearchToolsButton->setIcon(QIcon::fromTheme("arrow-down-double"));
- moreSearchToolsButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
- moreSearchToolsButton->setText(i18n("More Search Tools"));
- moreSearchToolsButton->setMenu(new QMenu(this));
- connect(moreSearchToolsButton->menu(), &QMenu::aboutToShow, moreSearchToolsButton->menu(), [this, moreSearchToolsButton]() {
- m_menuFactory.reset(new KMoreToolsMenuFactory("dolphin/search-tools"));
- moreSearchToolsButton->menu()->clear();
- m_menuFactory->fillMenuFromGroupingNames(moreSearchToolsButton->menu(), {"files-find"}, this->m_searchPath);
- });
+ KService::Ptr kfind = KService::serviceByDesktopName(QStringLiteral("org.kde.kfind"));
+
+ QToolButton *kfindToolsButton = nullptr;
+ if (kfind) {
+ kfindToolsButton = new QToolButton(this);
+ kfindToolsButton->setAutoRaise(true);
+ kfindToolsButton->setPopupMode(QToolButton::InstantPopup);
+ kfindToolsButton->setIcon(QIcon::fromTheme("arrow-down-double"));
+ kfindToolsButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
+ kfindToolsButton->setText(i18n("Open %1", kfind->name()));
+ kfindToolsButton->setIcon(QIcon::fromTheme(kfind->icon()));
+
+ connect(kfindToolsButton, &QToolButton::clicked, this, [this, kfind] {
+ auto *job = new KIO::ApplicationLauncherJob(kfind);
+ job->setUrls({m_searchPath});
+ job->start();
+ });
+ }
// Create "Facets" widget
m_facetsWidget = new DolphinFacetsWidget(this);
@@ -429,7 +436,9 @@ void DolphinSearchBox::init()
optionsLayout->addWidget(m_fromHereButton);
optionsLayout->addWidget(m_everywhereButton);
optionsLayout->addWidget(new KSeparator(Qt::Vertical, this));
- optionsLayout->addWidget(moreSearchToolsButton);
+ if (kfindToolsButton) {
+ optionsLayout->addWidget(kfindToolsButton);
+ }
optionsLayout->addStretch(1);
m_optionsScrollArea = new QScrollArea(this);
diff --git a/src/search/dolphinsearchbox.h b/src/search/dolphinsearchbox.h
index b73c2899ff..9f1ad29525 100644
--- a/src/search/dolphinsearchbox.h
+++ b/src/search/dolphinsearchbox.h
@@ -18,7 +18,6 @@ class QToolButton;
class QScrollArea;
class QLabel;
class QVBoxLayout;
-class KMoreToolsMenuFactory;
/**
* @brief Input box for searching files with or without Baloo.
@@ -172,7 +171,6 @@ private:
DolphinFacetsWidget *m_facetsWidget;
QUrl m_searchPath;
- QScopedPointer<KMoreToolsMenuFactory> m_menuFactory;
QTimer *m_startSearchTimer;
};
diff --git a/src/statusbar/statusbarspaceinfo.cpp b/src/statusbar/statusbarspaceinfo.cpp
index 4eef8497df..546c217a7a 100644
--- a/src/statusbar/statusbarspaceinfo.cpp
+++ b/src/statusbar/statusbarspaceinfo.cpp
@@ -8,11 +8,14 @@
#include "spaceinfoobserver.h"
+#include <KIO/ApplicationLauncherJob>
+#include <KIO/Global>
#include <KLocalizedString>
-#include <KMoreToolsMenuFactory>
+#include <KService>
-#include <KIO/Global>
+#include <QMenu>
#include <QMouseEvent>
+#include <QStorageInfo>
StatusBarSpaceInfo::StatusBarSpaceInfo(QWidget *parent)
: KCapacityBar(KCapacityBar::DrawTextInline, parent)
@@ -87,11 +90,60 @@ void StatusBarSpaceInfo::mousePressEvent(QMouseEvent *event)
// Creates a menu with tools that help to find out more about free
// disk space for the given url.
- // Note that this object must live long enough in case the user opens
- // the "Configure..." dialog
- KMoreToolsMenuFactory menuFactory(QStringLiteral("dolphin/statusbar-diskspace-menu"));
- menuFactory.setParentWidget(this);
- auto menu = menuFactory.createMenuFromGroupingNames({"disk-usage", "more:", "disk-partitions"}, m_url);
+ const KService::Ptr filelight = KService::serviceByDesktopName(QStringLiteral("org.kde.filelight"));
+ const KService::Ptr kdiskfree = KService::serviceByDesktopName(QStringLiteral("org.kde.kdf"));
+
+ if (!filelight && !kdiskfree) {
+ // nothing to show
+ return;
+ }
+
+ QMenu *menu = new QMenu(this);
+
+ if (filelight) {
+ QAction *filelightFolderAction = menu->addAction(QIcon::fromTheme(QStringLiteral("filelight")), i18n("Disk Usage Statistics - current folder"));
+
+ menu->connect(filelightFolderAction, &QAction::triggered, menu, [this, filelight](bool) {
+ auto *job = new KIO::ApplicationLauncherJob(filelight);
+ job->setUrls({m_url});
+ job->start();
+ });
+
+ // For remote URLs like FTP analyzing the device makes no sense
+ if (m_url.isLocalFile()) {
+ QAction *filelightDiskAction = menu->addAction(QIcon::fromTheme(QStringLiteral("filelight")), i18n("Disk Usage Statistics - current device"));
+
+ menu->connect(filelightDiskAction, &QAction::triggered, menu, [this, filelight](bool) {
+ const QStorageInfo info(m_url.toLocalFile());
+
+ if (info.isValid() && info.isReady()) {
+ auto *job = new KIO::ApplicationLauncherJob(filelight);
+ job->setUrls({QUrl::fromLocalFile(info.rootPath())});
+ job->start();
+ }
+ });
+ }
+
+ QAction *filelightAllAction = menu->addAction(QIcon::fromTheme(QStringLiteral("filelight")), i18n("Disk Usage Statistics - all devices"));
+
+ menu->connect(filelightAllAction, &QAction::triggered, menu, [this, filelight](bool) {
+ const QStorageInfo info(m_url.toLocalFile());
+
+ if (info.isValid() && info.isReady()) {
+ auto *job = new KIO::ApplicationLauncherJob(filelight);
+ job->start();
+ }
+ });
+ }
+
+ if (kdiskfree) {
+ QAction *kdiskfreeAction = menu->addAction(QIcon::fromTheme(QStringLiteral("kdf")), i18n("KDiskFree"));
+
+ connect(kdiskfreeAction, &QAction::triggered, this, [kdiskfree] {
+ auto *job = new KIO::ApplicationLauncherJob(kdiskfree);
+ job->start();
+ });
+ }
menu->exec(QCursor::pos());
}
--
GitLab
@@ -0,0 +1,38 @@
From 6032b78512685dc7d6cc3754d536823d428525c4 Mon Sep 17 00:00:00 2001
From: Felix Ernst <felixernst@zohomail.eu>
Date: Wed, 16 Apr 2025 13:50:05 +0000
Subject: [PATCH] Fix session restore
Since https://commits.kde.org/kxmlgui/8c9fb02a1d37672b26a03a9dd9e8675743deb269
KXmlGui only triggers a session restore for a window when the
session config contains a "NumberOfWindows" key with a value >= 1.
This commit adds such a key to the Dolphin session config, which
fixes the Dolphin main window restore for KXmlGui versions
containing that commit.
BUG: 502770
(cherry picked from commit c0bf226aa1cc02c9bffff1ec05e07a255d8d2f6e)
Co-authored-by: Felix Ernst <felixernst@zohomail.eu>
---
src/dolphinmainwindow.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp
index 8a6c99ce57..391fe81a8c 100644
--- a/src/dolphinmainwindow.cpp
+++ b/src/dolphinmainwindow.cpp
@@ -757,6 +757,8 @@ void DolphinMainWindow::slotSaveSession()
KConfig *config = KConfigGui::sessionConfig();
saveGlobalProperties(config);
savePropertiesInternal(config, 1);
+ KConfigGroup group = config->group(QStringLiteral("Number"));
+ group.writeEntry("NumberOfWindows", 1); // Makes session restore aware that there is a window to restore.
auto future = QtConcurrent::run([config]() {
config->sync();
--
GitLab
@@ -1,35 +0,0 @@
From 95551f44922670be5c4d670833c2d4e398657495 Mon Sep 17 00:00:00 2001
From: Nicolas Fella <nicolas.fella@gmx.de>
Date: Fri, 8 Mar 2024 18:46:32 +0100
Subject: [PATCH] Remove unneeded code for toggeling dockwidget visibility
QDockWidget::toggleViewAction::toggled is emitted when minimizing
the application window on X11 (https://bugreports.qt.io/browse/QTBUG-48161
potentially related). This will cause the dockwidget to be hidden when
minimizing the window.
We don't actually seem to need that connection, triggering the action
(via shortcut or menu) seems to correctly show/hide the dockwidget
without it
BUG: 481952
---
src/dolphinmainwindow.cpp | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp
index 03486a9cf6..1f4de8869c 100644
--- a/src/dolphinmainwindow.cpp
+++ b/src/dolphinmainwindow.cpp
@@ -2619,8 +2619,6 @@ void DolphinMainWindow::createPanelAction(const QIcon &icon, const QKeySequence
QAction *panelAction = actionCollection()->addAction(actionName, dockAction);
actionCollection()->setDefaultShortcut(panelAction, shortcut);
-
- connect(panelAction, &QAction::toggled, dockWidget, &QWidget::setVisible);
}
// clang-format off
void DolphinMainWindow::setupWhatsThis()
--
GitLab
@@ -1,37 +0,0 @@
From a07f24228a94aab2bdeb3caaf7a4d694c0180ed7 Mon Sep 17 00:00:00 2001
From: Felix Ernst <felixernst@kde.org>
Date: Wed, 17 Apr 2024 07:32:27 +0000
Subject: [PATCH] Fix crash while entering selection mode with Qt6.7
`deleteLater()` on a non-existing object seems to cause a crash with
Qt6.7. This makes some sense but wasn't the case previously.
I didn't test this yet but it is a harmless change so if anyone can confirm we can IMO merge directly.
This was brought up in https://invent.kde.org/system/dolphin/-/merge_requests/764#note_920935, reported in the bug linked below, and the sentry crash reporting page also has a few dozen reports (https://crash-reports.kde.org/organizations/kde/issues/13589/?project=4&query=is%3Aunresolved&referrer=issue-stream&stream_index=1).
Dolphin 24.02 is also affected but we are already past the last bug fix release for it.
BUG: 485599
---
src/selectionmode/bottombarcontentscontainer.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/selectionmode/bottombarcontentscontainer.cpp b/src/selectionmode/bottombarcontentscontainer.cpp
index d571b0302a..0e3087a9c5 100644
--- a/src/selectionmode/bottombarcontentscontainer.cpp
+++ b/src/selectionmode/bottombarcontentscontainer.cpp
@@ -483,7 +483,9 @@ std::vector<QAction *> BottomBarContentsContainer::contextActionsFor(const KFile
if (selectedItems.isEmpty()) {
// There are no contextual actions to show for these items.
// We might even want to hide this bar in this case. To make this clear, we reset m_internalContextMenu.
- m_internalContextMenu.release()->deleteLater();
+ if (m_internalContextMenu) {
+ m_internalContextMenu.release()->deleteLater();
+ }
return std::vector<QAction *>{};
}
--
GitLab
+3 -3
View File
@@ -44,7 +44,7 @@
<Dependency>packagekit-qt6-devel</Dependency>
</BuildDependencies>
<Patches>
<!--Patch level="1">a07f2422.patch</Patch-->
<Patch level="1">6032b785.patch</Patch>
</Patches>
</Source>
@@ -126,8 +126,8 @@
</Package>
<History>
<Update release="61">
<Date>2025-04-20</Date>
<Update release="62">
<Date>2025-04-28</Date>
<Version>25.04.0</Version>
<Comment>Version bump.</Comment>
<Name>Pisi Linux Community</Name>