on xenial help sign in
Improve the way notifications interact with power management
da849f4Alexandros Frantzis
qml/Notifications/Notification.qml+16
@@ -84,6 +84,10 @@ StyledItem {
84 }
84 }
85
85
86 Component.onCompleted: {
86 Component.onCompleted: {
87+ if (type === Notification.PlaceHolder) {
88+ return;
89+ }
90+
87 // Turn on screen as needed (Powerd.Notification means the screen
91 // Turn on screen as needed (Powerd.Notification means the screen
88 // stays on for a shorter amount of time)
92 // stays on for a shorter amount of time)
89 if (type === Notification.SnapDecision) {
93 if (type === Notification.SnapDecision) {
@@ -98,6 +102,18 @@ StyledItem {
98 }
102 }
99 }
103 }
100
104
105+ Component.onDestruction: {
106+ if (type === Notification.PlaceHolder) {
107+ return;
108+ }
109+
110+ if (type === Notification.SnapDecision) {
111+ Powerd.setStatus(Powerd.Off, Powerd.SnapDecision);
112+ } else if (type !== Notification.Confirmation) {
113+ Powerd.setStatus(Powerd.Off, Powerd.Notification);
114+ }
115+ }
116+
101 function closeNotification() {
117 function closeNotification() {
102 if (notification.actions.count > 1) { // perform the "reject" action
118 if (notification.actions.count > 1) { // perform the "reject" action
103 notification.notification.invokeAction(notification.actions.data(1, ActionModel.RoleActionId));
119 notification.notification.invokeAction(notification.actions.data(1, ActionModel.RoleActionId));