on xenial help sign in
better fix for handling the fullscreen state
commitee4ed431dfc6bb4cc7d5c96ce9bf02f452abbc86 authorLukáš Tinkl <lukas.tinkl@canonical.com> dateWed 18 May 2016, 20:14 (10 years ago) parent4ea89d8
3 files changed+24−9
qml/Notifications/Notification.qml+5 qml/Notifications/NotificationMenuItemFactory.qml+3 qml/Notifications/Notifications.qml+16−9
qml/Notifications/Notification.qml+5
@@ -55,6 +55,8 @@ StyledItem {
5555 name: "Ubuntu.Components.Themes.Ambiance"
5656 }
5757
58+ signal dismissed()
59+
5860 readonly property bool expanded: {
5961 var result = false;
6062
@@ -107,6 +109,7 @@ StyledItem {
107109 notification.notification.invokeAction(notification.actions.data(1, ActionModel.RoleActionId));
108110
109111 notification.notification.close();
112+ notification.dismissed()
110113 }
111114
112115 Behavior on x {
@@ -198,6 +201,7 @@ StyledItem {
198201 onNameOwnerChanged: {
199202 if (lastNameOwner !== "" && nameOwner === "" && notification.notification !== undefined) {
200203 notification.notification.close()
204+ notification.dismissed()
201205 }
202206 lastNameOwner = nameOwner
203207 }
@@ -423,6 +427,7 @@ StyledItem {
423427 }
424428 onAccepted: {
425429 notification.notification.invokeAction(actionRepeater.itemAt(0).actionId)
430+ notification.dismissed()
426431 }
427432 }
428433 }
qml/Notifications/NotificationMenuItemFactory.qml+3
@@ -150,15 +150,18 @@ Loader {
150150 onEntered: {
151151 menuModel.changeState(menuIndex, passphrase);
152152 clear(false);
153+ notification.dismissed()
153154 }
154155
155156 onCancel: {
156157 menuModel.activate(menuIndex, false);
158+ notification.dismissed()
157159 }
158160
159161 onEmergencyCall: {
160162 shell.startLockedApp("dialer-app");
161163 menuModel.activate(menuIndex, false);
164+ notification.dismissed()
162165 }
163166
164167 property var extendedData: menuData && menuData.ext || undefined
qml/Notifications/Notifications.qml+16−9
@@ -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,18 +76,18 @@ ListView {
6976 // FIXME: disabled all transitions because of LP: #1354406 workaround
7077 //layer.enabled: add.running || remove.running || populate.running
7178
72− readonly property int theIndex: index
73− onTheIndexChanged: updateListTopMostIsFullscreen();
74− Component.onCompleted: updateListTopMostIsFullscreen();
7579 onFullscreenChanged: updateListTopMostIsFullscreen();
7680
7781 function updateListTopMostIsFullscreen() {
78− if (fullscreen) { // effectively hide any non-fullscreen snaps
79− notificationList.positionViewAtIndex(index, ListView.Beginning);
82+ if (fullscreen) {
83+ fullscreenIndex = index;
8084 }
81− // index 1 because 0 is the PlaceHolder...
82− if (index == 1) {
83− notificationList.topmostIsFullscreen = fullscreen
85+ }
86+
87+ onDismissed: {
88+ if (fullscreenIndex == index) {
89+ fullscreenIndex = -1;
90+ notificationList.positionViewAtBeginning();
8491 }
8592 }
8693 }