141
225
onCredentialsNotFound: {
142
226
credentialsNotification.visible = true;
143
notification.text = i18n.tr("Please log into your Ubuntu One account.");
144
notification.progression = true;
145
notificationAction = root.open_online_accounts;
148
229
onSystemUpdateDownloaded: {
149
root.updatesAvailable -= 1;
150
PopupUtils.open(dialogInstallComponent);
230
root.installAll = false;
153
233
onSystemUpdateFailed: {
154
234
root.state = "SYSTEMUPDATEFAILED";
156
notification.text = lastReason;
158
notification.text = i18n.tr("System update has failed.");
160
notification.progression = false;
161
notificationAction = undefined;
235
root.errorDialogText = i18n.tr("Sorry, the system update failed.");
236
PopupUtils.open(dialogErrorComponent);
164
239
onUpdateProcessFailed: {
165
240
root.state = "SYSTEMUPDATEFAILED";
167
notification.text = message;
169
notification.text = i18n.tr("System update failed.");
241
root.errorDialogText = i18n.tr("Sorry, the system update failed.");
242
PopupUtils.open(dialogErrorComponent);
246
activity.running = false;
250
activity.running = false;
254
installingImageUpdate.message = i18n.tr("Restarting…");
175
id: checkForUpdatesArea
176
objectName: "checkForUpdatesArea"
182
topMargin: units.gu(2)
183
leftMargin: units.gu(4)
184
rightMargin: units.gu(4)
186
height: installAllButton.height
190
running: checkForUpdatesArea.visible
191
visible: activity.running
260
anchors.top: parent.top
261
anchors.left: parent.left
262
anchors.right: parent.right
263
anchors.bottom: configuration.top
265
contentHeight: contentItem.childrenRect.height
266
boundsBehavior: (contentHeight > root.height) ? Flickable.DragAndOvershootBounds : Flickable.StopAtBounds
268
/* Set the direction to workaround https://bugreports.qt-project.org/browse/QTBUG-31905
269
otherwise the UI might end up in a situation where scrolling doesn't work */
270
flickableDirection: Flickable.VerticalFlick
193
275
left: parent.left
195
topMargin: units.gu(1)
200
text: i18n.tr("Checking for updates…")
201
verticalAlignment: Text.AlignVCenter
202
elide: Text.ElideRight
206
right: checkForUpdatesArea.right
207
bottom: parent.bottom
208
leftMargin: units.gu(2)
209
rightMargin: units.gu(2)
216
objectName: "installAllButton"
218
property string primaryText: includeSystemUpdate ? i18n.tr("Install %1 updates…").arg(root.updatesAvailable) : i18n.tr("Install %1 updates").arg(root.updatesAvailable)
219
property string secondaryText: i18n.tr("Pause All")
220
text: root.installAll ? secondaryText : primaryText
225
topMargin: units.gu(2)
226
leftMargin: units.gu(4)
227
rightMargin: units.gu(4)
231
color: UbuntuColors.orange
233
root.installAll = !root.installAll;
234
for (var i=0; i < updateList.count; i++) {
235
updateList.currentIndex = i;
236
var item = updateList.currentItem;
237
var modelItem = updateManager.model[i];
238
if (modelItem.updateState != root.installAll && !modelItem.updateReady) {
239
item.actionButton.clicked();
243
opacity: root.updatesAvailable > 0 ? 1 : 0
245
Behavior on opacity { PropertyAnimation { duration: UbuntuAnimation.SlowDuration
246
easing: UbuntuAnimation.StandardEasing } }
251
objectName: "updateList"
256
top: installAllButton.visible ? installAllButton.bottom : parent.top
257
bottom: notification.visible ? notification.top : configuration.top
261
model: updateManager.model
263
contentHeight: contentItem.childrenRect.height
264
boundsBehavior: (contentHeight > (root.height - checkForUpdatesArea.height)) ? Flickable.DragAndOvershootBounds : Flickable.StopAtBounds
266
delegate: ListItem.Subtitled {
268
iconSource: Qt.resolvedUrl(modelData.iconUrl)
269
height: modelData.selected ? units.gu(14) : units.gu(8)
272
property alias actionButton: buttonAppUpdate
276
objectName: "textArea"
279
anchors.topMargin: units.gu(1)
281
property string message: modelData.error
282
property bool retry: false
285
if(message.length > 0) {
286
labelVersion.text = message;
287
buttonAppUpdate.text = i18n.tr("Retry");
278
height: childrenRect.height
281
id: checkForUpdatesArea
282
objectName: "checkForUpdatesArea"
288
running: checkForUpdatesArea.visible
289
visible: activity.running
294
height: parent.height
298
text: activity.running ? i18n.tr("Checking for updates…") : i18n.tr("Connect to the Internet to check for updates")
299
verticalAlignment: Text.AlignVCenter
300
elide: Text.ElideRight
302
left: activity.running ? activity.right : parent.left
305
rightMargin: units.gu(2)
306
leftMargin: units.gu(2)
308
height: parent.height
313
text: i18n.tr("Retry")
314
color: UbuntuColors.orange
318
bottom: parent.bottom
321
visible: !activity.visible
324
activity.running = true;
325
root.state = "SEARCHING";
326
UpdateManager.checkUpdates();
331
ListItem.SingleControl {
332
height: installAllButton.visible ? units.gu(8) : units.gu(2)
333
highlightWhenPressed: false
336
objectName: "installAllButton"
337
property string primaryText: includeSystemUpdate ?
338
i18n.tr("Install %1 update…", "Install %1 updates…", root.updatesAvailable).arg(root.updatesAvailable) :
339
i18n.tr("Install %1 update", "Install %1 updates", root.updatesAvailable).arg(root.updatesAvailable)
340
property string secondaryText: i18n.tr("Pause All")
341
color: UbuntuColors.orange
342
text: root.installAll ? secondaryText : primaryText
343
width: parent.width - units.gu(4)
346
for (var i=0; i < updateList.count; i++) {
347
updateList.currentIndex = i;
348
var item = updateList.currentItem;
349
var modelItem = UpdateManager.model[i];
350
if (item.installing || item.installed)
352
console.warn("AllClicked: " + modelItem.updateState + " " + modelItem.updateReady + " " + modelItem.selected);
355
UpdateManager.retryDownload(modelItem.packageName);
358
if (root.installAll && !modelItem.updateReady && modelItem.selected) {
362
console.warn("Past pause");
363
if (!root.installAll && !modelItem.updateReady && modelItem.selected) {
367
console.warn("Past resume");
368
if (!root.installAll && !modelItem.updateState && !modelItem.updateReady && !modelItem.selected) {
372
console.warn("Past start");
374
root.installAll = !root.installAll;
382
objectName: "updateList"
387
model: UpdateManager.model
388
height: childrenRect.height
392
delegate: ListItem.Subtitled {
398
iconSource: Qt.resolvedUrl(modelData.iconUrl)
399
iconFrame: modelData.systemUpdate ? false : true
400
height: visible ? textArea.height : 0
401
highlightWhenPressed: false
404
opacity: installed ? 0 : 1
405
Behavior on opacity { PropertyAnimation { duration: UbuntuAnimation.SleepyDuration } }
407
property alias actionButton: buttonAppUpdate
408
property alias progressBar: progress
409
property bool installing: !modelData.systemUpdate && (modelData.updateReady || (progressBar.value === progressBar.maximumValue))
410
property bool installed: false
411
property bool retry: false
414
console.warn("PAUSE: " + modelData.packageName);
415
if (modelData.systemUpdate)
416
return UpdateManager.pauseDownload(modelData.packageName);
288
417
modelData.updateState = false;
289
modelData.selected = false;
290
textArea.retry = true;
422
console.warn("RESUME: " + modelData.packageName);
423
if (modelData.systemUpdate)
424
return UpdateManager.startDownload(modelData.packageName);
425
modelData.updateState = true;
430
console.warn("START: " + modelData.packageName);
431
modelData.selected = true;
432
modelData.updateState = true;
433
UpdateManager.startDownload(modelData.packageName);
437
objectName: "textArea"
442
spacing: units.gu(0.5)
449
height: buttonAppUpdate.height
453
objectName: "labelTitle"
456
right: buttonAppUpdate.visible ? buttonAppUpdate.left : parent.right
457
verticalCenter: parent.verticalCenter
459
text: modelData.title
461
elide: Text.ElideMiddle
466
objectName: "buttonAppUpdate"
467
anchors.right: parent.right
468
height: labelTitle.height + units.gu(1)
472
return i18n.tr("Retry");
473
if (modelData.systemUpdate) {
474
if (modelData.updateReady) {
475
return i18n.tr("Install…");
476
} else if (!modelData.updateState && !modelData.selected) {
477
return i18n.tr("Download");
480
if (modelData.updateState) {
481
return i18n.tr("Pause");
482
} else if (modelData.selected) {
483
return i18n.tr("Resume");
485
return i18n.tr("Update");
491
return UpdateManager.retryDownload(modelData.packageName);
493
if (modelData.updateState)
495
if (!modelData.updateState && modelData.selected)
497
if (!modelData.updateState && !modelData.selected && !modelData.updateReady)
499
if (modelData.updateReady)
500
PopupUtils.open(dialogInstallComponent);
506
id: labelUpdateStatus
511
height: childrenRect.height
513
opacity: (modelData.updateState && modelData.selected && !modelData.updateReady) || (installing || installed) ? 1 : 0
514
Behavior on opacity { PropertyAnimation { duration: UbuntuAnimation.SleepyDuration } }
516
objectName: "labelUpdateStatus"
517
anchors.left: parent.left
518
anchors.right: updateStatusLabel.left
519
elide: Text.ElideMiddle
523
return modelData.error;
525
return i18n.tr("Installing");
527
return i18n.tr("Installed");
528
return i18n.tr("Downloading");
532
id: updateStatusLabel
533
anchors.right: parent.right
534
visible: !labelSize.visible && !installing && !installed
537
if (!labelUpdateStatus.visible)
538
return convert_bytes_to_size(modelData.binaryFilesize);
540
return i18n.tr("%1 of %2").arg(
541
convert_bytes_to_size(modelData.binaryFilesize * (progress.value * 0.01))).arg(
542
convert_bytes_to_size(modelData.binaryFilesize)
550
objectName: "progress"
557
opacity: modelData.selected && !modelData.updateReady && !installed ? 1 : 0
558
value: modelData.systemUpdate ? modelData.downloadProgress : tracker.progress
564
objectName: "tracker"
565
packageName: modelData.packageName
566
clickToken: modelData.clickToken
567
download: modelData.downloadUrl
570
progress.visible = false;
571
buttonAppUpdate.visible = false;
574
root.updatesAvailable -= 1;
575
modelData.updateRequired = false;
576
UpdateManager.updateClickScope();
580
console.warn("onProcessing: " + modelData.packageName + " " + path);
581
buttonAppUpdate.enabled = false;
583
modelData.updateState = false;
587
console.warn("onStarted: " + modelData.packageName + " " + success);
589
modelData.updateState = true;
591
modelData.updateState = false;
595
console.warn("onPaused: " + modelData.packageName + " " + success);
597
modelData.updateState = false;
599
modelData.updateState = true;
603
console.warn("onResumed: " + modelData.packageName + " " + success);
605
modelData.updateState = true;
607
modelData.updateState = false;
611
console.warn("onCanceled: " + modelData.packageName + " " + success);
613
modelData.updateState = false;
614
modelData.selected = false;
619
console.warn("onErrorFound: " + modelData.packageName + " " + error);
620
modelData.updateState = false;
626
Behavior on opacity { PropertyAnimation { duration: UbuntuAnimation.SleepyDuration } }
634
height: childrenRect.height
637
objectName: "labelVersion"
638
anchors.left: parent.left
639
text: modelData.remoteVersion ? i18n.tr("Version: ") + modelData.remoteVersion : ""
640
elide: Text.ElideRight
646
objectName: "labelSize"
647
anchors.right: parent.right
648
text: convert_bytes_to_size(modelData.binaryFilesize)
650
visible: !labelUpdateStatus.visible && !installing && !installed
658
id: credentialsNotification
659
objectName: "credentialsNotification"
668
ListItem.ThinDivider {}
671
text: i18n.tr("Sign in to Ubuntu One to receive updates for apps.")
672
horizontalAlignment: Text.AlignHCenter
296
objectName: "buttonAppUpdate"
297
anchors.top: parent.top
298
anchors.right: parent.right
299
anchors.topMargin: units.gu(1)
300
anchors.rightMargin: units.gu(1)
301
height: labelTitle.height
303
property string actionText: modelData.systemUpdate ? i18n.tr("Download") : i18n.tr("Update")
304
property string primaryText: modelData.selected ? i18n.tr("Resume") : actionText
305
property string secondaryText: i18n.tr("Pause")
307
text: modelData.updateState ? secondaryText : primaryText
310
if (textArea.retry) {
311
textArea.retry = false;
312
updateManager.retryDownload(modelData.packageName);
313
} else if (modelData.updateReady) {
314
updateManager.applySystemUpdate();
315
installingImageUpdate.visible = true;
316
} else if (modelData.updateState) {
317
if (modelData.systemUpdate) {
318
updateManager.pauseDownload(modelData.packageName);
320
modelData.updateState = false;
324
if (!modelData.selected || modelData.systemUpdate) {
325
modelData.selected = true;
326
updateManager.startDownload(modelData.packageName);
328
modelData.updateState = true;
337
objectName: "labelSize"
338
text: convert_bytes_to_size(modelData.binaryFilesize)
339
anchors.bottom: labelVersion.bottom
340
anchors.right: parent.right
341
anchors.rightMargin: units.gu(1)
342
visible: !modelData.selected
347
objectName: "labelTitle"
351
right: buttonAppUpdate.left
352
topMargin: units.gu(1)
353
rightMargin: units.gu(1)
356
text: modelData.title
358
elide: buttonAppUpdate.visible ? Text.ElideRight : Text.ElideNone
362
id: labelUpdateStatus
363
objectName: "labelUpdateStatus"
364
text: i18n.tr("Installing")
365
anchors.top: labelTitle.bottom
366
anchors.left: parent.left
367
anchors.right: parent.right
368
opacity: modelData.selected ? 1 : 0
369
anchors.bottomMargin: units.gu(1)
371
Behavior on opacity { PropertyAnimation { duration: UbuntuAnimation.SleepyDuration } }
376
objectName: "progress"
378
anchors.left: parent.left
379
anchors.top: labelUpdateStatus.bottom
380
anchors.topMargin: units.gu(1)
381
anchors.right: parent.right
382
opacity: modelData.selected ? 1 : 0
383
value: modelData.systemUpdate ? modelData.downloadProgress : tracker.progress
389
objectName: "tracker"
390
packageName: modelData.packageName
391
clickToken: modelData.clickToken
392
download: modelData.downloadUrl
395
progress.visible = false;
396
buttonAppUpdate.visible = false;
397
textArea.message = i18n.tr("Installed");
398
root.updatesAvailable -= 1;
402
modelData.updateState = false;
403
textArea.message = error;
407
Behavior on opacity { PropertyAnimation { duration: UbuntuAnimation.SleepyDuration } }
412
objectName: "labelVersion"
415
right: buttonAppUpdate.right
416
top: (!progress.visible || progress.opacity == 0) ? labelTitle.bottom : progress.bottom
417
topMargin: (!progress.visible || progress.opacity == 0) ? 0 : units.gu(1)
418
bottom: parent.bottom
419
bottomMargin: units.gu(1)
421
text: modelData.remoteVersion ? i18n.tr("Version: ") + modelData.remoteVersion : ""
423
elide: Text.ElideRight
431
objectName: "notification"
432
visible: updateNotification.visible || credentialsNotification.visible ? true : false
433
anchors.bottom: configuration.top
436
if (notificationAction) {
437
notificationAction();
442
ListItem.SingleValue {
444
objectName: "configuration"
445
anchors.bottom: parent.bottom
446
text: i18n.tr("Auto download")
448
if (updateManager.downloadMode === 0)
449
return i18n.tr("Never")
450
else if (updateManager.downloadMode === 1)
451
return i18n.tr("On wi-fi")
452
else if (updateManager.downloadMode === 2)
453
return i18n.tr("Always")
456
onClicked: pageStack.push(Qt.resolvedUrl("Configuration.qml"), {updateManager: updateManager})
680
text: i18n.tr("Sign In…")
684
leftMargin: units.gu(2)
685
rightMargin: units.gu(2)
687
onClicked: uoaConfig.exec()
460
695
id: updateNotification
461
696
objectName: "updateNotification"
698
bottom: configuration.top
463
699
left: parent.left
464
700
right: parent.right
465
top: installAllButton.bottom
466
bottom: notification.visible ? notification.top : configuration.top
471
704
property string text: ""