on xenial help sign in
clean up fullscreen notifications code.

Approved by PS Jenkins bot, Michał Sawicz.

commitf9aeabeaad996c52aed3ce603c365731faacd6c2 authorMichael Zanetti <michael.zanetti@canonical.com> dateMon 23 Dec 2013, 12:26 (13 years ago) parenta4d04ad498ef95
5 files changed+14−10
qml/Notifications/Notification.qml+9−2 qml/Notifications/NotificationMenuItemFactory.qml+3−5 qml/Notifications/Notifications.qml+2−1 qml/Shell.qml−1 tests/qmltests/Notifications/tst_Notifications.qml−1
qml/Notifications/Notification.qml+9−2
@@ -34,10 +34,12 @@ Item {
3434 property var notification
3535 property color color
3636 property bool fullscreen
37+ property int maxHeight
38+ property int margins
3739
3840 fullscreen: false
3941 objectName: "background"
40− implicitHeight: type != Notification.PlaceHolder ? (fullscreen ? notificationList.fullHeight : contentColumn.height + contentColumn.spacing * 4) : 0
42+ implicitHeight: type !== Notification.PlaceHolder ? (fullscreen ? maxHeight : contentColumn.height + contentColumn.spacing * 4) : 0
4143
4244 color: Qt.rgba(0.132, 0.117, 0.109, 0.97)
4345 opacity: 0
@@ -50,7 +52,7 @@ Item {
5052
5153 visible: !fullscreen
5254 anchors.fill: parent
53− anchors.margins: notificationList.margin
55+ anchors.margins: notification.margins
5456 color: parent.color
5557 opacity: parent.opacity
5658 radius: "medium"
@@ -207,6 +209,11 @@ Item {
207209 menuModel: unityMenuModel
208210 menuData: model
209211 menuIndex: index
212+ maxHeight: notification.maxHeight
213+
214+ onLoaded: {
215+ notification.fullscreen = Qt.binding(function() { return fullscreen; });
216+ }
210217 }
211218 }
212219 }
qml/Notifications/NotificationMenuItemFactory.qml+3−5
@@ -28,6 +28,8 @@ Loader {
2828 property QtObject menuModel: null
2929 property QtObject menuData: null
3030 property int menuIndex
31+ property int maxHeight
32+ readonly property bool fullscreen: menuData.type === "com.canonical.snapdecision.pinlock"
3133
3234 property var _map: {
3335 "com.canonical.snapdecision.textfield": textfield,
@@ -43,10 +45,6 @@ Loader {
4345 }
4446 }
4547
46− Component.onCompleted: {
47− notification.fullscreen = menuData.type == "com.canonical.snapdecision.pinlock"
48− }
49−
5048 Component {
5149 id: textfield
5250
@@ -101,7 +99,7 @@ Loader {
10199
102100 Lockscreen {
103101 anchors.left: parent.left; anchors.right: parent.right
104− height: notificationList.fullHeight
102+ height: menuFactory.maxHeight
105103 placeholderText: i18n.tr("Please enter SIM PIN")
106104 background: shell.background
107105
qml/Notifications/Notifications.qml+2−1
@@ -25,7 +25,6 @@ ListView {
2525 interactive: false
2626
2727 property real margin
28− property real fullHeight
2928
3029 delegate: Notification {
3130 objectName: "notification" + index
@@ -42,6 +41,8 @@ ListView {
4241 actions: model.actions
4342 notificationId: model.id
4443 notification: notificationList.model.getRaw(notificationId)
44+ maxHeight: notificationList.height
45+ margins: notificationList.margin
4546
4647 // make sure there's no opacity-difference between the several
4748 // elements in a notification
qml/Shell.qml−1
@@ -706,7 +706,6 @@ FocusScope {
706706
707707 model: NotificationBackend.Model
708708 margin: units.gu(1)
709− fullHeight: parent.height - panel.panelHeight
710709
711710 anchors {
712711 top: parent.top
tests/qmltests/Notifications/tst_Notifications.qml−1
@@ -141,7 +141,6 @@ Row {
141141 id: notifications
142142
143143 margin: units.gu(1)
144− fullHeight: parent.height
145144
146145 anchors.fill: parent
147146 model: mockModel