38
39
property bool installAll: false
39
40
property bool includeSystemUpdate: false
41
property bool systemUpdateInProgress: false
40
42
property int updatesAvailable: 0
43
property bool isCharging: false
44
property bool batterySafeForUpdate: isCharging || chargeLevel > 25
45
property var chargeLevel: indicatorPower.batteryLevel || 0
42
46
property var notificationAction;
51
busName: "com.canonical.indicator.power"
52
objectPath: "/com/canonical/indicator/power"
53
property variant batteryLevel: action("battery-level").state
54
Component.onCompleted: start()
63
monitorChargingState: true
65
onChargingStateChanged: {
66
if (state === BatteryInfo.Charging) {
69
else if (state === BatteryInfo.Discharging &&
70
batteryInfo.batteryStatus(0) !== BatteryInfo.BatteryFull) {
73
else if (batteryInfo.batteryStatus(0) === BatteryInfo.BatteryFull ||
74
state === BatteryInfo.NotCharging) {
78
Component.onCompleted: {
79
onChargingStateChanged(0, chargingState(0))
49
84
id: dialogInstallComponent
51
86
id: dialogueInstall
52
87
title: i18n.tr("Update System")
53
text: i18n.tr("The phone needs to restart to install the system update.")
88
text: root.batterySafeForUpdate ? i18n.tr("The phone needs to restart to install the system update.") : i18n.tr("Connect the phone to power before installing the system update.")
56
91
text: i18n.tr("Install & Restart")
92
visible: root.batterySafeForUpdate ? true : false
57
93
color: UbuntuColors.orange
59
95
installingImageUpdate.visible = true;
69
105
var item = updateList.currentItem;
70
106
var modelItem = updateManager.model[0];
71
107
item.actionButton.text = i18n.tr("Install");
108
item.progressBar.opacity = 0;
72
109
modelItem.updateReady = true;
110
modelItem.selected = false;
111
root.systemUpdateInProgress = false;
73
112
PopupUtils.close(dialogueInstall);
145
184
onSystemUpdateDownloaded: {
146
root.updatesAvailable -= 1;
147
PopupUtils.open(dialogInstallComponent);
185
if (!root.systemUpdateInProgress && !installingImageUpdate.visible) {
186
root.systemUpdateInProgress = true;
187
PopupUtils.open(dialogInstallComponent);
150
191
onSystemUpdateFailed: {
248
289
delegate: ListItem.Subtitled {
250
291
iconSource: Qt.resolvedUrl(modelData.iconUrl)
292
iconFrame: modelData.systemUpdate ? false : true
251
293
height: modelData.selected ? units.gu(14) : units.gu(8)
252
294
highlightWhenPressed: false
253
295
showDivider: false
255
297
property alias actionButton: buttonAppUpdate
298
property alias progressBar: progress
294
337
textArea.retry = false;
295
338
updateManager.retryDownload(modelData.packageName);
296
339
} else if (modelData.updateReady) {
297
updateManager.applySystemUpdate();
298
installingImageUpdate.visible = true;
340
PopupUtils.open(dialogInstallComponent);
299
341
} else if (modelData.updateState) {
300
342
if (modelData.systemUpdate) {
301
343
updateManager.pauseDownload(modelData.packageName);