]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Offer installing Filelight if no disk usage analyzer was found
authorNicolas Fella <nicolas.fella@gmx.de>
Mon, 11 Dec 2023 00:19:15 +0000 (01:19 +0100)
committerFelix Ernst <felixernst@kde.org>
Thu, 30 May 2024 15:21:39 +0000 (15:21 +0000)
This avoids an empty menu and points the user towards a useful tool

BUG: 477739

src/statusbar/statusbarspaceinfo.cpp

index 253d912c0dd24881ab2e500c514779591e4cf1ad..9df4164676d28b2fa689d4280f329d8a8832c1cf 100644 (file)
@@ -14,6 +14,7 @@
 #include <KLocalizedString>
 #include <KService>
 
+#include <QDesktopServices>
 #include <QHBoxLayout>
 #include <QMenu>
 #include <QMouseEvent>
@@ -115,7 +116,17 @@ void StatusBarSpaceInfo::updateMenu()
     const KService::Ptr kdiskfree = KService::serviceByDesktopName(QStringLiteral("org.kde.kdf"));
 
     if (!filelight && !kdiskfree) {
-        // nothing to show
+        QAction *installFilelight =
+            m_buttonMenu->addAction(QIcon::fromTheme(QStringLiteral("filelight")), i18n("Install Filelight to View Disk Usage Statistics…"));
+
+        connect(installFilelight, &QAction::triggered, this, [] {
+#ifdef Q_OS_WIN
+            QDesktopServices::openUrl(QUrl("https://apps.kde.org/filelight"));
+#else
+            QDesktopServices::openUrl(QUrl("appstream://org.kde.filelight.desktop"));
+#endif
+        });
+
         return;
     }