Changeset View
Changeset View
Standalone View
Standalone View
applets/notifications/package/contents/ui/NotificationHeader.qml
Show All 24 Lines | |||||
25 | import org.kde.plasma.core 2.0 as PlasmaCore | 25 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
26 | import org.kde.plasma.components 2.0 as PlasmaComponents | 26 | import org.kde.plasma.components 2.0 as PlasmaComponents | ||
27 | import org.kde.plasma.extras 2.0 as PlasmaExtras | 27 | import org.kde.plasma.extras 2.0 as PlasmaExtras | ||
28 | 28 | | |||
29 | import org.kde.notificationmanager 1.0 as NotificationManager | 29 | import org.kde.notificationmanager 1.0 as NotificationManager | ||
30 | 30 | | |||
31 | import org.kde.kcoreaddons 1.0 as KCoreAddons | 31 | import org.kde.kcoreaddons 1.0 as KCoreAddons | ||
32 | 32 | | |||
33 | import org.kde.quickcharts 1.0 as Charts | ||||
34 | | ||||
33 | import "global" | 35 | import "global" | ||
34 | 36 | | |||
35 | RowLayout { | 37 | RowLayout { | ||
36 | id: notificationHeading | 38 | id: notificationHeading | ||
37 | property bool inGroup | 39 | property bool inGroup | ||
38 | property int notificationType | 40 | property int notificationType | ||
39 | 41 | | |||
40 | property var applicationIconSource | 42 | property var applicationIconSource | ||
41 | property string applicationName | 43 | property string applicationName | ||
42 | property string originName | 44 | property string originName | ||
43 | 45 | | |||
44 | property string configureActionLabel | 46 | property string configureActionLabel | ||
45 | 47 | | |||
46 | property alias configurable: configureButton.visible | 48 | property alias configurable: configureButton.visible | ||
47 | property alias dismissable: dismissButton.visible | 49 | property alias dismissable: dismissButton.visible | ||
48 | property bool dismissed | 50 | property bool dismissed | ||
49 | property alias closeButtonTooltip: closeButton.tooltip | 51 | property alias closeButtonTooltip: closeButton.tooltip | ||
50 | property alias closable: closeButton.visible | 52 | property alias closable: closeButton.visible | ||
51 | 53 | | |||
52 | property var time | 54 | property var time | ||
53 | 55 | | |||
54 | property int jobState | 56 | property int jobState | ||
55 | property QtObject jobDetails | 57 | property QtObject jobDetails | ||
56 | 58 | | |||
59 | property real timeout: 5000 | ||||
60 | property real remainingTime: 0 | ||||
61 | | ||||
57 | signal configureClicked | 62 | signal configureClicked | ||
58 | signal dismissClicked | 63 | signal dismissClicked | ||
59 | signal closeClicked | 64 | signal closeClicked | ||
60 | 65 | | |||
61 | // notification created/updated time changed | 66 | // notification created/updated time changed | ||
62 | onTimeChanged: updateAgoText() | 67 | onTimeChanged: updateAgoText() | ||
63 | 68 | | |||
64 | function updateAgoText() { | 69 | function updateAgoText() { | ||
▲ Show 20 Lines • Show All 128 Lines • ▼ Show 20 Line(s) | 193 | PlasmaComponents.ToolButton { | |||
193 | iconSource: notificationHeading.dismissed ? "window-restore" : "window-minimize" | 198 | iconSource: notificationHeading.dismissed ? "window-restore" : "window-minimize" | ||
194 | visible: false | 199 | visible: false | ||
195 | onClicked: notificationHeading.dismissClicked() | 200 | onClicked: notificationHeading.dismissClicked() | ||
196 | } | 201 | } | ||
197 | 202 | | |||
198 | PlasmaComponents.ToolButton { | 203 | PlasmaComponents.ToolButton { | ||
199 | id: closeButton | 204 | id: closeButton | ||
200 | tooltip: i18nd("plasma_applet_org.kde.plasma.notifications", "Close") | 205 | tooltip: i18nd("plasma_applet_org.kde.plasma.notifications", "Close") | ||
201 | iconSource: "window-close" | | |||
202 | visible: false | 206 | visible: false | ||
203 | onClicked: notificationHeading.closeClicked() | 207 | onClicked: notificationHeading.closeClicked() | ||
208 | | ||||
209 | PlasmaCore.IconItem { | ||||
210 | anchors.fill: parent | ||||
211 | anchors.margins: units.smallSpacing + units.devicePixelRatio * 2 | ||||
212 | source: "window-close" | ||||
213 | roundToIconSize: false | ||||
214 | active: closeButton.hovered | ||||
215 | | ||||
216 | Charts.PieChart { | ||||
217 | anchors.fill: parent | ||||
218 | anchors.margins: -units.devicePixelRatio | ||||
219 | | ||||
220 | opacity: notificationHeading.remainingTime > 0 && notificationHeading.remainingTime < notificationHeading.timeout | ||||
ngraham: explicitly set to 0 and 1 rather than relying on implicit type conversion | |||||
221 | Behavior on opacity { | ||||
222 | NumberAnimation { duration: units.longDuration } | ||||
223 | } | ||||
224 | | ||||
225 | range { from: 0; to: notificationHeading.timeout; automatic: false } | ||||
226 | | ||||
227 | valueSources: Charts.SingleValueSource { value: notificationHeading.timeout - notificationHeading.remainingTime } | ||||
228 | colorSource: Charts.SingleValueSource { value: "transparent" } | ||||
229 | | ||||
230 | backgroundColor: theme.highlightColor | ||||
231 | | ||||
232 | thickness: units.devicePixelRatio * 5 | ||||
233 | } | ||||
234 | } | ||||
204 | } | 235 | } | ||
205 | } | 236 | } | ||
206 | 237 | | |||
207 | states: [ | 238 | states: [ | ||
208 | State { | 239 | State { | ||
209 | when: notificationHeading.inGroup | 240 | when: notificationHeading.inGroup | ||
210 | PropertyChanges { | 241 | PropertyChanges { | ||
211 | target: applicationIconItem | 242 | target: applicationIconItem | ||
Show All 10 Lines |
explicitly set to 0 and 1 rather than relying on implicit type conversion