Lines 44-50
PlasmaExtras.ExpandableListItem {
Link Here
|
44 |
readonly property double totalSpace: sdSource.data[udi] && sdSource.data[udi]["Size"] ? sdSource.data[udi]["Size"] : -1.0 |
44 |
readonly property double totalSpace: sdSource.data[udi] && sdSource.data[udi]["Size"] ? sdSource.data[udi]["Size"] : -1.0 |
45 |
property bool freeSpaceKnown: freeSpace > 0 && totalSpace > 0 |
45 |
property bool freeSpaceKnown: freeSpace > 0 && totalSpace > 0 |
46 |
|
46 |
|
47 |
readonly property bool isRootVolume: (sdSource.data[udi] != undefined && sdSource.data[udi]["File Path"]) ? sdSource.data[udi]["File Path"] == "/" : false |
47 |
readonly property bool isRootVolume: sdSource.data[udi] && sdSource.data[udi]["File Path"] ? sdSource.data[udi]["File Path"] == "/" : false |
|
|
48 |
readonly property bool isRemovable: sdSource.data[udi] && sdSource.data[udi]["Removable"] ? sdSource.data[udi]["Removable"] : false |
48 |
|
49 |
|
49 |
onOperationResultChanged: { |
50 |
onOperationResultChanged: { |
50 |
if (!popupIconTimer.running) { |
51 |
if (!popupIconTimer.running) { |
Lines 123-129
PlasmaExtras.ExpandableListItem {
Link Here
|
123 |
var operationName |
124 |
var operationName |
124 |
var operation |
125 |
var operation |
125 |
var wasMounted = isMounted; |
126 |
var wasMounted = isMounted; |
126 |
if (!sdSource.data[udi].Removable || !isMounted) { |
127 |
if (!isRemovable || !isMounted) { |
127 |
service = hpSource.serviceForSource(udi); |
128 |
service = hpSource.serviceForSource(udi); |
128 |
operation = service.operationDescription('invokeAction'); |
129 |
operation = service.operationDescription('invokeAction'); |
129 |
operation.predicate = "test-predicate-openinwindow.desktop"; |
130 |
operation.predicate = "test-predicate-openinwindow.desktop"; |
Lines 140-165
PlasmaExtras.ExpandableListItem {
Link Here
|
140 |
|
141 |
|
141 |
// When there's no better icon available, show a placeholder icon instead |
142 |
// When there's no better icon available, show a placeholder icon instead |
142 |
// of nothing |
143 |
// of nothing |
143 |
icon: sdSource.data[udi] == undefined ? "device-notifier" : sdSource.data[udi].Icon |
144 |
icon: sdSource.data[udi] ? sdSource.data[udi].Icon : "device-notifier" |
144 |
|
145 |
|
145 |
iconEmblem: { |
146 |
iconEmblem: { |
146 |
if (sdSource.data[udi] != undefined) { |
147 |
if (deviceItem.hasMessage) { |
147 |
if (deviceItem.hasMessage) { |
148 |
if (deviceItem.message.solidError === 0) { |
148 |
if (deviceItem.message.solidError === 0) { |
149 |
return "emblem-information" |
149 |
return "emblem-information" |
|
|
150 |
} else { |
151 |
return "emblem-error" |
152 |
} |
153 |
} else if (deviceItem.state == 0 && Emblems && Emblems[0]) { |
154 |
return Emblems[0] |
155 |
} else { |
150 |
} else { |
156 |
return "" |
151 |
return "emblem-error" |
157 |
} |
152 |
} |
|
|
153 |
} else if (deviceItem.state == 0 && Emblems && Emblems[0]) { |
154 |
return Emblems[0] |
155 |
} else { |
156 |
return "" |
158 |
} |
157 |
} |
159 |
return "" |
|
|
160 |
} |
158 |
} |
161 |
|
159 |
|
162 |
title: sdSource.data[udi] == undefined ? "" : sdSource.data[udi].Description |
160 |
title: sdSource.data[udi] ? sdSource.data[udi].Description : "" |
163 |
|
161 |
|
164 |
subtitle: { |
162 |
subtitle: { |
165 |
if (deviceItem.hasMessage) { |
163 |
if (deviceItem.hasMessage) { |
Lines 196-210
PlasmaExtras.ExpandableListItem {
Link Here
|
196 |
|
194 |
|
197 |
defaultActionButtonAction: QQC2.Action { |
195 |
defaultActionButtonAction: QQC2.Action { |
198 |
icon.name: { |
196 |
icon.name: { |
199 |
if (!(sdSource.data[udi] != undefined && sdSource.data[udi].Removable)) { |
197 |
if (isRemovable) { |
200 |
return "document-open-folder" |
|
|
201 |
} else { |
202 |
return isMounted ? "media-eject" : "document-open-folder" |
198 |
return isMounted ? "media-eject" : "document-open-folder" |
|
|
199 |
} else { |
200 |
return "document-open-folder" |
203 |
} |
201 |
} |
204 |
} |
202 |
} |
205 |
text: { |
203 |
text: { |
206 |
// It's possible for the root volume to be on a removable disk |
204 |
// It's possible for the root volume to be on a removable disk |
207 |
if (!(sdSource.data[udi] != undefined && sdSource.data[udi].Removable) || deviceItem.isRootVolume) { |
205 |
if (!isRemovable || isRootVolume) { |
208 |
return i18n("Open in File Manager") |
206 |
return i18n("Open in File Manager") |
209 |
} else { |
207 |
} else { |
210 |
var types = model["Device Types"]; |
208 |
var types = model["Device Types"]; |
Lines 236-242
PlasmaExtras.ExpandableListItem {
Link Here
|
236 |
if (modelData.predicate != "test-predicate-openinwindow.desktop") { |
234 |
if (modelData.predicate != "test-predicate-openinwindow.desktop") { |
237 |
return true; |
235 |
return true; |
238 |
} |
236 |
} |
239 |
return sdSource.data[udi].Removable && deviceItem.isMounted; |
237 |
return deviceItem.isRemovable && deviceItem.isMounted; |
240 |
} |
238 |
} |
241 |
onTriggered: { |
239 |
onTriggered: { |
242 |
var service = hpSource.serviceForSource(udi); |
240 |
var service = hpSource.serviceForSource(udi); |
Lines 257-263
PlasmaExtras.ExpandableListItem {
Link Here
|
257 |
icon.name: "media-mount" |
255 |
icon.name: "media-mount" |
258 |
|
256 |
|
259 |
// Only show for unmounted removable devices |
257 |
// Only show for unmounted removable devices |
260 |
enabled: (sdSource.data[udi] != undefined && sdSource.data[udi].Removable) && !deviceItem.isMounted |
258 |
enabled: deviceItem.isRemovable && !deviceItem.isMounted |
261 |
|
259 |
|
262 |
onTriggered: { |
260 |
onTriggered: { |
263 |
var service = sdSource.serviceForSource(udi); |
261 |
var service = sdSource.serviceForSource(udi); |
264 |
- |
|
|