2 * SPDX-FileCopyrightText: 2006 Peter Penz (peter.penz@gmx.at) and Patrice Tremblay
4 * SPDX-License-Identifier: GPL-2.0-or-later
6 #ifndef STATUSBARSPACEINFO_H
7 #define STATUSBARSPACEINFO_H
9 #include <KMessageWidget>
23 class SpaceInfoObserver
;
26 * @short Shows the available space for the volume represented
27 * by the given URL as part of the status bar.
29 class StatusBarSpaceInfo
: public QWidget
34 explicit StatusBarSpaceInfo(QWidget
*parent
= nullptr);
35 ~StatusBarSpaceInfo() override
;
38 * Works similar to QWidget::setVisible() except that this will postpone showing the widget until space info has been retrieved. Hiding happens instantly.
40 * @param shown Whether this widget is supposed to be visible long-term
42 void setShown(bool shown
);
43 void setUrl(const QUrl
&url
);
50 * Requests for @p message with the given @p messageType to be shown to the user in a non-modal way.
52 void showMessage(const QString
&message
, KMessageWidget::MessageType messageType
);
55 * Requests for a progress update to be shown to the user in a non-modal way.
56 * @param currentlyRunningTaskTitle The task that is currently progressing.
57 * @param installationProgressPercent The current percentage of completion.
59 void showInstallationProgress(const QString
¤tlyRunningTaskTitle
, int installationProgressPercent
);
62 void showEvent(QShowEvent
*event
) override
;
63 void hideEvent(QHideEvent
*event
) override
;
64 QSize
minimumSizeHint() const override
;
70 * Asynchronously starts a Filelight installation using DolphinPackageInstaller. @see DolphinPackageInstaller.
71 * Installation success or failure is reported through showMessage(). @see StatusBarSpaceInfo::showMessage().
72 * Installation progress is reported through showInstallationProgress(). @see StatusBarSpaceInfo::showInstallationProgress().
74 void slotInstallFilelightButtonClicked();
76 void slotValuesChanged();
80 * Creates a new QWidgetAction that contains a UI to install Filelight.
81 * m_installFilelightWidgetAction is initialised after calling this method once.
83 void initialiseInstallFilelightWidgetAction();
85 // The following three methods are only for private use.
86 using QWidget::hide
; // Use StatusBarSpaceInfo::setShown() instead.
87 using QWidget::setVisible
; // Use StatusBarSpaceInfo::setShown() instead.
88 using QWidget::show
; // Use StatusBarSpaceInfo::setShown() instead.
91 QScopedPointer
<SpaceInfoObserver
> m_observer
;
92 KCapacityBar
*m_capacityBar
;
93 QToolButton
*m_textInfoButton
;
95 /** An action containing a UI to install Filelight. */
96 QWidgetAction
*m_installFilelightWidgetAction
;
98 /** Whether m_observer has already retrieved space information for the current url. */
100 /** Whether this widget is supposed to be visible long-term. @see StatusBarSpaceInfo::setShown(). */