Changeset View
Changeset View
Standalone View
Standalone View
applets/devicenotifier/package/contents/ui/FullRepresentation.qml
Show First 20 Lines • Show All 49 Lines • ▼ Show 20 Line(s) | 32 | MouseArea { | |||
---|---|---|---|---|---|
50 | 50 | | |||
51 | PlasmaCore.DataSource { | 51 | PlasmaCore.DataSource { | ||
52 | id: userActivitySource | 52 | id: userActivitySource | ||
53 | engine: "powermanagement" | 53 | engine: "powermanagement" | ||
54 | connectedSources: "UserActivity" | 54 | connectedSources: "UserActivity" | ||
55 | property int polls: 0 | 55 | property int polls: 0 | ||
56 | //poll only on plasmoid expanded | 56 | //poll only on plasmoid expanded | ||
57 | interval: !fullRep.containsMouse && !fullRep.Window.active && spontaneousOpen && plasmoid.expanded ? 3000 : 0 | 57 | interval: !fullRep.containsMouse && !fullRep.Window.active && spontaneousOpen && plasmoid.expanded ? 3000 : 0 | ||
58 | onIntervalChanged: polls = 0; | 58 | function onIntervalChanged() { polls = 0; } | ||
59 | onDataChanged: { | 59 | function onDataChanged() { | ||
60 | //only do when polling | 60 | //only do when polling | ||
61 | if (interval == 0 || polls++ < 1) { | 61 | if (interval == 0 || polls++ < 1) { | ||
62 | return; | 62 | return; | ||
63 | } | 63 | } | ||
64 | 64 | | |||
65 | if (userActivitySource.data["UserActivity"]["IdleTime"] < interval) { | 65 | if (userActivitySource.data["UserActivity"]["IdleTime"] < interval) { | ||
66 | plasmoid.expanded = false; | 66 | plasmoid.expanded = false; | ||
67 | spontaneousOpen = false; | 67 | spontaneousOpen = false; | ||
Show All 13 Lines | 78 | OpacityAnimator { | |||
81 | from: 1 | 81 | from: 1 | ||
82 | to: 0 | 82 | to: 0 | ||
83 | duration: 3000 | 83 | duration: 3000 | ||
84 | easing.type: Easing.InOutQuad | 84 | easing.type: Easing.InOutQuad | ||
85 | } | 85 | } | ||
86 | 86 | | |||
87 | Connections { | 87 | Connections { | ||
88 | target: statusSource | 88 | target: statusSource | ||
89 | onLastChanged: { | 89 | function onLastChanged() { | ||
90 | if (!statusSource.last) { | 90 | if (!statusSource.last) { | ||
91 | messageHighlightAnimator.stop() | 91 | messageHighlightAnimator.stop() | ||
92 | messageHighlight.visible = false | 92 | messageHighlight.visible = false | ||
93 | } | 93 | } | ||
94 | } | 94 | } | ||
95 | } | 95 | } | ||
96 | 96 | | |||
97 | function highlight(item) { | 97 | function highlight(item) { | ||
98 | parent = item | 98 | parent = item | ||
99 | width = Qt.binding(function() { return item.width }) | 99 | width = Qt.binding(function() { return item.width }) | ||
100 | height = Qt.binding(function() { return item.height }) | 100 | height = Qt.binding(function() { return item.height }) | ||
101 | opacity = 1 // Animator is threaded so the old opacity might be visible for a frame or two | 101 | opacity = 1 // Animator is threaded so the old opacity might be visible for a frame or two | ||
102 | visible = true | 102 | visible = true | ||
103 | messageHighlightAnimator.start() | 103 | messageHighlightAnimator.start() | ||
104 | } | 104 | } | ||
105 | } | 105 | } | ||
106 | 106 | | |||
107 | Connections { | 107 | Connections { | ||
108 | target: plasmoid | 108 | target: plasmoid | ||
109 | onExpandedChanged: { | 109 | function onExpandedChanged() { | ||
110 | if (!plasmoid.expanded) { | 110 | if (!plasmoid.expanded) { | ||
111 | statusSource.clearMessage() | 111 | statusSource.clearMessage() | ||
112 | } | 112 | } | ||
113 | } | 113 | } | ||
114 | } | 114 | } | ||
115 | 115 | | |||
116 | Item { | 116 | Item { | ||
117 | anchors.fill: parent | 117 | anchors.fill: parent | ||
▲ Show 20 Lines • Show All 93 Lines • ▼ Show 20 Line(s) | 171 | DeviceItem { | |||
211 | onActionTriggered: { | 211 | onActionTriggered: { | ||
212 | var operationName = mounted ? "unmount" : "mount"; | 212 | var operationName = mounted ? "unmount" : "mount"; | ||
213 | var service = sdSource.serviceForSource(udi); | 213 | var service = sdSource.serviceForSource(udi); | ||
214 | var operation = service.operationDescription(operationName); | 214 | var operation = service.operationDescription(operationName); | ||
215 | service.startOperationCall(operation); | 215 | service.startOperationCall(operation); | ||
216 | } | 216 | } | ||
217 | property int operationResult: (model["Operation result"]) | 217 | property int operationResult: (model["Operation result"]) | ||
218 | 218 | | |||
219 | onOperationResultChanged: { | 219 | function onOperationResultChanged() { | ||
220 | if (operationResult == 1) { | 220 | if (operationResult == 1) { | ||
221 | devicenotifier.popupIcon = "dialog-ok" | 221 | devicenotifier.popupIcon = "dialog-ok" | ||
222 | popupIconTimer.restart() | 222 | popupIconTimer.restart() | ||
223 | } else if (operationResult == 2) { | 223 | } else if (operationResult == 2) { | ||
224 | devicenotifier.popupIcon = "dialog-error" | 224 | devicenotifier.popupIcon = "dialog-error" | ||
225 | popupIconTimer.restart() | 225 | popupIconTimer.restart() | ||
226 | } | 226 | } | ||
227 | } | 227 | } | ||
228 | Behavior on height { NumberAnimation { duration: units.shortDuration } } | 228 | Behavior on height { NumberAnimation { duration: units.shortDuration } } | ||
229 | } | 229 | } | ||
230 | } | 230 | } | ||
231 | } | 231 | } |