2 SPDX-FileCopyrightText: 2025 Felix Ernst <felixernst@kde.org>
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7 #ifndef DISKSPACEUSAGEMENU_H
8 #define DISKSPACEUSAGEMENU_H
10 #include <KMessageWidget>
20 * A menu that allows launching tools to view disk usage statistics like Filelight and KDiskFree when those are installed.
21 * If none are installed, this menu instead allows installing Filelight.
23 class DiskSpaceUsageMenu
: public QMenu
28 explicit DiskSpaceUsageMenu(QWidget
*parent
);
30 inline void setUrl(const QUrl
&url
)
37 * Requests for @p message with the given @p messageType to be shown to the user in a non-modal way.
39 void showMessage(const QString
&message
, KMessageWidget::MessageType messageType
);
42 * Requests for a progress update to be shown to the user in a non-modal way.
43 * @param currentlyRunningTaskTitle The task that is currently progressing.
44 * @param installationProgressPercent The current percentage of completion.
46 void showInstallationProgress(const QString
¤tlyRunningTaskTitle
, int installationProgressPercent
);
50 * Asynchronously starts a Filelight installation using DolphinPackageInstaller. @see DolphinPackageInstaller.
51 * Installation success or failure is reported through showMessage(). @see StatusBarSpaceInfo::showMessage().
52 * Installation progress is reported through showInstallationProgress(). @see StatusBarSpaceInfo::showInstallationProgress().
54 void slotInstallFilelightButtonClicked();
59 /** Moves keyboard focus to the "Install Filelight" button if the Installation UI is shown. */
60 void showEvent(QShowEvent
*event
) override
;
64 * Creates a new QWidgetAction that contains a UI to install Filelight.
65 * m_installFilelightWidgetAction is initialised after calling this method once.
67 void initialiseInstallFilelightWidgetAction();
70 /** An action containing a UI to install Filelight. */
71 QPointer
<QWidgetAction
> m_installFilelightWidgetAction
= nullptr;
72 /** The current url of the view. Filelight can be launched to show this directory. */
76 #endif // DISKSPACEUSAGEMENU_H