Changeset View
Changeset View
Standalone View
Standalone View
applets/notifications/package/contents/ui/NotificationPopup.qml
Show First 20 Lines • Show All 47 Lines • ▼ Show 20 Line(s) | 47 | onYChanged: { | |||
---|---|---|---|---|---|
48 | if (visible) { | 48 | if (visible) { | ||
49 | notificationTimer.restart(); | 49 | notificationTimer.restart(); | ||
50 | } | 50 | } | ||
51 | } | 51 | } | ||
52 | 52 | | |||
53 | function populatePopup(notification) { | 53 | function populatePopup(notification) { | ||
54 | notificationProperties = notification | 54 | notificationProperties = notification | ||
55 | notificationTimer.interval = notification.expireTimeout | 55 | notificationTimer.interval = notification.expireTimeout | ||
56 | notificationTimer.restart() | 56 | notificationTimer.restart(); | ||
57 | 57 | //temporarly disable height binding, avoids an useless window resize when removing the old actions | |||
58 | heightBinding.when = false; | ||||
58 | // notification.actions is a JS array, but we can easily append that to our model | 59 | // notification.actions is a JS array, but we can easily append that to our model | ||
59 | notificationItem.actions.clear() | 60 | notificationItem.actions.clear() | ||
davidedmundson: So instead of making this inhibitor and changing a bunch of code
just convert:
list.clear()… | |||||
can't do that, as notificationItem.actions is a ListModel and notificationsProperties is a javascript array instead mart: can't do that, as notificationItem.actions is a ListModel and notificationsProperties is a… | |||||
60 | notificationItem.actions.append(notificationProperties.actions) | 61 | notificationItem.actions.append(notificationProperties.actions) | ||
62 | //enable height binding again, finally do the resize | ||||
63 | heightBinding.when = true; | ||||
61 | } | 64 | } | ||
62 | 65 | | |||
63 | function clearPopup() { | 66 | function clearPopup() { | ||
64 | notificationProperties = {} | 67 | notificationProperties = {} | ||
65 | notificationItem.actions.clear() | 68 | notificationItem.actions.clear() | ||
66 | } | 69 | } | ||
67 | 70 | | |||
68 | Behavior on y { | | |||
69 | NumberAnimation { | | |||
70 | duration: units.longDuration | | |||
71 | easing.type: Easing.OutQuad | | |||
72 | } | | |||
73 | } | | |||
74 | | ||||
75 | mainItem: NotificationItem { | 71 | mainItem: NotificationItem { | ||
76 | id: notificationItem | 72 | id: notificationItem | ||
77 | hoverEnabled: true | 73 | hoverEnabled: true | ||
78 | 74 | | |||
79 | LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft | 75 | LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft | ||
80 | LayoutMirroring.childrenInherit: true | 76 | LayoutMirroring.childrenInherit: true | ||
81 | 77 | | |||
82 | height: implicitHeight | 78 | //the binding needs to be disabled when re-populating actions, to minimize resizes | ||
79 | Binding on height { | ||||
80 | id: heightBinding | ||||
81 | value: notificationItem.implicitHeight | ||||
82 | when: true | ||||
83 | } | ||||
83 | 84 | | |||
84 | Timer { | 85 | Timer { | ||
85 | id: notificationTimer | 86 | id: notificationTimer | ||
86 | onTriggered: { | 87 | onTriggered: { | ||
87 | if (!notificationProperties.isPersistent) { | 88 | if (!notificationProperties.isPersistent) { | ||
88 | expireNotification(notificationProperties.source) | 89 | expireNotification(notificationProperties.source) | ||
89 | } | 90 | } | ||
90 | notificationPopup.notificationTimeout(); | 91 | notificationPopup.notificationTimeout(); | ||
▲ Show 20 Lines • Show All 48 Lines • Show Last 20 Lines |
So instead of making this inhibitor and changing a bunch of code
just convert:
list.clear()
list.append()
into:
list = otherList