Changeset View
Changeset View
Standalone View
Standalone View
applets/notifications/package/contents/ui/NotificationDelegate.qml
Show All 27 Lines | 27 | PlasmaComponents.ListItem { | |||
---|---|---|---|---|---|
28 | id: notificationItem | 28 | id: notificationItem | ||
29 | width: popupFlickable.width | 29 | width: popupFlickable.width | ||
30 | 30 | | |||
31 | property int layoutSpacing: units.smallSpacing | 31 | property int layoutSpacing: units.smallSpacing | ||
32 | property int toolIconSize: units.iconSizes.smallMedium | 32 | property int toolIconSize: units.iconSizes.smallMedium | ||
33 | 33 | | |||
34 | opacity: 1-Math.abs(x)/width | 34 | opacity: 1-Math.abs(x)/width | ||
35 | 35 | | |||
36 | enabled: true | ||||
37 | checked: notificationItem.containsMouse | ||||
38 | | ||||
36 | Timer { | 39 | Timer { | ||
37 | interval: 10*60*1000 | 40 | interval: 10*60*1000 | ||
38 | repeat: false | 41 | repeat: false | ||
39 | running: !idleTimeSource.idle | 42 | running: !idleTimeSource.idle | ||
40 | onTriggered: { | 43 | onTriggered: { | ||
41 | if (!notificationsModel.inserting) | 44 | if (!notificationsModel.inserting) | ||
42 | notificationsModel.remove(index) | 45 | notificationsModel.remove(index) | ||
43 | } | 46 | } | ||
Show All 17 Lines | 60 | onReleased: { | |||
61 | } else if (notificationItem.x > notificationItem.width/2 ) { | 64 | } else if (notificationItem.x > notificationItem.width/2 ) { | ||
62 | removeAnimation.exitFromRight = true | 65 | removeAnimation.exitFromRight = true | ||
63 | removeAnimation.running = true | 66 | removeAnimation.running = true | ||
64 | } else { | 67 | } else { | ||
65 | resetAnimation.running = true | 68 | resetAnimation.running = true | ||
66 | } | 69 | } | ||
67 | } | 70 | } | ||
68 | 71 | | |||
72 | onClicked: { | ||||
73 | if (model.hasDefaultAction) { | ||||
74 | executeAction(model.source, "default") | ||||
75 | } else { | ||||
76 | notification.close(); | ||||
77 | } | ||||
78 | } | ||||
79 | | ||||
69 | SequentialAnimation { | 80 | SequentialAnimation { | ||
70 | id: removeAnimation | 81 | id: removeAnimation | ||
71 | property bool exitFromRight: true | 82 | property bool exitFromRight: true | ||
72 | NumberAnimation { | 83 | NumberAnimation { | ||
73 | target: notificationItem | 84 | target: notificationItem | ||
74 | properties: "x" | 85 | properties: "x" | ||
75 | to: removeAnimation.exitFromRight ? notificationItem.width-1 : 1-notificationItem.width | 86 | to: removeAnimation.exitFromRight ? notificationItem.width-1 : 1-notificationItem.width | ||
76 | duration: units.longDuration | 87 | duration: units.longDuration | ||
▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Line(s) | 146 | } else { | |||
137 | notificationsModel.remove(index) | 148 | notificationsModel.remove(index) | ||
138 | } | 149 | } | ||
139 | } | 150 | } | ||
140 | onConfigure: { | 151 | onConfigure: { | ||
141 | plasmoid.expanded = false | 152 | plasmoid.expanded = false | ||
142 | configureNotification(model.appRealName, model.eventId) | 153 | configureNotification(model.appRealName, model.eventId) | ||
143 | } | 154 | } | ||
144 | onAction: { | 155 | onAction: { | ||
145 | executeAction(source, actionId) | 156 | executeAction(model.source, actionId) | ||
146 | actions.clear() | 157 | actions.clear() | ||
147 | } | 158 | } | ||
148 | onOpenUrl: { | 159 | onOpenUrl: { | ||
149 | plasmoid.expanded = false | 160 | plasmoid.expanded = false | ||
150 | Qt.openUrlExternally(url) | 161 | Qt.openUrlExternally(url) | ||
151 | } | 162 | } | ||
152 | } | 163 | } | ||
153 | 164 | | |||
Show All 9 Lines |