on xenial help sign in
Fullscreen notification bug fixes Fixes: #1422711, #1581498, #1583944
eabd11bLukáš Tinkl
qml/Notifications/Notification.qml+17−6
@@ -55,11 +55,13 @@ StyledItem {
55 name: "Ubuntu.Components.Themes.Ambiance"
55 name: "Ubuntu.Components.Themes.Ambiance"
56 }
56 }
57
57
58+ signal dismissed()
59+
58 readonly property bool expanded: {
60 readonly property bool expanded: {
59 var result = false;
61 var result = false;
60
62
61 if (type === Notification.SnapDecision) {
63 if (type === Notification.SnapDecision) {
62− if (ListView.view.currentIndex === index) {
64+ if (ListView.view.currentIndex === index || fullscreen) {
63 result = true;
65 result = true;
64 } else {
66 } else {
65 if (ListView.view.count > 2) {
67 if (ListView.view.count > 2) {
@@ -103,10 +105,11 @@ StyledItem {
103 ListView.view.currentIndex = -1;
105 ListView.view.currentIndex = -1;
104 }
106 }
105
107
106− if (notification.actions.count > 1) { // perform the "reject" action
108+ // perform the "reject" action
107− notification.notification.invokeAction(notification.actions.data(1, ActionModel.RoleActionId));
109+ notification.notification.invokeAction(notification.actions.data(1, ActionModel.RoleActionId));
108− }
110+
109 notification.notification.close();
111 notification.notification.close();
112+ notification.dismissed()
110 }
113 }
111
114
112 Behavior on x {
115 Behavior on x {
@@ -119,6 +122,12 @@ StyledItem {
119 }
122 }
120 }
123 }
121
124
125+ onFullscreenChanged: {
126+ if (fullscreen) {
127+ notification.notification.urgency = Notification.Critical;
128+ }
129+ }
130+
122 Behavior on height {
131 Behavior on height {
123 UbuntuNumberAnimation {
132 UbuntuNumberAnimation {
124 duration: UbuntuAnimation.SnapDuration
133 duration: UbuntuAnimation.SnapDuration
@@ -192,6 +201,7 @@ StyledItem {
192 onNameOwnerChanged: {
201 onNameOwnerChanged: {
193 if (lastNameOwner !== "" && nameOwner === "" && notification.notification !== undefined) {
202 if (lastNameOwner !== "" && nameOwner === "" && notification.notification !== undefined) {
194 notification.notification.close()
203 notification.notification.close()
204+ notification.dismissed()
195 }
205 }
196 lastNameOwner = nameOwner
206 lastNameOwner = nameOwner
197 }
207 }
@@ -203,7 +213,7 @@ StyledItem {
203 anchors.fill: parent
213 anchors.fill: parent
204 objectName: "interactiveArea"
214 objectName: "interactiveArea"
205
215
206− drag.target: notification
216+ drag.target: !fullscreen ? notification : undefined
207 drag.axis: Drag.XAxis
217 drag.axis: Drag.XAxis
208 drag.minimumX: -notification.width
218 drag.minimumX: -notification.width
209 drag.maximumX: notification.width
219 drag.maximumX: notification.width
@@ -386,7 +396,7 @@ StyledItem {
386 objectName: "dialogListView"
396 objectName: "dialogListView"
387 spacing: notification.margins
397 spacing: notification.margins
388
398
389− visible: count > 0 && notification.expanded
399+ visible: count > 0 && (notification.expanded || notification.fullscreen)
390
400
391 anchors {
401 anchors {
392 left: parent.left
402 left: parent.left
@@ -417,6 +427,7 @@ StyledItem {
417 }
427 }
418 onAccepted: {
428 onAccepted: {
419 notification.notification.invokeAction(actionRepeater.itemAt(0).actionId)
429 notification.notification.invokeAction(actionRepeater.itemAt(0).actionId)
430+ notification.dismissed()
420 }
431 }
421 }
432 }
422 }
433 }
qml/Notifications/NotificationMenuItemFactory.qml+3
@@ -151,15 +151,18 @@ Loader {
151 onEntered: {
151 onEntered: {
152 menuModel.changeState(menuIndex, passphrase);
152 menuModel.changeState(menuIndex, passphrase);
153 clear(false);
153 clear(false);
154+ notification.dismissed()
154 }
155 }
155
156
156 onCancel: {
157 onCancel: {
157 menuModel.activate(menuIndex, false);
158 menuModel.activate(menuIndex, false);
159+ notification.dismissed()
158 }
160 }
159
161
160 onEmergencyCall: {
162 onEmergencyCall: {
161 shell.startLockedApp("dialer-app");
163 shell.startLockedApp("dialer-app");
162 menuModel.activate(menuIndex, false);
164 menuModel.activate(menuIndex, false);
165+ notification.dismissed()
163 }
166 }
164
167
165 property var extendedData: menuData && menuData.ext || undefined
168 property var extendedData: menuData && menuData.ext || undefined
qml/Notifications/Notifications.qml+17−8
@@ -41,11 +41,18 @@ ListView {
41 filterRegExp: RegExp(UnityNotifications.Notification.SnapDecision)
41 filterRegExp: RegExp(UnityNotifications.Notification.SnapDecision)
42 }
42 }
43
43
44− property bool topmostIsFullscreen: false
44+ readonly property bool topmostIsFullscreen: fullscreenIndex != -1
45 spacing: topmostIsFullscreen ? 0 : units.gu(1)
45 spacing: topmostIsFullscreen ? 0 : units.gu(1)
46
46
47 currentIndex: count > 1 ? 1 : -1
47 currentIndex: count > 1 ? 1 : -1
48
48
49+ property int fullscreenIndex: -1
50+ onFullscreenIndexChanged: {
51+ if (fullscreenIndex != -1) {
52+ positionViewAtIndex(fullscreenIndex, ListView.Beginning);
53+ }
54+ }
55+
49 delegate: Notification {
56 delegate: Notification {
50 objectName: "notification" + index
57 objectName: "notification" + index
51 width: parent.width
58 width: parent.width
@@ -69,16 +76,18 @@ ListView {
69 // FIXME: disabled all transitions because of LP: #1354406 workaround
76 // FIXME: disabled all transitions because of LP: #1354406 workaround
70 //layer.enabled: add.running || remove.running || populate.running
77 //layer.enabled: add.running || remove.running || populate.running
71
78
72− Component.onCompleted: {
79+ onFullscreenChanged: updateListTopMostIsFullscreen();
73− if (index == 1) {
80+
74− notificationList.topmostIsFullscreen = fullscreen
81+ function updateListTopMostIsFullscreen() {
82+ if (fullscreen) {
83+ fullscreenIndex = index;
75 }
84 }
76 }
85 }
77
86
78− onFullscreenChanged: {
87+ onDismissed: {
79− // index 1 because 0 is the PlaceHolder...
88+ if (fullscreenIndex == index) {
80− if (index == 1) {
89+ fullscreenIndex = -1;
81− notificationList.topmostIsFullscreen = fullscreen
90+ notificationList.positionViewAtBeginning();
82 }
91 }
83 }
92 }
84 }
93 }