Changeset View
Changeset View
Standalone View
Standalone View
applets/notifications/package/contents/ui/NotificationDelegate.qml
Show All 22 Lines | |||||
23 | import org.kde.plasma.components 2.0 as PlasmaComponents | 23 | import org.kde.plasma.components 2.0 as PlasmaComponents | ||
24 | import org.kde.plasma.extras 2.0 as PlasmaExtras | 24 | import org.kde.plasma.extras 2.0 as PlasmaExtras | ||
25 | import org.kde.kquickcontrolsaddons 2.0 | 25 | import org.kde.kquickcontrolsaddons 2.0 | ||
26 | 26 | | |||
27 | PlasmaComponents.ListItem { | 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 | | |||
32 | property int toolIconSize: units.iconSizes.smallMedium | | |||
albertvaka: toolIconSize property is used here: plasma… | |||||
33 | | ||||
34 | opacity: 1-Math.abs(x)/width | 31 | opacity: 1-Math.abs(x)/width | ||
35 | 32 | | |||
36 | enabled: true | | |||
37 | checked: notificationItem.containsMouse | | |||
albertvaka: This was there so they highlight on hover. Is it not needed anymore? | |||||
Earlier Plasma decided this isn't how we display mouse hover. apol: Earlier Plasma decided this isn't how we display mouse hover.
https://phabricator.kde.org/D4214
| |||||
38 | | ||||
39 | Timer { | 33 | Timer { | ||
40 | interval: 10*60*1000 | 34 | interval: 10*60*1000 | ||
41 | repeat: false | 35 | repeat: false | ||
42 | running: !idleTimeSource.idle | 36 | running: !idleTimeSource.idle | ||
43 | onTriggered: { | 37 | onTriggered: { | ||
44 | if (!notificationsModel.inserting) | 38 | if (!notificationsModel.inserting) | ||
45 | notificationsModel.remove(index) | 39 | notificationsModel.remove(index) | ||
46 | } | 40 | } | ||
47 | } | 41 | } | ||
48 | 42 | | |||
49 | MouseArea { | 43 | MouseArea { | ||
50 | width: parent.width | 44 | width: parent.width | ||
51 | height: childrenRect.height | 45 | height: childrenRect.height | ||
46 | acceptedButtons: Qt.NoButtons | ||||
52 | 47 | | |||
53 | drag { | 48 | drag { | ||
54 | target: notificationItem | 49 | target: notificationItem | ||
55 | axis: Drag.XAxis | 50 | axis: Drag.XAxis | ||
56 | //kind of an hack over Column being too smart | 51 | //kind of an hack over Column being too smart | ||
57 | minimumX: -parent.width + 1 | 52 | minimumX: -parent.width + 1 | ||
58 | maximumX: parent.width - 1 | 53 | maximumX: parent.width - 1 | ||
59 | } | 54 | } | ||
60 | onReleased: { | 55 | onReleased: { | ||
61 | if (notificationItem.x < -notificationItem.width/2) { | 56 | if (notificationItem.x < -notificationItem.width/2) { | ||
62 | removeAnimation.exitFromRight = false | 57 | removeAnimation.exitFromRight = false | ||
63 | removeAnimation.running = true | 58 | removeAnimation.running = true | ||
64 | } else if (notificationItem.x > notificationItem.width/2 ) { | 59 | } else if (notificationItem.x > notificationItem.width/2 ) { | ||
65 | removeAnimation.exitFromRight = true | 60 | removeAnimation.exitFromRight = true | ||
66 | removeAnimation.running = true | 61 | removeAnimation.running = true | ||
67 | } else { | 62 | } else { | ||
68 | resetAnimation.running = true | 63 | resetAnimation.running = true | ||
69 | } | 64 | } | ||
70 | } | 65 | } | ||
71 | 66 | | |||
72 | onClicked: { | | |||
73 | if (model.hasDefaultAction) { | | |||
74 | executeAction(model.source, "default") | | |||
75 | } else { | | |||
76 | notification.close(); | | |||
77 | } | | |||
78 | } | | |||
79 | | ||||
80 | SequentialAnimation { | 67 | SequentialAnimation { | ||
81 | id: removeAnimation | 68 | id: removeAnimation | ||
82 | property bool exitFromRight: true | 69 | property bool exitFromRight: true | ||
83 | NumberAnimation { | 70 | NumberAnimation { | ||
84 | target: notificationItem | 71 | target: notificationItem | ||
85 | properties: "x" | 72 | properties: "x" | ||
86 | to: removeAnimation.exitFromRight ? notificationItem.width-1 : 1-notificationItem.width | 73 | to: removeAnimation.exitFromRight ? notificationItem.width-1 : 1-notificationItem.width | ||
87 | duration: units.longDuration | 74 | duration: units.longDuration | ||
▲ Show 20 Lines • Show All 86 Lines • Show Last 20 Lines |
toolIconSize property is used here: plasma-workspace/applets/notifications/package/contents/ui/Notifications.qml