widgets/notifications: Use smaller button text, and adjust sizing

Fixes an issue where the ListView was sometimes not tall enough to hold the content despite the list not overflowing.

Also adjusts button text to be smaller.
This commit is contained in:
Devin Lin 2022-06-25 14:37:56 -04:00
parent 8b6095c864
commit 0a76701af5

View file

@ -145,11 +145,10 @@ Item {
readonly property int animationDuration: MobileShell.MobileShellSettings.animationsEnabled ? PlasmaCore.Units.longDuration : 0 readonly property int animationDuration: MobileShell.MobileShellSettings.animationsEnabled ? PlasmaCore.Units.longDuration : 0
// If a screen overflow occurs, fix height in order to maintain tool buttons in place. // If a screen overflow occurs, fix height in order to maintain tool buttons in place.
readonly property bool listOverflowing: contentItem.childrenRect.height + toolButtons.height + bottomMargin + spacing >= root.height readonly property bool listOverflowing: contentItem.childrenRect.height + toolButtons.height + spacing >= root.height
bottomMargin: spacing * 2 bottomMargin: spacing
height: count === 0 ? 0 : (listOverflowing ? root.height - toolButtons.height : contentItem.childrenRect.height + bottomMargin)
height: count === 0 ? 0 : listOverflowing ? root.height - toolButtons.height - bottomMargin : contentItem.childrenRect.height + spacing
anchors { anchors {
top: parent.top top: parent.top
@ -334,12 +333,11 @@ Item {
Item { Item {
id: toolButtons id: toolButtons
height: spacer.height + toolLayout.height + toolLayout.anchors.topMargin + toolLayout.anchors.bottomMargin
// do not show on lockscreen
visible: !root.actionsRequireUnlock visible: !root.actionsRequireUnlock
width: root.width
height: toolLayout.implicitHeight + spacer.height
anchors { anchors {
top: list.bottom top: list.bottom
left: parent.left left: parent.left
@ -348,17 +346,11 @@ Item {
Rectangle { Rectangle {
id: spacer id: spacer
anchors.left: parent.left
anchors.right: parent.right
visible: list.listOverflowing visible: list.listOverflowing
anchors {
top: toolButtons.top
left: toolButtons.left
right: toolButtons.right
}
height: 1 height: 1
opacity: 0.25 opacity: 0.25
color: PlasmaCore.Theme.textColor color: PlasmaCore.Theme.textColor
} }
@ -368,12 +360,11 @@ Item {
anchors { anchors {
top: spacer.bottom top: spacer.bottom
topMargin: list.spacing
left: parent.left
leftMargin: PlasmaCore.Units.smallSpacing
right: parent.right right: parent.right
rightMargin: PlasmaCore.Units.smallSpacing left: parent.left
bottom: parent.bottom leftMargin: PlasmaCore.Units.largeSpacing
rightMargin: PlasmaCore.Units.largeSpacing
topMargin: list.spacing
bottomMargin: list.spacing bottomMargin: list.spacing
} }
@ -383,6 +374,7 @@ Item {
Layout.alignment: hasNotifications ? Qt.AlignLeft : Qt.AlignHCenter Layout.alignment: hasNotifications ? Qt.AlignLeft : Qt.AlignHCenter
font.bold: true font.bold: true
font.pointSize: Kirigami.Theme.smallFont.pointSize
icon.name: doNotDisturbModeEnabled ? "notifications" : "notifications-disabled" icon.name: doNotDisturbModeEnabled ? "notifications" : "notifications-disabled"
text: doNotDisturbModeEnabled ? "Enable Notifications" : "Do Not Disturb" text: doNotDisturbModeEnabled ? "Enable Notifications" : "Do Not Disturb"
@ -397,6 +389,7 @@ Item {
visible: hasNotifications visible: hasNotifications
font.bold: true font.bold: true
font.pointSize: Kirigami.Theme.smallFont.pointSize
icon.name: "edit-clear-history" icon.name: "edit-clear-history"
text: "Clear All Notifications" text: "Clear All Notifications"