Changeset View
Changeset View
Standalone View
Standalone View
applets/devicenotifier/package/contents/ui/FullRepresentation.qml
Show First 20 Lines • Show All 152 Lines • ▼ Show 20 Line(s) | 32 | MouseArea { | |||
---|---|---|---|---|---|
153 | } | 153 | } | ||
154 | 154 | | |||
155 | Component { | 155 | Component { | ||
156 | id: deviceItem | 156 | id: deviceItem | ||
157 | 157 | | |||
158 | DeviceItem { | 158 | DeviceItem { | ||
159 | width: notifierDialog.width | 159 | width: notifierDialog.width | ||
160 | udi: DataEngineSource | 160 | udi: DataEngineSource | ||
161 | icon: sdSource.data[udi].Icon | 161 | icon: sdSource.data[udi] ? sdSource.data[udi].Icon : "" | ||
162 | deviceName: sdSource.data[udi].Description | 162 | deviceName: sdSource.data[udi] ? sdSource.data[udi].Description : "" | ||
163 | emblemIcon: Emblems[0] | 163 | emblemIcon: Emblems && Emblems[0] ? Emblems[0] : "" | ||
164 | state: sdSource.data[udi].State | 164 | state: sdSource.data[udi] ? sdSource.data[udi].State : 0 | ||
165 | 165 | | |||
166 | percentUsage: { | 166 | percentUsage: { | ||
167 | if (!sdSource.data[udi]) { | 167 | if (!sdSource.data[udi]) { | ||
168 | return 0 | 168 | return 0 | ||
169 | } | 169 | } | ||
170 | var freeSpace = new Number(sdSource.data[udi]["Free Space"]); | 170 | var freeSpace = new Number(sdSource.data[udi]["Free Space"]); | ||
171 | var size = new Number(sdSource.data[udi]["Size"]); | 171 | var size = new Number(sdSource.data[udi]["Size"]); | ||
172 | var used = size-freeSpace; | 172 | var used = size-freeSpace; | ||
173 | return used*100/size; | 173 | return used*100/size; | ||
174 | } | 174 | } | ||
175 | freeSpaceText: sdSource.data[udi] && sdSource.data[udi]["Free Space Text"] ? sdSource.data[udi]["Free Space Text"] : "" | 175 | freeSpaceText: sdSource.data[udi] && sdSource.data[udi]["Free Space Text"] ? sdSource.data[udi]["Free Space Text"] : "" | ||
176 | 176 | | |||
177 | actionIcon: mounted ? "media-eject" : "media-mount" | 177 | actionIcon: mounted ? "media-eject" : "media-mount" | ||
178 | actionVisible: model["Device Types"].indexOf("Portable Media Player") == -1 | 178 | actionVisible: model["Device Types"].indexOf("Portable Media Player") == -1 | ||
179 | actionToolTip: { | 179 | actionToolTip: { | ||
180 | var types = model["Device Types"]; | ||||
ngraham: Indentation | |||||
bruns: irks, tabs ... | |||||
180 | if (!mounted) { | 181 | if (!mounted) { | ||
181 | return i18n("Click to access this device from other applications.") | 182 | return i18n("Click to access this device from other applications.") | ||
182 | } else if (model["Device Types"].indexOf("OpticalDisc") != -1) { | 183 | } else if (types && types.indexOf("OpticalDisc") != -1) { | ||
183 | return i18n("Click to eject this disc.") | 184 | return i18n("Click to eject this disc.") | ||
184 | } else { | 185 | } else { | ||
185 | return i18n("Click to safely remove this device.") | 186 | return i18n("Click to safely remove this device.") | ||
186 | } | 187 | } | ||
187 | } | 188 | } | ||
188 | mounted: devicenotifier.isMounted(udi) | 189 | mounted: devicenotifier.isMounted(udi) | ||
189 | 190 | | |||
190 | onActionTriggered: { | 191 | onActionTriggered: { | ||
Show All 20 Lines |
Indentation