on xenial help sign in
Remove Settings components that we aren't using
2a10ef2Dalton Durst
qml/Wizard/Pages/78-app-update.qml+37−184
@@ -23,7 +23,6 @@
23import QMenuModel 0.1
23import QMenuModel 0.1
24import QtQuick 2.4
24import QtQuick 2.4
25import QtQuick.Layouts 1.1
25import QtQuick.Layouts 1.1
26−import SystemSettings 1.0
27import Ubuntu.Components 1.3
26import Ubuntu.Components 1.3
28import Ubuntu.Components.ListItems 1.3 as ListItem
27import Ubuntu.Components.ListItems 1.3 as ListItem
29import Ubuntu.Components.Popups 1.3
28import Ubuntu.Components.Popups 1.3
@@ -40,8 +39,6 @@ LocalComponents.Page {
40 forwardButtonSourceComponent: forwardButton
39 forwardButtonSourceComponent: forwardButton
41
40
42 property bool batchMode: false
41 property bool batchMode: false
43− property bool havePower: (indicatorPower.deviceState === "charging") ||
44− (indicatorPower.batteryLevel > 25)
45 property bool online: NetworkingStatus.online
42 property bool online: NetworkingStatus.online
46 property bool authenticated: UpdateManager.authenticated
43 property bool authenticated: UpdateManager.authenticated
47 property bool forceCheck: false
44 property bool forceCheck: false
@@ -51,22 +48,26 @@ LocalComponents.Page {
51 if (authenticated) {
48 if (authenticated) {
52 count += clickRepeater.count;
49 count += clickRepeater.count;
53 }
50 }
54− count += imageRepeater.count;
55 return count;
51 return count;
56 }
52 }
57
53
58 function check(force) {
54 function check(force) {
59− UpdateManager.check(UpdateManager.CheckClickIgnoreVersion);
55+ UpdateManager.check(UpdateManager.CheckClickIgnoreVersion);
60 }
56 }
61
57
62− QDBusActionGroup {
58+ Setup {
63− id: indicatorPower
59+ id: uoaConfig
64− busType: 1
60+ objectName: "uoaConfig"
65− busName: "com.canonical.indicator.power"
61+ applicationId: "ubuntu-system-settings"
66− objectPath: "/com/canonical/indicator/power"
62+ providerId: "ubuntuone"
67− property var batteryLevel: action("battery-level").state || 0
63+
68− property var deviceState: action("device-state").state
64+ onFinished: {
69− Component.onCompleted: start()
65+ if (reply.errorName) {
66+ console.warn('Online Accounts failed:', reply.errorName);
67+ }
68+ UpdateManager.check(UpdateManager.CheckClickIgnoreVersion);
69+ notauthNotification.enabled = true;
70+ }
70 }
71 }
71
72
72 DownloadHandler {
73 DownloadHandler {
@@ -80,7 +81,7 @@ LocalComponents.Page {
80 top: parent.top
81 top: parent.top
81 left: parent.left
82 left: parent.left
82 right: parent.right
83 right: parent.right
83− bottom: configuration.top
84+ bottom: parent.bottom
84 }
85 }
85 clip: true
86 clip: true
86 contentHeight: content.height
87 contentHeight: content.height
@@ -102,24 +103,12 @@ LocalComponents.Page {
102 clip: true
103 clip: true
103 status: UpdateManager.status
104 status: UpdateManager.status
104 batchMode: root.batchMode
105 batchMode: root.batchMode
105− requireRestart: imageRepeater.count > 0
106 updatesCount: root.updatesCount
106 updatesCount: root.updatesCount
107 online: root.online
107 online: root.online
108 onStop: UpdateManager.cancel()
108 onStop: UpdateManager.cancel()
109
109
110 onRequestInstall: {
110 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();
111+ install();
122− }
123 }
112 }
124 onInstall: {
113 onInstall: {
125 root.batchMode = true
114 root.batchMode = true
@@ -166,67 +155,6 @@ LocalComponents.Page {
166 }
155 }
167 }
156 }
168
157
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−
230 Column {
158 Column {
231 id: clickUpdatesCol
159 id: clickUpdatesCol
232 objectName: "clickUpdates"
160 objectName: "clickUpdates"
@@ -301,77 +229,27 @@ LocalComponents.Page {
301 }
229 }
302 }
230 }
303
231
304− SettingsItemTitle {
232+ NotAuthenticatedNotification {
305− text: i18n.tr("Recent updates")
233+ id: notauthNotification
306− visible: installedCol.visible
234+ objectName: "noAuthenticationNotification"
307− }
235+ visible: {
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
236+ var s = UpdateManager.status;
318−
237+ switch (s) {
319− delegate: UpdateDelegate {
238+ case UpdateManager.StatusCheckingImageUpdates:
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(
239+ case UpdateManager.StatusIdle:
336− model.identifier, model.revision
240+ return !authenticated && online;
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);
347 }
241 }
242+ return false;
243+ }
244+ anchors {
245+ left: parent.left
246+ right: parent.right
348 }
247 }
248+ onRequestAuthentication: uoaConfig.exec()
349 }
249 }
350 } // Column inside flickable.
250 } // Column inside flickable.
351 } // Flickable
251 } // Flickable
352
252
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−
375 Connections {
253 Connections {
376 id: postClickBatchHandler
254 id: postClickBatchHandler
377 ignoreUnknownSignals: true
255 ignoreUnknownSignals: true
@@ -384,43 +262,18 @@ LocalComponents.Page {
384 }
262 }
385 }
263 }
386
264
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−
401 Connections {
265 Connections {
402 target: NetworkingStatus
266 target: NetworkingStatus
403 onOnlineChanged: {
267 onOnlineChanged: {
404− if (!online) {
268+ if (!online) {
405− UpdateManager.cancel();
269+ UpdateManager.cancel();
406− } else {
270+ } else {
407− UpdateManager.check(UpdateManager.CheckClickIgnoreVersion);
271+ UpdateManager.check(UpdateManager.CheckClickIgnoreVersion);
408− }
409 }
272 }
273+ }
410 }
274 }
411
275
412− Connections {
276+ Component.onCompleted: check()
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− }
424
277
425 Component {
278 Component {
426 id: forwardButton
279 id: forwardButton