1
0
mirror of https://invent.kde.org/system/dolphin synced 2024-06-30 23:46:46 +00:00

Offer installing Filelight if no disk usage analyzer was found

This avoids an empty menu and points the user towards a useful tool

BUG: 477739
This commit is contained in:
Nicolas Fella 2023-12-11 01:19:15 +01:00 committed by Felix Ernst
parent 20628fd5c8
commit 0a8f84a52d

View 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;
}