From d3637f380ccca26a281331a02ce76ed60e84cfe3 Mon Sep 17 00:00:00 2001 From: Felix Ernst Date: Sat, 18 Nov 2023 12:31:00 +0100 Subject: Turn free space label into a flat button The usage of a label to show this space information is problematic because there are features/actions hidden behind clicking the label. A button makes this clear. It also fixes the accessibility of this control because previously this info would never be read out by screen readers as it couldn't get keyboard focus. A side-effect of this change is that the free disk space bar looks more normal with non-Breeze styles. This had been a long-standing issue. --- src/statusbar/statusbarspaceinfo.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/statusbar/statusbarspaceinfo.h') diff --git a/src/statusbar/statusbarspaceinfo.h b/src/statusbar/statusbarspaceinfo.h index 932f09b7b..9048bd10c 100644 --- a/src/statusbar/statusbarspaceinfo.h +++ b/src/statusbar/statusbarspaceinfo.h @@ -6,13 +6,16 @@ #ifndef STATUSBARSPACEINFO_H #define STATUSBARSPACEINFO_H -#include - #include +#include class QHideEvent; class QShowEvent; +class QMenu; class QMouseEvent; +class QToolButton; + +class KCapacityBar; class SpaceInfoObserver; @@ -20,7 +23,7 @@ class SpaceInfoObserver; * @short Shows the available space for the volume represented * by the given URL as part of the status bar. */ -class StatusBarSpaceInfo : public KCapacityBar +class StatusBarSpaceInfo : public QWidget { Q_OBJECT @@ -40,13 +43,17 @@ public: protected: void showEvent(QShowEvent *event) override; void hideEvent(QHideEvent *event) override; - void mousePressEvent(QMouseEvent *event) override; + + void updateMenu(); private Q_SLOTS: void slotValuesChanged(); private: QScopedPointer m_observer; + KCapacityBar *m_capacityBar; + QToolButton *m_textInfoButton; + QMenu *m_buttonMenu; QUrl m_url; bool m_ready; bool m_shown; -- cgit v1.3