58
75
busName: "com.canonical.indicator.power"
59
76
objectPath: "/com/canonical/indicator/power"
60
property variant batteryLevel: action("battery-level").state
61
property variant deviceState: action("device-state").state
77
property var batteryLevel: action("battery-level").state || 0
78
property var deviceState: action("device-state").state
62
79
Component.onCompleted: start()
67
target: NetworkingStatus
69
if (NetworkingStatus.online) {
70
activity.running = true;
71
root.state = "SEARCHING";
72
UpdateManager.checkUpdates();
74
activity.running = false;
84
objectName: "uoaConfig"
81
85
applicationId: "ubuntu-system-settings"
82
86
providerId: "ubuntuone"
85
credentialsNotification.visible = false;
86
root.state = "SEARCHING";
87
if (NetworkingStatus.online)
88
UpdateManager.checkUpdates();
93
id: dialogInstallComponent
96
title: i18n.tr("Update System")
97
text: root.batterySafeForUpdate ? i18n.tr("The device needs to restart to install the system update.") : i18n.tr("Connect the device to power before installing the system update.")
100
text: i18n.tr("Restart & Install")
101
visible: root.batterySafeForUpdate ? true : false
102
color: theme.palette.normal.positive
104
installingImageUpdate.visible = true;
105
UpdateManager.applySystemUpdate();
106
PopupUtils.close(dialogueInstall);
110
text: i18n.tr("Cancel")
112
updateList.currentIndex = 0;
113
var item = updateList.currentItem;
114
var modelItem = UpdateManager.model[0];
115
item.actionButton.text = i18n.tr("Install");
116
item.progressBar.opacity = 0;
117
modelItem.updateReady = true;
118
modelItem.selected = false;
119
root.systemUpdateInProgress = false;
120
PopupUtils.close(dialogueInstall);
127
id: dialogErrorComponent
130
title: i18n.tr("Installation failed")
131
text: root.errorDialogText
135
color: theme.palette.normal.positive
137
PopupUtils.close(dialogueError);
147
PropertyChanges { target: installAllButton; visible: false}
148
PropertyChanges { target: checkForUpdatesArea; visible: true}
149
PropertyChanges { target: updateNotification; visible: false}
150
PropertyChanges { target: activity; running: NetworkingStatus.online}
154
PropertyChanges { target: updateNotification; text: i18n.tr("Software is up to date")}
155
PropertyChanges { target: updateNotification; visible: true}
156
PropertyChanges { target: updateList; visible: false}
157
PropertyChanges { target: installAllButton; visible: false}
160
name: "SYSTEMUPDATEFAILED"
161
PropertyChanges { target: installingImageUpdate; visible: false}
162
PropertyChanges { target: installAllButton; visible: false}
163
PropertyChanges { target: checkForUpdatesArea; visible: false}
164
PropertyChanges { target: updateNotification; visible: false}
168
PropertyChanges { target: updateList; visible: true}
169
PropertyChanges { target: installAllButton; visible: root.updatesAvailable > 1}
170
PropertyChanges { target: updateNotification; visible: false}
176
target: UpdateManager
177
objectName: "updateManager"
179
Component.onCompleted: {
180
credentialsNotification.visible = false;
181
root.state = "SEARCHING";
182
if (NetworkingStatus.online)
183
UpdateManager.checkUpdates();
186
onUpdateAvailableFound: {
187
root.updatesAvailable = UpdateManager.model.length;
188
if (root.updatesAvailable > 0)
189
root.includeSystemUpdate = UpdateManager.model[0].systemUpdate
190
root.state = "UPDATE";
191
root.installAll = downloading;
195
if (!credentialsNotification.visible) {
196
root.state = "NOUPDATES";
89
if (reply.errorName) {
90
console.warn('Online Accounts failed:', reply.errorName);
201
checkForUpdatesArea.visible = false;
204
onCredentialsNotFound: {
205
credentialsNotification.visible = true;
208
onCredentialsDeleted: {
209
credentialsNotification.visible = true;
212
onSystemUpdateDownloaded: {
213
root.installAll = false;
214
if (root.includeSystemUpdate)
215
UpdateManager.model[0].status = Update.Downloaded;
218
onSystemUpdateFailed: {
219
root.state = "SYSTEMUPDATEFAILED";
220
root.errorDialogText = i18n.tr("Sorry, the system update failed.");
221
PopupUtils.open(dialogErrorComponent);
224
onUpdateProcessFailed: {
225
root.state = "SYSTEMUPDATEFAILED";
226
root.errorDialogText = i18n.tr("Sorry, the system update failed.");
227
PopupUtils.open(dialogErrorComponent);
231
activity.running = false;
235
activity.running = false;
239
installingImageUpdate.message = i18n.tr("Restarting…");
92
UpdateManager.check(UpdateManager.CheckClick);
93
notauthNotification.enabled = true;
99
updateModel: UpdateManager.model
245
anchors.top: parent.top
246
anchors.left: parent.left
247
anchors.right: parent.right
248
anchors.bottom: configuration.top
250
contentHeight: contentItem.childrenRect.height
251
boundsBehavior: (contentHeight > root.height) ? Flickable.DragAndOvershootBounds : Flickable.StopAtBounds
108
bottom: configuration.top
253
/* Set the direction to workaround https://bugreports.qt-project.org/browse/QTBUG-31905
254
otherwise the UI might end up in a situation where scrolling doesn't work */
111
contentHeight: content.height
112
boundsBehavior: (contentHeight > parent.height) ?
113
Flickable.DragAndOvershootBounds :
114
Flickable.StopAtBounds
255
115
flickableDirection: Flickable.VerticalFlick
119
anchors { left: parent.left; right: parent.right }
124
anchors { left: parent.left; right: parent.right }
126
height: hidden ? 0 : units.gu(8)
128
status: UpdateManager.status
129
batchMode: root.batchMode
130
requireRestart: imageRepeater.count > 0
131
updatesCount: root.updatesCount
133
onStop: UpdateManager.cancel()
136
if (requireRestart) {
137
var popup = PopupUtils.open(
138
Qt.resolvedUrl("ImageUpdatePrompt.qml"), null, {
139
havePowerForUpdate: root.havePower
142
popup.requestSystemUpdate.connect(function () {
150
root.batchMode = true
151
if (requireRestart) {
152
postAllBatchHandler.target = root;
154
postClickBatchHandler.target = root;
263
height: childrenRect.height
266
id: checkForUpdatesArea
267
objectName: "checkForUpdatesArea"
273
running: checkForUpdatesArea.visible
274
visible: activity.running
279
height: parent.height
161
objectName: "overlay"
164
leftMargin: units.gu(2)
166
rightMargin: units.gu(2)
168
visible: placeholder.text
169
color: theme.palette.normal.background
283
text: activity.running ? i18n.tr("Checking for updates…") : i18n.tr("Connect to the Internet to check for updates")
174
objectName: "overlayText"
284
176
verticalAlignment: Text.AlignVCenter
287
left: activity.running ? activity.right : parent.left
290
rightMargin: units.gu(2)
291
leftMargin: units.gu(2)
293
height: parent.height
297
ListItem.SingleControl {
298
height: installAllButton.visible ? units.gu(8) : units.gu(2)
299
highlightWhenPressed: false
302
objectName: "installAllButton"
303
property string primaryText: includeSystemUpdate ?
304
i18n.tr("Install %1 update…", "Install %1 updates…", root.updatesAvailable).arg(root.updatesAvailable) :
305
i18n.tr("Install %1 update", "Install %1 updates", root.updatesAvailable).arg(root.updatesAvailable)
306
property string secondaryText: i18n.tr("Pause All")
307
color: theme.palette.normal.positive
308
text: root.installAll ? secondaryText : primaryText
309
width: parent.width - units.gu(4)
312
for (var i=0; i < updateList.count; i++) {
313
updateList.currentIndex = i;
314
var item = updateList.currentItem;
315
var modelItem = UpdateManager.model[i];
316
if (item.installing || item.installed)
318
console.warn("AllClicked: " + modelItem.updateState + " " + modelItem.updateReady + " " + modelItem.selected);
321
UpdateManager.retryDownload(modelItem.packageName);
324
if (root.installAll && !modelItem.updateReady && modelItem.selected) {
328
console.warn("Past pause");
329
if (!root.installAll && !modelItem.updateReady && modelItem.selected) {
333
console.warn("Past resume");
334
if (!root.installAll && !modelItem.updateState && !modelItem.updateReady && !modelItem.selected) {
338
console.warn("Past start");
340
root.installAll = !root.installAll;
348
objectName: "updateList"
353
model: UpdateManager.model
354
height: childrenRect.height
358
delegate: ListItem.Subtitled {
363
topMargin: units.gu(1)
364
bottomMargin: units.gu(1)
366
iconSource: Qt.resolvedUrl(modelData.iconUrl)
367
iconFrame: modelData.systemUpdate ? false : true
368
height: visible ? textArea.height + units.gu(2) : 0
369
highlightWhenPressed: false
372
opacity: installed ? 0 : 1
373
Behavior on opacity { PropertyAnimation { duration: UbuntuAnimation.SleepyDuration } }
375
property alias actionButton: buttonAppUpdate
376
property alias progressBar: progress
377
property bool installing: !modelData.systemUpdate && (modelData.updateReady || (progressBar.value === progressBar.maximumValue))
378
property bool installed: false
379
property bool retry: false
382
console.warn("PAUSE: " + modelData.packageName);
383
if (modelData.systemUpdate)
384
return UpdateManager.pauseDownload(modelData.packageName);
385
modelData.updateState = false;
390
console.warn("RESUME: " + modelData.packageName);
391
if (modelData.systemUpdate)
392
return UpdateManager.startDownload(modelData.packageName);
393
modelData.updateState = true;
398
console.warn("START: " + modelData.packageName);
399
modelData.selected = true;
400
modelData.updateState = true;
401
UpdateManager.startDownload(modelData.packageName);
404
function forceDownload () {
405
console.warn("FORCE DOWNLOAD: " + modelData.packageName);
406
modelData.selected = true;
407
modelData.updateState = true;
408
UpdateManager.forceAllowGSMDownload(modelData.packageName);
413
objectName: "textArea"
418
spacing: units.gu(0.5)
425
height: buttonAppUpdate.height
429
objectName: "labelTitle"
432
right: buttonAppUpdate.visible ? buttonAppUpdate.left : parent.right
433
verticalCenter: parent.verticalCenter
435
text: modelData.title
437
elide: Text.ElideMiddle
442
objectName: "buttonAppUpdate"
443
anchors.right: parent.right
444
height: labelTitle.height + units.gu(1)
448
return i18n.tr("Retry");
449
if (modelData.systemUpdate) {
450
if (modelData.updateReady) {
451
return i18n.tr("Install…");
452
} else if ((!modelData.updateState && !modelData.selected) || modelData.status === Update.NotStarted) {
453
return i18n.tr("Download");
456
if (modelData.updateState || modelData.status === Update.Downloading) {
457
return i18n.tr("Pause");
458
} else if (modelData.selected) {
459
return i18n.tr("Resume");
461
return i18n.tr("Update");
467
return UpdateManager.retryDownload(modelData.packageName);
469
if (modelData.updateState)
471
if (!modelData.updateState && modelData.selected)
473
if (!modelData.updateState && !modelData.selected && !modelData.updateReady)
475
if (modelData.systemUpdate && modelData.status === Update.NotStarted)
476
return forceDownload();
477
if (modelData.updateReady)
478
PopupUtils.open(dialogInstallComponent);
484
id: labelUpdateStatus
489
height: childrenRect.height
491
opacity: (modelData.updateState && modelData.selected && !modelData.updateReady) || (installing || installed) ? 1 : 0
492
Behavior on opacity { PropertyAnimation { duration: UbuntuAnimation.SleepyDuration } }
494
objectName: "labelUpdateStatus"
495
anchors.left: parent.left
496
anchors.right: updateStatusLabel.left
497
elide: Text.ElideMiddle
501
return modelData.error;
503
return i18n.tr("Installing");
505
return i18n.tr("Installed");
506
return i18n.tr("Downloading");
510
id: updateStatusLabel
511
anchors.right: parent.right
512
visible: !labelSize.visible && !installing && !installed
515
if (!labelUpdateStatus.visible)
516
return Utilities.formatSize(modelData.binaryFilesize);
518
return i18n.tr("%1 of %2").arg(
519
Utilities.formatSize(modelData.binaryFilesize * (progress.value * 0.01))).arg(
520
Utilities.formatSize(modelData.binaryFilesize)
528
objectName: "progress"
535
opacity: modelData.selected && !modelData.updateReady && !installed ? 1 : 0
536
value: modelData.systemUpdate ? modelData.downloadProgress : tracker.progress
542
objectName: "tracker"
543
packageName: modelData.packageName
544
title: modelData.title
545
showInIndicator: false
546
clickToken: modelData.clickToken
547
download: modelData.downloadUrl
548
downloadSha512: modelData.downloadSha512
551
progress.visible = false;
552
buttonAppUpdate.visible = false;
555
root.updatesAvailable -= 1;
556
modelData.updateRequired = false;
557
UpdateManager.updateClickScope();
561
console.warn("onProcessing: " + modelData.packageName + " " + path);
562
buttonAppUpdate.enabled = false;
564
modelData.updateState = false;
568
console.warn("onStarted: " + modelData.packageName + " " + success);
570
modelData.updateState = true;
572
modelData.updateState = false;
576
console.warn("onPaused: " + modelData.packageName + " " + success);
578
modelData.updateState = false;
580
modelData.updateState = true;
584
console.warn("onResumed: " + modelData.packageName + " " + success);
586
modelData.updateState = true;
588
modelData.updateState = false;
592
console.warn("onCanceled: " + modelData.packageName + " " + success);
594
modelData.updateState = false;
595
modelData.selected = false;
600
console.warn("onErrorFound: " + modelData.packageName + " " + error);
601
modelData.updateState = false;
607
Behavior on opacity { PropertyAnimation { duration: UbuntuAnimation.SleepyDuration } }
615
height: childrenRect.height
618
objectName: "labelVersion"
619
anchors.left: parent.left
620
text: modelData.remoteVersion ? i18n.tr("Version: ") + modelData.remoteVersion : ""
621
elide: Text.ElideRight
627
objectName: "labelSize"
628
anchors.right: parent.right
629
text: Utilities.formatSize(modelData.binaryFilesize)
631
visible: !labelUpdateStatus.visible && !installing && !installed
639
id: credentialsNotification
640
objectName: "credentialsNotification"
649
ListItem.ThinDivider {}
652
text: i18n.tr("Sign in to Ubuntu One to receive updates for apps.")
653
177
horizontalAlignment: Text.AlignHCenter
661
text: i18n.tr("Sign In…")
665
leftMargin: units.gu(2)
666
rightMargin: units.gu(2)
668
onClicked: uoaConfig.exec()
676
id: updateNotification
677
objectName: "updateNotification"
679
bottom: configuration.top
685
property string text: ""
690
anchors.centerIn: updateNotification
691
text: updateNotification.text
692
width: updateNotification.width
693
horizontalAlignment: Text.AlignHCenter
699
id: installingImageUpdate
700
objectName: "installingImageUpdate"
705
property string message: i18n.tr("Installing update…")
708
anchors.centerIn: parent
712
source: Qt.resolvedUrl("file:///usr/share/icons/suru/places/scalable/distributor-logo.svg")
713
anchors.horizontalCenter: parent.horizontalCenter
716
NumberAnimation on rotation {
719
running: installingImageUpdate.visible == true
720
loops: Animation.Infinite
727
anchors.horizontalCenter: parent.horizontalCenter
731
text: installingImageUpdate.message
732
anchors.horizontalCenter: parent.horizontalCenter
178
wrapMode: Text.WordWrap
180
var s = UpdateManager.status;
182
return i18n.tr("Connect to the Internet to check for updates.");
183
} else if (s === UpdateManager.StatusIdle && updatesCount === 0) {
184
return i18n.tr("Software is up to date");
185
} else if (s === UpdateManager.StatusServerError ||
186
s === UpdateManager.StatusNetworkError) {
187
return i18n.tr("The update server is not responding. Try again later.");
195
id: updatesAvailableHeader
196
text: i18n.tr("Updates Available")
197
visible: imageUpdateCol.visible || clickUpdatesCol.visible
202
objectName: "imageUpdates"
203
anchors { left: parent.left; right: parent.right }
205
var s = UpdateManager.status;
206
var haveUpdates = imageRepeater.count > 0;
208
case UpdateManager.StatusCheckingClickUpdates:
209
case UpdateManager.StatusIdle:
210
return haveUpdates && online;
217
model: UpdateManager.imageUpdates
219
delegate: UpdateDelegate {
220
objectName: "imageUpdatesDelegate-" + index
221
width: imageUpdateCol.width
222
updateState: model.updateState
223
progress: model.progress
224
version: SystemImage.versionTag ?
225
SystemImage.versionTag : remoteVersion
227
changelog: model.changelog
230
iconUrl: model.iconUrl
236
if (SystemImage.downloadMode < 2) {
237
SystemImage.downloadUpdate();
238
SystemImage.forceAllowGSMDownload();
240
SystemImage.downloadUpdate();
243
onPause: SystemImage.pauseDownload();
245
var popup = PopupUtils.open(
246
Qt.resolvedUrl("ImageUpdatePrompt.qml"), null, {
247
havePowerForUpdate: root.havePower
250
popup.requestSystemUpdate.connect(SystemImage.applyUpdate);
258
objectName: "clickUpdates"
259
anchors { left: parent.left; right: parent.right }
261
var s = UpdateManager.status;
262
var haveUpdates = clickRepeater.count > 0;
264
case UpdateManager.StatusCheckingImageUpdates:
265
case UpdateManager.StatusIdle:
266
return haveUpdates && online && authenticated;
273
model: UpdateManager.clickUpdates
275
delegate: ClickUpdateDelegate {
276
objectName: "clickUpdatesDelegate" + index
277
width: clickUpdatesCol.width
278
updateState: model.updateState
279
progress: model.progress
280
version: remoteVersion
283
iconUrl: model.iconUrl
285
changelog: model.changelog
287
signedUrl: signedDownloadUrl
289
onInstall: downloadHandler.createDownload(model);
290
onPause: downloadHandler.pauseDownload(model)
291
onResume: downloadHandler.resumeDownload(model)
293
/* This creates a new signed URL with which we can
294
retry the download. See onSignedUrlChanged. */
295
UpdateManager.retry(model.identifier,
299
onSignedUrlChanged: {
300
// If we have a signedUrl, user intend to retry.
302
downloadHandler.retryDownload(model);
311
/* If we a downloadId, we expect UDM to restore it
312
after some time. Workaround for lp:1603770. */
320
|| s === Update.StateQueuedForDownload
321
|| s === Update.StateDownloading) {
322
downloadHandler.assertDownloadExist(model);
330
NotAuthenticatedNotification {
331
id: notauthNotification
332
objectName: "noAuthenticationNotification"
334
var s = UpdateManager.status;
336
case UpdateManager.StatusCheckingImageUpdates:
337
case UpdateManager.StatusIdle:
338
return !authenticated && online;
346
onRequestAuthentication: uoaConfig.exec()
350
text: i18n.tr("Recent updates")
351
visible: installedCol.visible
356
objectName: "installedUpdates"
357
anchors { left: parent.left; right: parent.right }
358
visible: installedRepeater.count > 0
361
id: installedRepeater
362
model: UpdateManager.installedUpdates
364
delegate: UpdateDelegate {
365
objectName: "installedUpdateDelegate-" + index
366
width: installedCol.width
367
version: remoteVersion
371
iconUrl: model.iconUrl
372
changelog: model.changelog
373
updateState: Update.StateInstalled
374
updatedAt: model.updatedAt
376
leadingActions: ListItemActions {
380
onTriggered: UpdateManager.remove(
381
model.identifier, model.revision
387
// Launchable if there's a package name on a click.
388
launchable: (!!packageName &&
389
model.kind === Update.KindClick)
391
onLaunch: UpdateManager.launch(identifier, revision);
395
} // Column inside flickable.
738
399
id: configuration
740
anchors.bottom: parent.bottom
741
anchors.left: parent.left
742
anchors.right: parent.right
401
height: childrenRect.height
404
bottom: parent.bottom
743
409
ListItem.ThinDivider {}
744
411
ListItem.SingleValue {
745
412
objectName: "configuration"
746
413
text: i18n.tr("Auto download")
748
if (UpdateManager.downloadMode === 0)
415
if (SystemImage.downloadMode === 0)
749
416
return i18n.tr("Never")
750
else if (UpdateManager.downloadMode === 1)
417
else if (SystemImage.downloadMode === 1)
751
418
return i18n.tr("On wi-fi")
752
else if (UpdateManager.downloadMode === 2)
419
else if (SystemImage.downloadMode === 2)
753
420
return i18n.tr("Always")
422
return i18n.tr("Unknown")
755
424
progression: true
756
425
onClicked: pageStack.push(Qt.resolvedUrl("Configuration.qml"))
430
id: postClickBatchHandler
431
ignoreUnknownSignals: true
433
onUpdatesCountChanged: {
434
if (target.updatesCount === 0) {
435
root.batchMode = false;
442
id: postAllBatchHandler
443
ignoreUnknownSignals: true
445
onUpdatesCountChanged: {
446
if (target.updatesCount === 1) {
447
SystemImage.updateDownloaded.connect(function () {
448
SystemImage.applyUpdate();
450
SystemImage.downloadUpdate();
456
target: NetworkingStatus
459
UpdateManager.cancel();
461
UpdateManager.check(UpdateManager.CheckAll);
469
if (consecutiveFailureCount > SystemImage.failuresBeforeWarning) {
470
var popup = PopupUtils.open(
471
Qt.resolvedUrl("InstallationFailed.qml"), null, {
479
Component.onCompleted: check()