plasma5-workspace/0001-Add-a-button-to-clear-the-notification-history.patch

83 lines
2.5 KiB
Diff

From 08864d59109a869a906fb98059f4346a52ee0a6d Mon Sep 17 00:00:00 2001
From: "Christian (Fuchs) Loosli" <kde@fuchsnet.ch>
Date: Tue, 17 Apr 2018 10:18:31 +0200
Subject: [PATCH] Add a button to clear the notification history
Summary:
Adds a button in the plasmoid header to clear the history, same as the context menu.
The icon used is the same as clear history in the klipper plasmoid.
BUG: 386068
FIXED-IN: 5.13.0
Test Plan: Please test the alignment on your screen, whilst I made sure to use provided units, due to the indentation of heading I had to use fractions, which might lead to odd results on different resolutions / dpi
Reviewers: broulik
Reviewed By: broulik
Subscribers: abetts, plasma-devel
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D11261
---
.../package/contents/ui/Notifications.qml | 33 ++++++++++++++++++----
1 file changed, 28 insertions(+), 5 deletions(-)
diff --git a/applets/notifications/package/contents/ui/Notifications.qml b/applets/notifications/package/contents/ui/Notifications.qml
index b87e13da..1781185c 100644
--- a/applets/notifications/package/contents/ui/Notifications.qml
+++ b/applets/notifications/package/contents/ui/Notifications.qml
@@ -18,6 +18,7 @@
*/
import QtQuick 2.0
+import QtQuick.Layouts 1.2
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.extras 2.0 as PlasmaExtras
@@ -265,12 +266,34 @@ Column {
delegate: NotificationDelegate { listModel: notificationsModel }
}
- PlasmaExtras.Heading {
- width: parent.width
- level: 3
- opacity: 0.6
+ RowLayout {
+ Layout.fillWidth: true
+ spacing: units.smallSpacing
visible: historyCount > 0
- text: i18n("History")
+ width: parent.width
+
+ PlasmaExtras.Heading {
+ Layout.fillWidth: true
+ level: 3
+ opacity: 0.6
+ text: i18n("History")
+ }
+
+ PlasmaComponents.ToolButton {
+ Layout.rightMargin: spacerSvgFrame.margins.right
+ iconSource: "edit-delete"
+ tooltip: i18n("Clear History")
+ onClicked: clearHistory()
+ }
+ }
+
+ // This hack is unfortunately needed to have the buttons align,
+ // the ones in the list contain have a margin due to a frame for being a list item.
+ PlasmaCore.FrameSvgItem {
+ id : spacerSvgFrame
+ imagePath: "widgets/listitem"
+ prefix: "normal"
+ visible: false
}
// History stuff
--
2.16.2