on xenial help sign in
Fullscreen notification bug fixes Fixes: #1422711, #1581498, #1583944

Approved by: Michael Zanetti

commiteabd11b6e81d6e6031dda7fdb02ed5c4261bc7b4 authorLukáš Tinkl <lukas.tinkl@canonical.com> dateFri 27 May 2016, 13:53 (10 years ago) parent81124b8ee4ed43
3 files changed+37−14
qml/Notifications/Notification.qml+17−6 qml/Notifications/NotificationMenuItemFactory.qml+3 qml/Notifications/Notifications.qml+17−8
qml/Notifications/Notification.qml+17−6
@@ -55,11 +55,13 @@ StyledItem {
5555 name: "Ubuntu.Components.Themes.Ambiance"
5656 }
5757
58+ signal dismissed()
59+
5860 readonly property bool expanded: {
5961 var result = false;
6062
6163 if (type === Notification.SnapDecision) {
62− if (ListView.view.currentIndex === index) {
64+ if (ListView.view.currentIndex === index || fullscreen) {
6365 result = true;
6466 } else {
6567 if (ListView.view.count > 2) {
@@ -103,10 +105,11 @@ StyledItem {
103105 ListView.view.currentIndex = -1;
104106 }
105107
106− if (notification.actions.count > 1) { // perform the "reject" action
107− notification.notification.invokeAction(notification.actions.data(1, ActionModel.RoleActionId));
108− }
108+ // perform the "reject" action
109+ notification.notification.invokeAction(notification.actions.data(1, ActionModel.RoleActionId));
110+
109111 notification.notification.close();
112+ notification.dismissed()
110113 }
111114
112115 Behavior on x {
@@ -119,6 +122,12 @@ StyledItem {
119122 }
120123 }
121124
125+ onFullscreenChanged: {
126+ if (fullscreen) {
127+ notification.notification.urgency = Notification.Critical;
128+ }
129+ }
130+
122131 Behavior on height {
123132 UbuntuNumberAnimation {
124133 duration: UbuntuAnimation.SnapDuration
@@ -192,6 +201,7 @@ StyledItem {
192201 onNameOwnerChanged: {
193202 if (lastNameOwner !== "" && nameOwner === "" && notification.notification !== undefined) {
194203 notification.notification.close()
204+ notification.dismissed()
195205 }
196206 lastNameOwner = nameOwner
197207 }
@@ -203,7 +213,7 @@ StyledItem {
203213 anchors.fill: parent
204214 objectName: "interactiveArea"
205215
206− drag.target: notification
216+ drag.target: !fullscreen ? notification : undefined
207217 drag.axis: Drag.XAxis
208218 drag.minimumX: -notification.width
209219 drag.maximumX: notification.width
@@ -386,7 +396,7 @@ StyledItem {
386396 objectName: "dialogListView"
387397 spacing: notification.margins
388398
389− visible: count > 0 && notification.expanded
399+ visible: count > 0 && (notification.expanded || notification.fullscreen)
390400
391401 anchors {
392402 left: parent.left
@@ -417,6 +427,7 @@ StyledItem {
417427 }
418428 onAccepted: {
419429 notification.notification.invokeAction(actionRepeater.itemAt(0).actionId)
430+ notification.dismissed()
420431 }
421432 }
422433 }
qml/Notifications/NotificationMenuItemFactory.qml+3
@@ -151,15 +151,18 @@ Loader {
151151 onEntered: {
152152 menuModel.changeState(menuIndex, passphrase);
153153 clear(false);
154+ notification.dismissed()
154155 }
155156
156157 onCancel: {
157158 menuModel.activate(menuIndex, false);
159+ notification.dismissed()
158160 }
159161
160162 onEmergencyCall: {
161163 shell.startLockedApp("dialer-app");
162164 menuModel.activate(menuIndex, false);
165+ notification.dismissed()
163166 }
164167
165168 property var extendedData: menuData && menuData.ext || undefined
qml/Notifications/Notifications.qml+17−8
@@ -41,11 +41,18 @@ ListView {
4141 filterRegExp: RegExp(UnityNotifications.Notification.SnapDecision)
4242 }
4343
44− property bool topmostIsFullscreen: false
44+ readonly property bool topmostIsFullscreen: fullscreenIndex != -1
4545 spacing: topmostIsFullscreen ? 0 : units.gu(1)
4646
4747 currentIndex: count > 1 ? 1 : -1
4848
49+ property int fullscreenIndex: -1
50+ onFullscreenIndexChanged: {
51+ if (fullscreenIndex != -1) {
52+ positionViewAtIndex(fullscreenIndex, ListView.Beginning);
53+ }
54+ }
55+
4956 delegate: Notification {
5057 objectName: "notification" + index
5158 width: parent.width
@@ -69,16 +76,18 @@ ListView {
6976 // FIXME: disabled all transitions because of LP: #1354406 workaround
7077 //layer.enabled: add.running || remove.running || populate.running
7178
72− Component.onCompleted: {
73− if (index == 1) {
74− notificationList.topmostIsFullscreen = fullscreen
79+ onFullscreenChanged: updateListTopMostIsFullscreen();
80+
81+ function updateListTopMostIsFullscreen() {
82+ if (fullscreen) {
83+ fullscreenIndex = index;
7584 }
7685 }
7786
78− onFullscreenChanged: {
79− // index 1 because 0 is the PlaceHolder...
80− if (index == 1) {
81− notificationList.topmostIsFullscreen = fullscreen
87+ onDismissed: {
88+ if (fullscreenIndex == index) {
89+ fullscreenIndex = -1;
90+ notificationList.positionViewAtBeginning();
8291 }
8392 }
8493 }