Changeset View
Changeset View
Standalone View
Standalone View
applets/notifications/package/contents/ui/NotificationPopup.qml
Show First 20 Lines • Show All 83 Lines • ▼ Show 20 Line(s) | 75 | mainItem: KQuickControlsAddons.MouseEventListener { | |||
---|---|---|---|---|---|
84 | 84 | | |||
85 | onClicked: { | 85 | onClicked: { | ||
86 | // the MEL would close the notification before the action button | 86 | // the MEL would close the notification before the action button | ||
87 | // onClicked handler would fire effectively breaking notification actions | 87 | // onClicked handler would fire effectively breaking notification actions | ||
88 | if (notificationItem.pressedAction()) { | 88 | if (notificationItem.pressedAction()) { | ||
89 | return | 89 | return | ||
90 | } | 90 | } | ||
91 | 91 | | |||
92 | if (notificationItem.hasDefaultAction) { | ||||
93 | // the notifications was clicked, trigger the default action if set | ||||
94 | notificationItem.action("default") | ||||
95 | } else { | ||||
92 | closeNotification(notificationProperties.source) | 96 | closeNotification(notificationProperties.source) | ||
93 | // the popup will be closed in response to sourceRemoved | 97 | // the popup will be closed in response to sourceRemoved | ||
94 | } | 98 | } | ||
99 | } | ||||
95 | onContainsMouseChanged: { | 100 | onContainsMouseChanged: { | ||
96 | if (containsMouse) { | 101 | if (containsMouse) { | ||
97 | notificationTimer.stop() | 102 | notificationTimer.stop() | ||
98 | } else if (!containsMouse && visible) { | 103 | } else if (!containsMouse && visible) { | ||
99 | notificationTimer.restart() | 104 | notificationTimer.restart() | ||
100 | } | 105 | } | ||
101 | } | 106 | } | ||
102 | 107 | | |||
Show All 12 Lines | 118 | NotificationItem { | |||
115 | 120 | | |||
116 | summary: notificationProperties.summary || "" | 121 | summary: notificationProperties.summary || "" | ||
117 | body: notificationProperties.body || "" | 122 | body: notificationProperties.body || "" | ||
118 | icon: notificationProperties.appIcon || "" | 123 | icon: notificationProperties.appIcon || "" | ||
119 | image: notificationProperties.image | 124 | image: notificationProperties.image | ||
120 | // explicit true/false or else it complains about assigning undefined to bool | 125 | // explicit true/false or else it complains about assigning undefined to bool | ||
121 | configurable: notificationProperties.configurable && !Settings.isMobile ? true : false | 126 | configurable: notificationProperties.configurable && !Settings.isMobile ? true : false | ||
122 | urls: notificationProperties.urls || [] | 127 | urls: notificationProperties.urls || [] | ||
128 | hasDefaultAction: notificationProperties.hasDefaultAction | ||||
123 | 129 | | |||
124 | width: Math.round(23 * units.gridUnit) | 130 | width: Math.round(23 * units.gridUnit) | ||
125 | maximumTextHeight: theme.mSize(theme.defaultFont).height * 10 | 131 | maximumTextHeight: theme.mSize(theme.defaultFont).height * 10 | ||
126 | 132 | | |||
127 | onClose: { | 133 | onClose: { | ||
128 | closeNotification(notificationProperties.source) | 134 | closeNotification(notificationProperties.source) | ||
129 | // the popup will be closed in response to sourceRemoved | 135 | // the popup will be closed in response to sourceRemoved | ||
130 | } | 136 | } | ||
Show All 16 Lines |