@@ -23,7 +23,6 @@
2323import QMenuModel 0.1
2424import QtQuick 2.4
2525import QtQuick.Layouts 1.1
26−import SystemSettings 1.0
2726import Ubuntu.Components 1.3
2827import Ubuntu.Components.ListItems 1.3 as ListItem
2928import Ubuntu.Components.Popups 1.3
@@ -40,8 +39,6 @@ LocalComponents.Page {
4039 forwardButtonSourceComponent: forwardButton
4140
4241 property bool batchMode: false
43− property bool havePower: (indicatorPower.deviceState === "charging") ||
44− (indicatorPower.batteryLevel > 25)
4542 property bool online: NetworkingStatus.online
4643 property bool authenticated: UpdateManager.authenticated
4744 property bool forceCheck: false
@@ -51,22 +48,26 @@ LocalComponents.Page {
5148 if (authenticated) {
5249 count += clickRepeater.count;
5350 }
54− count += imageRepeater.count;
5551 return count;
5652 }
5753
5854 function check(force) {
59− UpdateManager.check(UpdateManager.CheckClickIgnoreVersion);
55+ UpdateManager.check(UpdateManager.CheckClickIgnoreVersion);
6056 }
6157
62− QDBusActionGroup {
63− id: indicatorPower
64− busType: 1
65− busName: "com.canonical.indicator.power"
66− objectPath: "/com/canonical/indicator/power"
67− property var batteryLevel: action("battery-level").state || 0
68− property var deviceState: action("device-state").state
69− Component.onCompleted: start()
58+ Setup {
59+ id: uoaConfig
60+ objectName: "uoaConfig"
61+ applicationId: "ubuntu-system-settings"
62+ providerId: "ubuntuone"
63+
64+ onFinished: {
65+ if (reply.errorName) {
66+ console.warn('Online Accounts failed:', reply.errorName);
67+ }
68+ UpdateManager.check(UpdateManager.CheckClickIgnoreVersion);
69+ notauthNotification.enabled = true;
70+ }
7071 }
7172
7273 DownloadHandler {
@@ -80,7 +81,7 @@ LocalComponents.Page {
8081 top: parent.top
8182 left: parent.left
8283 right: parent.right
83− bottom: configuration.top
84+ bottom: parent.bottom
8485 }
8586 clip: true
8687 contentHeight: content.height
@@ -102,24 +103,12 @@ LocalComponents.Page {
102103 clip: true
103104 status: UpdateManager.status
104105 batchMode: root.batchMode
105− requireRestart: imageRepeater.count > 0
106106 updatesCount: root.updatesCount
107107 online: root.online
108108 onStop: UpdateManager.cancel()
109109
110110 onRequestInstall: {
111− if (requireRestart) {
112− var popup = PopupUtils.open(
113− Qt.resolvedUrl("ImageUpdatePrompt.qml"), null, {
114− havePowerForUpdate: root.havePower
115− }
116− );
117− popup.requestSystemUpdate.connect(function () {
118− install();
119− });
120− } else {
121− install();
122− }
111+ install();
123112 }
124113 onInstall: {
125114 root.batchMode = true
@@ -166,67 +155,6 @@ LocalComponents.Page {
166155 }
167156 }
168157
169− SettingsItemTitle {
170− id: updatesAvailableHeader
171− text: i18n.tr("Updates Available")
172− visible: imageUpdateCol.visible || clickUpdatesCol.visible
173− }
174−
175− Column {
176− id: imageUpdateCol
177− objectName: "imageUpdates"
178− anchors { left: parent.left; right: parent.right }
179− visible: {
180− var s = UpdateManager.status;
181− var haveUpdates = imageRepeater.count > 0;
182− switch (s) {
183− case UpdateManager.StatusCheckingClickUpdates:
184− case UpdateManager.StatusIdle:
185− return haveUpdates && online;
186− }
187− return false;
188− }
189−
190− Repeater {
191− id: imageRepeater
192− model: UpdateManager.imageUpdates
193−
194− delegate: UpdateDelegate {
195− objectName: "imageUpdatesDelegate-" + index
196− width: imageUpdateCol.width
197− updateState: model.updateState
198− progress: model.progress
199− version: remoteVersion
200− size: model.size
201− changelog: model.changelog
202− error: model.error
203− kind: model.kind
204− iconUrl: model.iconUrl
205− name: title
206−
207− onResume: download()
208− onRetry: download()
209− onDownload: {
210− if (SystemImage.downloadMode < 2) {
211− SystemImage.downloadUpdate();
212− SystemImage.forceAllowGSMDownload();
213− } else {
214− SystemImage.downloadUpdate();
215− }
216− }
217− onPause: SystemImage.pauseDownload();
218− onInstall: {
219− var popup = PopupUtils.open(
220− Qt.resolvedUrl("ImageUpdatePrompt.qml"), null, {
221− havePowerForUpdate: root.havePower
222− }
223− );
224− popup.requestSystemUpdate.connect(SystemImage.applyUpdate);
225− }
226− }
227− }
228− }
229−
230158 Column {
231159 id: clickUpdatesCol
232160 objectName: "clickUpdates"
@@ -301,77 +229,27 @@ LocalComponents.Page {
301229 }
302230 }
303231
304− SettingsItemTitle {
305− text: i18n.tr("Recent updates")
306− visible: installedCol.visible
307− }
308−
309− Column {
310− id: installedCol
311− objectName: "installedUpdates"
312− anchors { left: parent.left; right: parent.right }
313− visible: installedRepeater.count > 0
314−
315− Repeater {
316− id: installedRepeater
317− model: UpdateManager.installedUpdates
318−
319− delegate: UpdateDelegate {
320− objectName: "installedUpdateDelegate-" + index
321− width: installedCol.width
322− version: remoteVersion
323− size: model.size
324− name: title
325− kind: model.kind
326− iconUrl: model.iconUrl
327− changelog: model.changelog
328− updateState: Update.StateInstalled
329− updatedAt: model.updatedAt
330−
331− leadingActions: ListItemActions {
332− actions: [
333− Action {
334− iconName: "delete"
335− onTriggered: UpdateManager.remove(
336− model.identifier, model.revision
337− )
338− }
339− ]
340− }
341−
342− // Launchable if there's a package name on a click.
343− launchable: (!!packageName &&
344− model.kind === Update.KindClick)
345−
346− onLaunch: UpdateManager.launch(identifier, revision);
232+ NotAuthenticatedNotification {
233+ id: notauthNotification
234+ objectName: "noAuthenticationNotification"
235+ visible: {
236+ var s = UpdateManager.status;
237+ switch (s) {
238+ case UpdateManager.StatusCheckingImageUpdates:
239+ case UpdateManager.StatusIdle:
240+ return !authenticated && online;
347241 }
242+ return false;
243+ }
244+ anchors {
245+ left: parent.left
246+ right: parent.right
348247 }
248+ onRequestAuthentication: uoaConfig.exec()
349249 }
350250 } // Column inside flickable.
351251 } // Flickable
352252
353− Column {
354− id: configuration
355−
356− height: childrenRect.height
357−
358− anchors {
359− bottom: parent.bottom
360− left: parent.left
361− right: parent.right
362− }
363−
364− ListItem.ThinDivider {}
365−
366− ListItem.SingleValue {
367− objectName: "configuration"
368− text: i18n.tr("Update settings")
369− progression: true
370− onClicked: pageStack.addPageToNextColumn(
371− root, Qt.resolvedUrl("UpdateSettings.qml"))
372− }
373− }
374−
375253 Connections {
376254 id: postClickBatchHandler
377255 ignoreUnknownSignals: true
@@ -384,43 +262,18 @@ LocalComponents.Page {
384262 }
385263 }
386264
387− Connections {
388− id: postAllBatchHandler
389− ignoreUnknownSignals: true
390− target: null
391− onUpdatesCountChanged: {
392− if (target.updatesCount === 1) {
393− SystemImage.updateDownloaded.connect(function () {
394− SystemImage.applyUpdate();
395− });
396− SystemImage.downloadUpdate();
397− }
398− }
399− }
400−
401265 Connections {
402266 target: NetworkingStatus
403267 onOnlineChanged: {
404− if (!online) {
405− UpdateManager.cancel();
406− } else {
407− UpdateManager.check(UpdateManager.CheckClickIgnoreVersion);
408− }
268+ if (!online) {
269+ UpdateManager.cancel();
270+ } else {
271+ UpdateManager.check(UpdateManager.CheckClickIgnoreVersion);
409272 }
273+ }
410274 }
411275
412− Connections {
413− target: SystemImage
414− onUpdateFailed: {
415− if (consecutiveFailureCount > SystemImage.failuresBeforeWarning) {
416− var popup = PopupUtils.open(
417− Qt.resolvedUrl("InstallationFailed.qml"), null, {
418− text: lastReason
419− }
420− );
421− }
422− }
423− }
276+ Component.onCompleted: check()
424277
425278 Component {
426279 id: forwardButton