on xenial help sign in
Improve the way notifications interact with power management
35025c7Alexandros Frantzis
qml/Notifications/Notification.qml+16
@@ -86,6 +86,10 @@ StyledItem {
86 }
86 }
87
87
88 Component.onCompleted: {
88 Component.onCompleted: {
89+ if (type === Notification.PlaceHolder) {
90+ return;
91+ }
92+
89 // Turn on screen as needed (Powerd.Notification means the screen
93 // Turn on screen as needed (Powerd.Notification means the screen
90 // stays on for a shorter amount of time)
94 // stays on for a shorter amount of time)
91 if (type === Notification.SnapDecision) {
95 if (type === Notification.SnapDecision) {
@@ -100,6 +104,18 @@ StyledItem {
100 }
104 }
101 }
105 }
102
106
107+ Component.onDestruction: {
108+ if (type === Notification.PlaceHolder) {
109+ return;
110+ }
111+
112+ if (type === Notification.SnapDecision) {
113+ Powerd.setStatus(Powerd.Off, Powerd.SnapDecision);
114+ } else if (type !== Notification.Confirmation) {
115+ Powerd.setStatus(Powerd.Off, Powerd.Notification);
116+ }
117+ }
118+
103 function closeNotification() {
119 function closeNotification() {
104 if (index === ListView.view.currentIndex) { // reset to get the 1st snap decision expanded
120 if (index === ListView.view.currentIndex) { // reset to get the 1st snap decision expanded
105 ListView.view.currentIndex = -1;
121 ListView.view.currentIndex = -1;