~ken-vandine/ubuntu-system-settings/rtm_click_framework_check

« back to all changes in this revision

Viewing changes to plugins/system-update/PageComponent.qml

[ CI bot ]
* Resync trunk
[ Michael Zanetti ]
* update code to reset launcher after launcher backend implementation
  was reworked (LP: #1376707)
[ Sebastien Bacher ]
* [storage] translator comment for the string "%1 free" (LP: #1377929)
* [system-update] ellipsize labels if needed (LP: #1376286)
* [sound] Use the correct low icon (LP: #1376286)
[ Lars Uebernickel ]
* notification-manager: fix issues with GVariant API usage
[ jonas-drange ]
* [security/privacy] allow user to change HERE and location detection
  settings. (LP: #1375322)
[ Ken VanDine ]
* Updated the pot file.
[ jonas-drange ]
* [cellular] indirectly recreate ConnectionManager interface's dbus
  proxy so it reports the true value of 'Powered' after flight mode
  (LP: #1376957)
[ Iain Lane ]
* [sound] Make listSounds take a list of directories and list all of
  the files in them, instead of assuming "/custom" all the time.
[ Ubuntu daily release ]
* New rebuild forced
[ Sebastien Bacher ]
* [sound] list custom ringtones as well (LP: #1381528)
[ Ken VanDine ]
* Add an APN editor. (LP: #1225174)
[ Michael Terry ]
* Complete the unlock security screens and update a host of other
  small design issues. (LP: #1365034, LP: #1348362) (LP: #1365034,
  #1348362)
[ Diego Sarmentero ]
* Improves in network backend. Detect network connection and show
  "Connect to the internet..." message or retry on netword detected. .
* Detect account added on online accounts (LP: #1362149)
[ jonas-drange ]
* [wifi/phone] dynamically chooses what SIM to use when there's only
  one present. (LP: #1375832)
[ Iain Lane ]
* [storage/about] Use a QSharedPointer to manage freeing of the
  counter which we use to display all of the collected sizes at once.
  If the measuring process was cancelled, we were freeing it multiple
  times - once for each outstanding size measurement. This led to a
  crash. (LP: #1375988)
* [security-privacy] Link with gobject, uses symbols from this
  library. Prevents "[…]libUbuntuSecurityPrivacyPanel.so contains an
  unresolvable reference to symbol
  g_signal_handlers_disconnect_matched: it's probably a plugin"
  warnings.
[ jonas-drange ]
* [cellular] react to application.state changes and update potential
  out-of-date default SIM settings (LP: #1364103)
* [wifi] let removed networks update the previous network model so
  that we can reuse the model (and not pop the pagestack twice,
  causing this ux issue) (LP: #1370389)
[ Sebastien Bacher ]
* [location] use a flickable so the list can be scrolled (LP:
  #1374017)
* [security] get localized application names from the trust-store (LP:
  #1374018)
[ Ken VanDine ]
* Fixed handling of the Downloading/Installing label based on actual
  state. . Forward updateProgress signals for system updates. Layout
  fixes (LP: #1312587)
* Use new splash screen (LP: #1376242)
* Improved tracking download states
* Use new target_build_number from system-image-dbus to determine
  visibility of the update notification (LP: #1355803)
[ CI bot ]
* Resync trunk
[ Sebastien Bacher ]
* [storage] use libclick rather than calling the command line (LP:
  #1368967)
* [storage] tweaks to the disk informations, limit the free space to
  the user available one (excluding the system partitions), don't list
  the external mounts, that's described in the design and is going to
  require work on the categories computation to give correct values
  (LP: #1284247)
* [about] display the free space value next to the storage label (LP:
  #1335144)
[ Albert Astals ]
* Add i18n.tr
[ jonas-drange ]
* [wifi] connect to hidden network is now a dialog (LP: #1366005)
[ Ken VanDine ]
* Provide more keywords to make search useful (LP: #1370219) (LP:
  #1370219)
* [background] set sourceSize in the image preview to work around an
  issue loading large images (LP: #1373462)
[ CI bot ]
* Resync trunk
[ Mathieu Trudel-Lapierre ]
* [bluetooth] Properly handle device types for connection and
  disconnection. (LP: #1369964)
[ Michael Terry ]
* Add a translator comment for what HERE means. (LP: #1368838) (LP:
  #1368838)
* Prevent a crash in unity8 when the wizard also crashes or stops
  early. (LP: #1355892) (LP: #1355892)
[ Michael Terry ]
* Prevent the buttons of the wizard's password page from overlapping
  its content when the OSK appears. (LP: #1368346) (LP: #1368346)
[ Ken VanDine ]
* Set the version information in the SystemUpdate constructor (LP:
  #1371810) (LP: #1371810)
* [reset] Don't bail out on an isValid() check on the SystemImage
  QDBusInterface, the docs say isValid() may not be reliable for
  remote interfaces (LP: #1370815) (LP: #1370815)
* Fixed reference error for count on the various device models (LP:
  #1362517) (LP: #1362517)
* [background] Use the ContentPeerPicker to select sources for
  backgrounds (LP: #1356542) (LP: #1356542)
[ Iain Lane ]
* Don't check if the timedated interface is valid before calling
  SetTime on it, it might have timed out and we should reactivate it
  in that case.
* [about] Fix developerMode property to be QMLish - read & write
  instead of separate "read" and "toggle" properties.
* [about] Don't display a frame for icons that can't be found,
  improving the visual appearance. Also return the correct path for
  click packages which use the icon theme.
[ Sebastien Bacher ]
* [storage] handle the scope click .ini and get the correct icons (LP:
  #1368920)
[ Albert Astals ]
* make pot
[ Oliver Grawert ]
* fix LP: #1365903, add a watch to Developer Mode page so the page
  gets refreshed when going back through the page stack, also fix the
  page id and bounds (LP: #1365903)
* Some packaging fixes
  - > is not a valid relationship. It should be >>
  - Don't recommend suru-icon-theme since we also depend on it
  - Bump S-V to 3.9.6 which for example allows the images we ship in
    /usr/lib/
  - Override binary-no-manpage lintian warnings. We're not going to get man
    pages for u-s-s any time soon
[ Ken VanDine ]
* Make UpdateManager a singleton and refresh the availableUpdates
  count when the model updates (LP: #1325629) (LP: #1325629)
[ Ken VanDine ]
* Include an icon instead of using the themed icon (LP: #1365408) (LP:
  #1365408)
[ Mathieu Trudel-Lapierre ]
* [bluetooth] don't try to enable Discoverable if the device isn't
  powered yet. (LP: #1355904)
[ Ken VanDine ]
* When activated by a url request for a specific panel, clear the
  pageStack to maintain the natural navigation instead of pushing a
  new page on top of a page from a the previous panel (LP: #1362025)
  (LP: #1362025, #1359953)
[ Lars Uebernickel ]
* Use Icon instead of StatusIcon
[ CI bot ]
* Resync trunk
[ John R. Lenton ]
* Take the system settings push helper closer to implementing the spec
  at https://wiki.ubuntu.com/SoftwareUpdates#Prompting (LP: #1363972)
[ Ken VanDine ]
* Don't try to tweak the bottomMargin for the OSK, it was trying to
  calculate it based on an undefined component so failing. It
  shouldn't be needed anyway.
[ jonas-drange ]
* [wifi] "Other Network" -> "Connect to hidden network" (LP: #1365984)
* [wifi] fix bad looking buttons in "Other Networks" panel (LP:
  #1362127)
[ Jussi Pakkanen ]
* Hide entry to connect to hidden network when wifi is off. (LP:
  #1365960)
[ Ken VanDine ]
* Fixed tests for the dialpad settings failing on mako
* Don't call downloadUpdate when we see a system update ready, the
  service does that for us (LP: #1368294) (LP: #1368294)
* Translate desktop file (LP: #1318008) (LP: #1318008)
[ Martin Pitt ]
* update POT
[ Sebastien Bacher ]
* [system-update] open the ubuntuone subpanel rather than the list
  (LP: #1348580)
* [security-privacy] use ngettext strings when needed (LP: #1368159)
* Increase vertical spacing in the settings grid (LP: #1348579)
[ jonas-drange ]
* [background] always keep custom images, and remove press-and-hold
  action. (LP: #1365167)
* [wifi] do not use predictive text for network name input (LP:
  #1365992)
* [language] workaround for transition bug in keyboard layout menu
  (LP: #1350809)
* [wifi] factory was setting the icon property, which was causing the
  icon to not render (LP: #1364366)
[ Alejandro J. Cura ]
* Fixing the refreshing of the apps scope (LP: #1360369)
[ Sebastien Bacher ]
* [sound] use the correct backend to control the keyboard sound toggle
  (LP: #1366208)
[ Ken VanDine ]
* Don't call downloadUpdate for system updates that are already
  downloading (LP: #1365646) (LP: #1311219, #1365646)
[ Ken VanDine ]
* Notify the user if the phone needs to be plug to power for update.
[ Sebastien Bacher ]
* [system-update] don't draw a frame around ubuntu updates (LP:
  #1367136)
[ Mathieu Trudel-Lapierre ]
* Also allow Speakers and Carkits as valid audio devices to pair.
[ Michael Terry ]
* Allow switch from PIN code to passphrase and back using the same
  password. (LP: #1357043) (LP: #1357043)
* Fix false-negatives from AccountsService when switching from swipe
  to password (LP: #1363405) (LP: #1363405)
[ Ricardo Salveti de Araujo ]
* sound: setting default audio role for ringtone and messages
[ Michael Terry ]
* Don't crash when destructing the Wizard.Utils.System plugin. This
  fixes the crash on wizard exit and the crash when pressing back on
  the HERE license.
[ CI bot ]
* Resync trunk
[ Sebastien Bacher ]
* [developer-mode] working scrolling and correct spacing
* Use standard items for the categories and don't display dividers
  (LP: #1365563)
* [orientation-lock] don't display a frame around the icon (LP:
  #1365450)
[ jonas-drange ]
* [about/versions] create reusable component of singlevalue items that
  have long values (LP: #1363927)
[ David Barth ]
* Enable location panel, display contols for authorized applications.
[ Ken VanDine ]
* Tweak the depends for accountsservice-ubuntu-schemas to handle a "~"
  version
[ CI bot ]
* Resync trunk
[ Guillermo Gonzalez ]
* Basic unittest for the push-helper script
[ Mathieu Trudel-Lapierre ]
* Downgrade qFatal failure to register bluetooth agent to a qCritical.
[ Andrea Cimitan ]
* Various fixes for wifi wizard page (LP: #1362296)
[ Sebastien Bacher ]
* [security] don't mark "%1" string as translatable
* [security] give a translation context to the 'None' string (LP:
  #1362143)
* [licenses] display an error when the copyright can't be read (LP:
  #1206150)
[ Michael Terry ]
* Avoid another race condition when switching password types by
  completing all DBus operations synchronously as we exit the
  policykit agent. LP: 1361137 (LP: #1361137)
* Fix the OSK not working on first boot. When the wizard closes, shut
  down maliit-server and the indicators so that unity8 can start them
  itself. LP: 1362679 (LP: #1362679)
[ jonas-drange ]
* [about] print out phone numbers for dual sims as well
* [about/wifi] adding mac addresses for bt and wifi, and ip for wifi
  (LP: #1356239)
* [language] explain to the user that a reboot is necessary for the
  change to take effect (LP: #1240875)
[ Michael Terry ]
* Make the HERE license optional, clearly mark it as a HERE license
  instead of an Ubuntu license, and connect it to the HERE backend.
[ CI bot ]
* Resync trunk
[ Martin Pitt ]
* POT update
[ Ken VanDine ]
* Added setting for dialpad sounds to both the sound and phone panels.
[ CI bot ]
* Resync trunk
[ Diego Sarmentero ]
* Fix out of sync image download. Refresh scope after installation
  (LP: #1324923)
[ Sebastien Bacher ]
* [battery] refresh the graph on a minute basis
* [notifications] use normal text style and ubuntushaped icons
[ Michael Terry ]
* When changing to swipe mode, it was possible that our policykit
  agent would not unregister itself, making the next attempt to change
  modes appear to work, but in truth fail. Also, no longer ask for a
  password to switch to swipe mode if policykit has a cached
  authentication for us. (LP: #1350381)
[ Sebastien Bacher ]
* [security] tweak some pin locking details to match the design better
[ Michael Terry ]
* Implement the "When locked, allow:" portion of the Security &
  Privacy panel, so now the user can control whether the launcher
  and/or indicators are available while locked. (LP: #1358340) (LP:
  #1358340)
[ Michael Terry ]
* Update look and feel of wizard to more closely match the visual
  design.
[ Jussi Pakkanen ]
* Minor cleanups.
[ Roberto Alsina ]
* Don't crash the push helper in locales that have no .mo file (LP:
  #1357506)
[ Ken VanDine ]
* SIM PIN lock implementation
[ jonas-drange ]
* [main panel] add visual feedback on press
* [cellular] uses modemtechnologies property from ofono to populate
  technology preference options (LP: #1346790)
[ Sebastien Bacher ]
* [language] workaround inconsistent languages casing (LP: #1362123)
* [background] Display the default background selected (LP: #1349329)
* [storage] display translated names (LP: #1360207)
* [updates] don't display animations when clicking on update rows (LP:
  #1360364)
* [background] don't use an icon in the headerbar (LP: #1362122)
[ Mathieu Trudel-Lapierre ]
* Fix PIN code or passcode requests by properly matching the tag for
  the original request. (LP: #1355152)
[ Martin Pitt ]
* Update PO template
[ Sebastien Bacher ]
* Include extra files for translations (LP: #1359267)
[ jonas-drange ]
* [main panel] show rotation lock, point to correct setting
[ Ken VanDine ]
* Hide sleep locks immediately setting, which isn't implemented yet
  (LP: #1361297) (LP: #1361297)
[ Sebastien Bacher ]
* [system-update] rework the ui to use a column rather than anchors,
  the layout is quite dynamic and it should be easier to position and
  stack widgets this way (LP: #1343172)
[ Michael Terry ]
* After selecting the language, update the session environment
  immediately and restart indicators so that their notifications (like
  wifi prompt) are translated. (LP: #1354325)
[ Ken VanDine ]
* Added autopilot tests for security-privacy
[ jonas-drange ]
* [phone] adding dual sim functionality to phone panel
[ Charles Kerr ]
* In the welcome wizard, refresh the text in the 'no sim card' and
  'all done' pages to match the latest from design.
[ Michael Terry ]
* Add a location page and a terms and conditions page for the HERE
  service.
[ Ken VanDine ]
* Settings for idle/lock timeout (LP: #1230345)
* Added flickable to fix scrolling (LP: #1354161)
[ Jussi Pakkanen ]
* Fix a bunch of compiler warnings.
[ jonas-drange ]
* [cellular] displays cellular UIs based on how many SIMs are present.
  (LP: #1357393)

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
20
20
 */
21
21
 
 
22
import QMenuModel 0.1
22
23
import QtQuick 2.0
23
24
import QtSystemInfo 5.0
24
25
import SystemSettings 1.0
25
26
import Ubuntu.Components 0.1
26
27
import Ubuntu.Components.ListItems 0.1 as ListItem
27
28
import Ubuntu.Components.Popups 0.1
 
29
import Ubuntu.OnlineAccounts.Client 0.1
28
30
import Ubuntu.SystemSettings.Update 1.0
 
31
import Ubuntu.Connectivity 1.0
29
32
 
30
33
 
31
34
ItemPage {
32
35
    id: root
33
36
    objectName: "systemUpdatesPage"
34
37
 
35
 
    title: i18n.tr("Updates")
36
 
    flickable: null
 
38
    title: installingImageUpdate.visible ? "" : i18n.tr("Updates")
 
39
    flickable: installingImageUpdate.visible ? null : scrollWidget
37
40
 
38
41
    property bool installAll: false
39
42
    property bool includeSystemUpdate: false
 
43
    property bool systemUpdateInProgress: false
40
44
    property int updatesAvailable: 0
41
 
 
 
45
    property bool isCharging: false
 
46
    property bool batterySafeForUpdate: isCharging || chargeLevel > 25
 
47
    property var chargeLevel: indicatorPower.batteryLevel || 0
42
48
    property var notificationAction;
 
49
    property string errorDialogText: ""
 
50
 
 
51
    QDBusActionGroup {
 
52
        id: indicatorPower
 
53
        busType: 1
 
54
        busName: "com.canonical.indicator.power"
 
55
        objectPath: "/com/canonical/indicator/power"
 
56
        property variant batteryLevel: action("battery-level").state
 
57
        Component.onCompleted: start()
 
58
    }
 
59
 
 
60
    Connections {
 
61
        id: networkingStatus
 
62
        target: NetworkingStatus
 
63
        onOnlineChanged: {
 
64
            if (NetworkingStatus.online) {
 
65
                activity.running = true;
 
66
                root.state = "SEARCHING";
 
67
                UpdateManager.checkUpdates();
 
68
            } else {
 
69
                activity.running = false;
 
70
            }
 
71
        }
 
72
    }
 
73
 
43
74
 
44
75
    DeviceInfo {
45
76
        id: deviceInfo
46
77
    }
47
78
 
 
79
    BatteryInfo {
 
80
        id: batteryInfo
 
81
        monitorChargingState: true
 
82
 
 
83
        onChargingStateChanged: {
 
84
            if (state === BatteryInfo.Charging) {
 
85
                isCharging = true
 
86
            }
 
87
            else if (state === BatteryInfo.Discharging &&
 
88
                     batteryInfo.batteryStatus(0) !== BatteryInfo.BatteryFull) {
 
89
                isCharging = false
 
90
            }
 
91
            else if (batteryInfo.batteryStatus(0) === BatteryInfo.BatteryFull ||
 
92
                     state === BatteryInfo.NotCharging) {
 
93
                isCharging = true
 
94
            }
 
95
        }
 
96
        Component.onCompleted: {
 
97
            onChargingStateChanged(0, chargingState(0))
 
98
        }
 
99
    }
 
100
 
 
101
    Setup {
 
102
        id: uoaConfig
 
103
        applicationId: "ubuntu-system-settings"
 
104
        providerId: "ubuntuone"
 
105
 
 
106
        onFinished: {
 
107
            credentialsNotification.visible = false;
 
108
            root.state = "SEARCHING";
 
109
            UpdateManager.checkUpdates();
 
110
        }
 
111
    }
 
112
 
48
113
    Component {
49
114
         id: dialogInstallComponent
50
115
         Dialog {
51
116
             id: dialogueInstall
52
117
             title: i18n.tr("Update System")
53
 
             text: i18n.tr("The phone needs to restart to install the system update.")
 
118
             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.")
54
119
 
55
120
             Button {
56
121
                 text: i18n.tr("Install & Restart")
 
122
                 visible: root.batterySafeForUpdate ? true : false
57
123
                 color: UbuntuColors.orange
58
124
                 onClicked: {
59
125
                     installingImageUpdate.visible = true;
60
 
                     updateManager.applySystemUpdate();
 
126
                     UpdateManager.applySystemUpdate();
61
127
                     PopupUtils.close(dialogueInstall);
62
128
                 }
63
129
             }
67
133
                 onClicked: {
68
134
                     updateList.currentIndex = 0;
69
135
                     var item = updateList.currentItem;
70
 
                     var modelItem = updateManager.model[0];
 
136
                     var modelItem = UpdateManager.model[0];
71
137
                     item.actionButton.text = i18n.tr("Install");
 
138
                     item.progressBar.opacity = 0;
72
139
                     modelItem.updateReady = true;
 
140
                     modelItem.selected = false;
 
141
                     root.systemUpdateInProgress = false;
73
142
                     PopupUtils.close(dialogueInstall);
74
143
                 }
75
144
             }
76
145
         }
77
146
    }
78
147
 
 
148
    Component {
 
149
         id: dialogErrorComponent
 
150
         Dialog {
 
151
             id: dialogueError
 
152
             title: i18n.tr("Installation failed")
 
153
             text: root.errorDialogText
 
154
 
 
155
             Button {
 
156
                 text: i18n.tr("OK")
 
157
                 color: UbuntuColors.orange
 
158
                 onClicked: {
 
159
                     PopupUtils.close(dialogueError);
 
160
                 }
 
161
             }
 
162
         }
 
163
    }
 
164
 
79
165
    //states
80
166
    states: [
81
167
        State {
83
169
            PropertyChanges { target: installAllButton; visible: false}
84
170
            PropertyChanges { target: checkForUpdatesArea; visible: true}
85
171
            PropertyChanges { target: updateNotification; visible: false}
 
172
            PropertyChanges { target: activity; running: true}
86
173
        },
87
174
        State {
88
175
            name: "NOUPDATES"
101
188
        State {
102
189
            name: "UPDATE"
103
190
            PropertyChanges { target: updateList; visible: true}
104
 
            PropertyChanges { target: installAllButton; visible: true && root.updatesAvailable > 1}
 
191
            PropertyChanges { target: installAllButton; visible: root.updatesAvailable > 1}
105
192
            PropertyChanges { target: updateNotification; visible: false}
106
193
        }
107
194
    ]
108
195
 
109
 
    function open_online_accounts() {
110
 
        Qt.openUrlExternally("settings:///system/online-accounts");
111
 
    }
112
 
 
113
 
    UpdateManager {
 
196
    Connections {
114
197
        id: updateManager
 
198
        target: UpdateManager
115
199
        objectName: "updateManager"
116
200
 
117
201
        Component.onCompleted: {
118
202
            credentialsNotification.visible = false;
119
203
            root.state = "SEARCHING";
120
 
            updateManager.checkUpdates();
 
204
            UpdateManager.checkUpdates();
121
205
        }
122
206
 
123
207
        onUpdateAvailableFound: {
124
 
            root.updatesAvailable = updateManager.model.length;
 
208
            root.updatesAvailable = UpdateManager.model.length;
125
209
            if (root.updatesAvailable > 0)
126
 
                root.includeSystemUpdate = updateManager.model[0].systemUpdate
 
210
                root.includeSystemUpdate = UpdateManager.model[0].systemUpdate
127
211
            root.state = "UPDATE";
128
212
            root.installAll = downloading;
129
213
        }
140
224
 
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;
146
227
        }
147
228
 
148
229
        onSystemUpdateDownloaded: {
149
 
            root.updatesAvailable -= 1;
150
 
            PopupUtils.open(dialogInstallComponent);
 
230
            root.installAll = false;
151
231
        }
152
232
 
153
233
        onSystemUpdateFailed: {
154
234
            root.state = "SYSTEMUPDATEFAILED";
155
 
            if (lastReason) {
156
 
                notification.text = lastReason;
157
 
            } else {
158
 
                notification.text = i18n.tr("System update has failed.");
159
 
            }
160
 
            notification.progression = false;
161
 
            notificationAction = undefined;
 
235
            root.errorDialogText = i18n.tr("Sorry, the system update failed.");
 
236
            PopupUtils.open(dialogErrorComponent);
162
237
        }
163
238
 
164
239
        onUpdateProcessFailed: {
165
240
            root.state = "SYSTEMUPDATEFAILED";
166
 
            if (message) {
167
 
                notification.text = message;
168
 
            } else {
169
 
                notification.text = i18n.tr("System update failed.");
170
 
            }
 
241
            root.errorDialogText = i18n.tr("Sorry, the system update failed.");
 
242
            PopupUtils.open(dialogErrorComponent);
 
243
        }
 
244
 
 
245
        onServerError: {
 
246
            activity.running = false;
 
247
        }
 
248
 
 
249
        onNetworkError: {
 
250
            activity.running = false;
 
251
        }
 
252
 
 
253
        onRebooting: {
 
254
            installingImageUpdate.message = i18n.tr("Restarting…");
171
255
        }
172
256
    }
173
 
 
174
 
    Item {
175
 
        id: checkForUpdatesArea
176
 
        objectName: "checkForUpdatesArea"
177
 
        visible: false
178
 
        anchors {
179
 
            left: parent.left
180
 
            right: parent.right
181
 
            top: parent.top
182
 
            topMargin: units.gu(2)
183
 
            leftMargin: units.gu(4)
184
 
            rightMargin: units.gu(4)
185
 
        }
186
 
        height: installAllButton.height
187
 
 
188
 
        ActivityIndicator {
189
 
            id: activity
190
 
            running: checkForUpdatesArea.visible
191
 
            visible: activity.running
 
257
    Flickable {
 
258
        id: scrollWidget
 
259
 
 
260
        anchors.top: parent.top
 
261
        anchors.left: parent.left
 
262
        anchors.right: parent.right
 
263
        anchors.bottom: configuration.top
 
264
 
 
265
        contentHeight: contentItem.childrenRect.height
 
266
        boundsBehavior: (contentHeight > root.height) ? Flickable.DragAndOvershootBounds : Flickable.StopAtBounds
 
267
        clip: true
 
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
 
271
 
 
272
        Column {
 
273
            id: columnId
192
274
            anchors {
193
275
                left: parent.left
194
 
                top: parent.top
195
 
                topMargin: units.gu(1)
196
 
            }
197
 
        }
198
 
 
199
 
        Label {
200
 
            text: i18n.tr("Checking for updates…")
201
 
            verticalAlignment: Text.AlignVCenter
202
 
            elide: Text.ElideRight
203
 
            anchors {
204
 
                left: activity.right
205
 
                top: parent.top
206
 
                right: checkForUpdatesArea.right
207
 
                bottom: parent.bottom
208
 
                leftMargin: units.gu(2)
209
 
                rightMargin: units.gu(2)
210
 
            }
211
 
        }
212
 
    }
213
 
 
214
 
    Button {
215
 
        id: installAllButton
216
 
        objectName: "installAllButton"
217
 
 
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
221
 
        anchors {
222
 
            left: parent.left
223
 
            right: parent.right
224
 
            top: parent.top
225
 
            topMargin: units.gu(2)
226
 
            leftMargin: units.gu(4)
227
 
            rightMargin: units.gu(4)
228
 
        }
229
 
        visible: false
230
 
 
231
 
        color: UbuntuColors.orange
232
 
        onClicked: {
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();
240
 
                }
241
 
            }
242
 
        }
243
 
        opacity: root.updatesAvailable > 0 ? 1 : 0
244
 
 
245
 
        Behavior on opacity { PropertyAnimation { duration: UbuntuAnimation.SlowDuration
246
 
                easing: UbuntuAnimation.StandardEasing } }
247
 
    }
248
 
 
249
 
    ListView {
250
 
        id: updateList
251
 
        objectName: "updateList"
252
 
        visible: false
253
 
        anchors {
254
 
            left: parent.left
255
 
            right: parent.right
256
 
            top: installAllButton.visible ? installAllButton.bottom : parent.top
257
 
            bottom: notification.visible ? notification.top : configuration.top
258
 
            margins: units.gu(2)
259
 
            bottomMargin: 0
260
 
        }
261
 
        model: updateManager.model
262
 
        clip: true
263
 
        contentHeight: contentItem.childrenRect.height
264
 
        boundsBehavior: (contentHeight > (root.height - checkForUpdatesArea.height)) ? Flickable.DragAndOvershootBounds : Flickable.StopAtBounds
265
 
 
266
 
        delegate: ListItem.Subtitled {
267
 
            id: listItem
268
 
            iconSource: Qt.resolvedUrl(modelData.iconUrl)
269
 
            height: modelData.selected ? units.gu(14) : units.gu(8)
270
 
            showDivider: false
271
 
 
272
 
            property alias actionButton: buttonAppUpdate
273
 
 
274
 
            Rectangle {
275
 
                id: textArea
276
 
                objectName: "textArea"
277
 
                color: "transparent"
278
 
                anchors.fill: parent
279
 
                anchors.topMargin: units.gu(1)
280
 
 
281
 
                property string message: modelData.error
282
 
                property bool retry: false
283
 
 
284
 
                onMessageChanged: {
285
 
                    if(message.length > 0) {
286
 
                        labelVersion.text = message;
287
 
                        buttonAppUpdate.text = i18n.tr("Retry");
 
276
                right: parent.right
 
277
            }
 
278
            height: childrenRect.height
 
279
            
 
280
            ListItem.Base {
 
281
                id: checkForUpdatesArea
 
282
                objectName: "checkForUpdatesArea"
 
283
                showDivider: false
 
284
                visible: false
 
285
 
 
286
                ActivityIndicator {
 
287
                    id: activity
 
288
                    running: checkForUpdatesArea.visible
 
289
                    visible: activity.running
 
290
                    anchors {
 
291
                        left: parent.left
 
292
                        top: parent.top
 
293
                    }
 
294
                    height: parent.height
 
295
                }
 
296
 
 
297
                Label {
 
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
 
301
                    anchors {
 
302
                        left: activity.running ? activity.right : parent.left
 
303
                        top: parent.top
 
304
                        right: btnRetry.left
 
305
                        rightMargin: units.gu(2)
 
306
                        leftMargin: units.gu(2)
 
307
                    }
 
308
                    height: parent.height
 
309
                }
 
310
 
 
311
                Button {
 
312
                    id: btnRetry
 
313
                    text: i18n.tr("Retry")
 
314
                    color: UbuntuColors.orange
 
315
                    anchors {
 
316
                        right: parent.right
 
317
                        top: parent.top
 
318
                        bottom: parent.bottom
 
319
                        margins: units.gu(1)
 
320
                    }
 
321
                    visible: !activity.visible
 
322
 
 
323
                    onClicked: {
 
324
                        activity.running = true;
 
325
                        root.state = "SEARCHING";
 
326
                        UpdateManager.checkUpdates();
 
327
                    }
 
328
                }
 
329
            }
 
330
 
 
331
            ListItem.SingleControl {
 
332
                height: installAllButton.visible ? units.gu(8) : units.gu(2)
 
333
                highlightWhenPressed: false
 
334
                control: Button {
 
335
                    id: installAllButton
 
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)
 
344
 
 
345
                    onClicked: {
 
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)
 
351
                                continue;
 
352
                            console.warn("AllClicked: " + modelItem.updateState + " " + modelItem.updateReady + " " +  modelItem.selected);
 
353
                            if (item.retry) {
 
354
                                item.retry = false;
 
355
                                UpdateManager.retryDownload(modelItem.packageName);
 
356
                                continue;
 
357
                            }
 
358
                            if (root.installAll && !modelItem.updateReady && modelItem.selected) {
 
359
                                item.pause();
 
360
                                continue;
 
361
                            }
 
362
                            console.warn("Past pause");
 
363
                            if (!root.installAll && !modelItem.updateReady && modelItem.selected) {
 
364
                                item.resume();
 
365
                                continue;
 
366
                            }
 
367
                            console.warn("Past resume");
 
368
                            if (!root.installAll && !modelItem.updateState && !modelItem.updateReady && !modelItem.selected) {
 
369
                                item.start();
 
370
                                continue;
 
371
                            }
 
372
                            console.warn("Past start");
 
373
                        }
 
374
                        root.installAll = !root.installAll;
 
375
                    }
 
376
                }
 
377
                showDivider: false
 
378
            }
 
379
 
 
380
            ListView {
 
381
                id: updateList
 
382
                objectName: "updateList"
 
383
                anchors {
 
384
                    left: parent.left
 
385
                    right: parent.right
 
386
                }
 
387
                model: UpdateManager.model
 
388
                height: childrenRect.height
 
389
                interactive: false
 
390
                spacing: units.gu(2)
 
391
 
 
392
                delegate: ListItem.Subtitled {
 
393
                    id: listItem
 
394
                    anchors {
 
395
                        left: parent.left
 
396
                        right: parent.right
 
397
                    }
 
398
                    iconSource: Qt.resolvedUrl(modelData.iconUrl)
 
399
                    iconFrame: modelData.systemUpdate ? false : true
 
400
                    height: visible ? textArea.height : 0
 
401
                    highlightWhenPressed: false
 
402
                    showDivider: false
 
403
                    visible: opacity > 0
 
404
                    opacity: installed ? 0 : 1
 
405
                    Behavior on opacity { PropertyAnimation { duration: UbuntuAnimation.SleepyDuration } }
 
406
 
 
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
 
412
 
 
413
                    function pause () {
 
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;
291
 
                    }
292
 
                }
293
 
 
 
418
                        tracker.pause();
 
419
                    }
 
420
 
 
421
                    function resume () {
 
422
                        console.warn("RESUME: " + modelData.packageName);
 
423
                        if (modelData.systemUpdate)
 
424
                            return UpdateManager.startDownload(modelData.packageName);
 
425
                        modelData.updateState = true;
 
426
                        tracker.resume();
 
427
                    }
 
428
 
 
429
                    function start () {
 
430
                        console.warn("START: " + modelData.packageName);
 
431
                        modelData.selected = true;
 
432
                        modelData.updateState = true;
 
433
                        UpdateManager.startDownload(modelData.packageName);
 
434
                    }
 
435
                    Column {
 
436
                        id: textArea
 
437
                        objectName: "textArea"
 
438
                        anchors {
 
439
                            left: parent.left
 
440
                            right: parent.right
 
441
                        }
 
442
                        spacing: units.gu(0.5)
 
443
 
 
444
                        Item {
 
445
                            anchors {
 
446
                                left: parent.left
 
447
                                right: parent.right
 
448
                            }
 
449
                            height: buttonAppUpdate.height
 
450
                            
 
451
                            Label {
 
452
                                id: labelTitle
 
453
                                objectName: "labelTitle"
 
454
                                anchors {
 
455
                                    left: parent.left
 
456
                                    right: buttonAppUpdate.visible ? buttonAppUpdate.left : parent.right
 
457
                                    verticalCenter: parent.verticalCenter
 
458
                                }
 
459
                                text: modelData.title
 
460
                                font.bold: true
 
461
                                elide: Text.ElideMiddle
 
462
                            }
 
463
 
 
464
                            Button {
 
465
                                id: buttonAppUpdate
 
466
                                objectName: "buttonAppUpdate"
 
467
                                anchors.right: parent.right
 
468
                                height: labelTitle.height + units.gu(1)
 
469
                                enabled: !installing 
 
470
                                text: {
 
471
                                    if (retry)
 
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");
 
478
                                        }
 
479
                                    }
 
480
                                    if (modelData.updateState) {
 
481
                                        return i18n.tr("Pause");
 
482
                                    } else if (modelData.selected) {
 
483
                                        return i18n.tr("Resume");
 
484
                                    }
 
485
                                    return i18n.tr("Update");
 
486
                                }
 
487
 
 
488
                                onClicked: {
 
489
                                    if (retry) {
 
490
                                        retry = false;
 
491
                                        return UpdateManager.retryDownload(modelData.packageName);
 
492
                                    }
 
493
                                    if (modelData.updateState)
 
494
                                        return pause();
 
495
                                    if (!modelData.updateState && modelData.selected)
 
496
                                        return resume();
 
497
                                    if (!modelData.updateState && !modelData.selected && !modelData.updateReady)
 
498
                                        return start();
 
499
                                    if (modelData.updateReady)
 
500
                                        PopupUtils.open(dialogInstallComponent);
 
501
                                }
 
502
                            }
 
503
                        } 
 
504
                        
 
505
                        Item {
 
506
                            id: labelUpdateStatus
 
507
                            anchors {
 
508
                                left: parent.left
 
509
                                right: parent.right
 
510
                            }
 
511
                            height: childrenRect.height
 
512
                            visible: opacity > 0
 
513
                            opacity: (modelData.updateState && modelData.selected && !modelData.updateReady) || (installing || installed) ? 1 : 0
 
514
                            Behavior on opacity { PropertyAnimation { duration: UbuntuAnimation.SleepyDuration } }
 
515
                            Label {
 
516
                                objectName: "labelUpdateStatus"
 
517
                                anchors.left: parent.left
 
518
                                anchors.right: updateStatusLabel.left
 
519
                                elide: Text.ElideMiddle
 
520
                                fontSize: "small"
 
521
                                text: {
 
522
                                    if (retry)
 
523
                                        return modelData.error;
 
524
                                    if (installing)
 
525
                                        return i18n.tr("Installing");
 
526
                                    if (installed)
 
527
                                        return i18n.tr("Installed");
 
528
                                    return i18n.tr("Downloading");
 
529
                                }
 
530
                            }
 
531
                            Label {
 
532
                                id: updateStatusLabel
 
533
                                anchors.right: parent.right
 
534
                                visible: !labelSize.visible && !installing && !installed
 
535
                                fontSize: "small"
 
536
                                text: {
 
537
                                    if (!labelUpdateStatus.visible)
 
538
                                        return convert_bytes_to_size(modelData.binaryFilesize);
 
539
 
 
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)
 
543
                                    );
 
544
                                }
 
545
                            }
 
546
                        }
 
547
 
 
548
                        ProgressBar {
 
549
                            id: progress
 
550
                            objectName: "progress"
 
551
                            height: units.gu(2)
 
552
                            anchors {
 
553
                                left: parent.left
 
554
                                right: parent.right
 
555
                            }
 
556
                            visible: opacity > 0
 
557
                            opacity: modelData.selected && !modelData.updateReady && !installed ? 1 : 0
 
558
                            value: modelData.systemUpdate ? modelData.downloadProgress : tracker.progress
 
559
                            minimumValue: 0
 
560
                            maximumValue: 100
 
561
 
 
562
                            DownloadTracker {
 
563
                                id: tracker
 
564
                                objectName: "tracker"
 
565
                                packageName: modelData.packageName
 
566
                                clickToken: modelData.clickToken
 
567
                                download: modelData.downloadUrl
 
568
 
 
569
                                onFinished: {
 
570
                                    progress.visible = false;
 
571
                                    buttonAppUpdate.visible = false;
 
572
                                    installed = true;
 
573
                                    installing = false;
 
574
                                    root.updatesAvailable -= 1;
 
575
                                    modelData.updateRequired = false;
 
576
                                    UpdateManager.updateClickScope();
 
577
                                }
 
578
 
 
579
                                onProcessing: {
 
580
                                    console.warn("onProcessing: " + modelData.packageName + " " + path);
 
581
                                    buttonAppUpdate.enabled = false;
 
582
                                    installing = true;
 
583
                                    modelData.updateState = false;
 
584
                                }
 
585
 
 
586
                                onStarted: {
 
587
                                    console.warn("onStarted: " + modelData.packageName + " " + success);
 
588
                                    if (success)
 
589
                                        modelData.updateState = true;
 
590
                                    else
 
591
                                        modelData.updateState = false;
 
592
                                }
 
593
 
 
594
                                onPaused: {
 
595
                                    console.warn("onPaused: " + modelData.packageName + " " + success);
 
596
                                    if (success)
 
597
                                        modelData.updateState = false;
 
598
                                    else
 
599
                                        modelData.updateState = true;
 
600
                                }
 
601
 
 
602
                                onResumed: {
 
603
                                    console.warn("onResumed: " + modelData.packageName + " " + success);
 
604
                                    if (success)
 
605
                                        modelData.updateState = true;
 
606
                                    else
 
607
                                        modelData.updateState = false;
 
608
                                }
 
609
 
 
610
                                onCanceled: {
 
611
                                    console.warn("onCanceled: " + modelData.packageName + " " + success);
 
612
                                    if (success) {
 
613
                                        modelData.updateState = false;
 
614
                                        modelData.selected = false;
 
615
                                    }
 
616
                                }
 
617
 
 
618
                                onErrorFound: {
 
619
                                    console.warn("onErrorFound: " + modelData.packageName + " " + error);
 
620
                                    modelData.updateState = false;
 
621
                                    retry = true;
 
622
                                    installing = false;
 
623
                                }
 
624
                            }
 
625
 
 
626
                            Behavior on opacity { PropertyAnimation { duration: UbuntuAnimation.SleepyDuration } }
 
627
                        }
 
628
 
 
629
                        Item {
 
630
                            anchors {
 
631
                                left: parent.left
 
632
                                right: parent.right
 
633
                            }
 
634
                            height: childrenRect.height
 
635
                            Label {
 
636
                                id: labelVersion
 
637
                                objectName: "labelVersion"
 
638
                                anchors.left: parent.left
 
639
                                text: modelData.remoteVersion ? i18n.tr("Version: ") + modelData.remoteVersion : ""
 
640
                                elide: Text.ElideRight
 
641
                                fontSize: "small"
 
642
                            }
 
643
                            
 
644
                            Label {
 
645
                                id: labelSize
 
646
                                objectName: "labelSize"
 
647
                                anchors.right: parent.right
 
648
                                text: convert_bytes_to_size(modelData.binaryFilesize)
 
649
                                fontSize: "small"
 
650
                                visible: !labelUpdateStatus.visible && !installing && !installed
 
651
                            }
 
652
                        }
 
653
                    }
 
654
                }
 
655
            }
 
656
 
 
657
            Column {
 
658
                id: credentialsNotification
 
659
                objectName: "credentialsNotification"
 
660
 
 
661
                visible: false
 
662
 
 
663
                spacing: units.gu(2)
 
664
                anchors {
 
665
                    left: parent.left
 
666
                    right: parent.right
 
667
                }
 
668
                ListItem.ThinDivider {}
 
669
 
 
670
                Label {
 
671
                    text: i18n.tr("Sign in to Ubuntu One to receive updates for apps.")
 
672
                    horizontalAlignment: Text.AlignHCenter
 
673
                    wrapMode: Text.Wrap
 
674
                    anchors {
 
675
                        left: parent.left
 
676
                        right: parent.right
 
677
                    }
 
678
                }
294
679
                Button {
295
 
                    id: buttonAppUpdate
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
302
 
 
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")
306
 
 
307
 
                    text: modelData.updateState ? secondaryText : primaryText
308
 
 
309
 
                    onClicked: {
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);
319
 
                            } else {
320
 
                                modelData.updateState = false;
321
 
                                tracker.pause();
322
 
                            }
323
 
                        } else {
324
 
                            if (!modelData.selected || modelData.systemUpdate) {
325
 
                                modelData.selected = true;
326
 
                                updateManager.startDownload(modelData.packageName);
327
 
                            } else {
328
 
                                modelData.updateState = true;
329
 
                                tracker.resume();
330
 
                            }
331
 
                        }
332
 
                    }
333
 
                }
334
 
 
335
 
                Label {
336
 
                    id: labelSize
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
343
 
                }
344
 
 
345
 
                Label {
346
 
                    id: labelTitle
347
 
                    objectName: "labelTitle"
348
 
                    anchors {
349
 
                        top: parent.top
350
 
                        left: parent.left
351
 
                        right: buttonAppUpdate.left
352
 
                        topMargin: units.gu(1)
353
 
                        rightMargin: units.gu(1)
354
 
                    }
355
 
                    height: units.gu(3)
356
 
                    text: modelData.title
357
 
                    font.bold: true
358
 
                    elide: buttonAppUpdate.visible ? Text.ElideRight : Text.ElideNone
359
 
                }
360
 
 
361
 
                Label {
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)
370
 
 
371
 
                    Behavior on opacity { PropertyAnimation { duration: UbuntuAnimation.SleepyDuration } }
372
 
                }
373
 
 
374
 
                ProgressBar {
375
 
                    id: progress
376
 
                    objectName: "progress"
377
 
                    height: units.gu(2)
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
384
 
                    minimumValue: 0
385
 
                    maximumValue: 100
386
 
 
387
 
                    DownloadTracker {
388
 
                        id: tracker
389
 
                        objectName: "tracker"
390
 
                        packageName: modelData.packageName
391
 
                        clickToken: modelData.clickToken
392
 
                        download: modelData.downloadUrl
393
 
 
394
 
                        onFinished: {
395
 
                            progress.visible = false;
396
 
                            buttonAppUpdate.visible = false;
397
 
                            textArea.message = i18n.tr("Installed");
398
 
                            root.updatesAvailable -= 1;
399
 
                        }
400
 
 
401
 
                        onErrorFound: {
402
 
                            modelData.updateState = false;
403
 
                            textArea.message = error;
404
 
                        }
405
 
                    }
406
 
 
407
 
                    Behavior on opacity { PropertyAnimation { duration: UbuntuAnimation.SleepyDuration } }
408
 
                }
409
 
 
410
 
                Label {
411
 
                    id: labelVersion
412
 
                    objectName: "labelVersion"
413
 
                    anchors {
414
 
                        left: parent.left
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)
420
 
                    }
421
 
                    text: modelData.remoteVersion ? i18n.tr("Version: ") + modelData.remoteVersion : ""
422
 
                    color: "black"
423
 
                    elide: Text.ElideRight
424
 
                }
425
 
            }
426
 
        }
427
 
    }
428
 
 
429
 
    ListItem.Standard {
430
 
        id: notification
431
 
        objectName: "notification"
432
 
        visible: updateNotification.visible || credentialsNotification.visible ? true : false
433
 
        anchors.bottom: configuration.top
434
 
 
435
 
        onClicked: {
436
 
            if (notificationAction) {
437
 
                notificationAction();
438
 
            }
439
 
        }
440
 
    }
441
 
 
442
 
    ListItem.SingleValue {
443
 
        id: configuration
444
 
        objectName: "configuration"
445
 
        anchors.bottom: parent.bottom
446
 
        text: i18n.tr("Auto download")
447
 
        value: {
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")
454
 
        }
455
 
       progression: true
456
 
       onClicked: pageStack.push(Qt.resolvedUrl("Configuration.qml"), {updateManager: updateManager})
 
680
                    text: i18n.tr("Sign In…")
 
681
                    anchors {
 
682
                        left: parent.left
 
683
                        right: parent.right
 
684
                        leftMargin: units.gu(2)
 
685
                        rightMargin: units.gu(2)
 
686
                    }
 
687
                    onClicked: uoaConfig.exec()
 
688
                }
 
689
 
 
690
            }
 
691
        }
457
692
    }
458
693
 
459
694
    Rectangle {
460
695
        id: updateNotification
461
696
        objectName: "updateNotification"
462
697
        anchors {
 
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
467
 
            margins: units.gu(2)
468
 
            bottomMargin: 0
 
701
            top: parent.top
469
702
        }
470
703
        visible: false
471
704
        property string text: ""
482
715
    }
483
716
 
484
717
    Rectangle {
485
 
        id: credentialsNotification
486
 
        objectName: "credentialsNotification"
487
 
        anchors {
488
 
            left: parent.left
489
 
            right: parent.right
490
 
            top: installAllButton.bottom
491
 
            bottom: notification.visible ? notification.top : configuration.top
492
 
            margins: units.gu(2)
493
 
            bottomMargin: 0
494
 
        }
495
 
        visible: false
496
 
 
497
 
        color: "transparent"
498
 
 
499
 
        Column {
500
 
            anchors.centerIn: parent
501
 
 
502
 
            Label {
503
 
                text: i18n.tr("Credentials not found")
504
 
                anchors.horizontalCenter: parent.horizontalCenter
505
 
                fontSize: "large"
506
 
            }
507
 
        }
508
 
    }
509
 
 
510
 
    Rectangle {
511
718
        id: installingImageUpdate
512
719
        objectName: "installingImageUpdate"
513
 
        anchors.fill: parent
 
720
        anchors.fill: root
514
721
        visible: false
515
 
 
 
722
        z: 10
516
723
        color: "#221e1c"
 
724
        property string message: i18n.tr("Installing update…")
517
725
 
518
726
        Column {
519
727
            anchors.centerIn: parent
522
730
            Image {
523
731
                source: Qt.resolvedUrl("file:///usr/share/ubuntu/settings/system/icons/distributor-logo.png")
524
732
                anchors.horizontalCenter: parent.horizontalCenter
 
733
                NumberAnimation on rotation {
 
734
                    from: 0
 
735
                    to: 360
 
736
                    running: installingImageUpdate.visible == true
 
737
                    loops: Animation.Infinite
 
738
                    duration: 2000
 
739
                }
525
740
            }
526
741
 
527
742
            ProgressBar {
530
745
            }
531
746
 
532
747
            Label {
533
 
                text: i18n.tr("Installing update…")
 
748
                text: installingImageUpdate.message
534
749
                anchors.horizontalCenter: parent.horizontalCenter
535
750
            }
536
751
        }
537
752
    }
538
753
 
 
754
    Column {
 
755
        id: configuration
 
756
 
 
757
        anchors.bottom: parent.bottom
 
758
        anchors.left: parent.left
 
759
        anchors.right: parent.right
 
760
        ListItem.ThinDivider {}
 
761
        ListItem.SingleValue {
 
762
            objectName: "configuration"
 
763
            text: i18n.tr("Auto download")
 
764
            value: {
 
765
                if (UpdateManager.downloadMode === 0)
 
766
                    return i18n.tr("Never")
 
767
                else if (UpdateManager.downloadMode === 1)
 
768
                    return i18n.tr("On wi-fi")
 
769
                else if (UpdateManager.downloadMode === 2)
 
770
                    return i18n.tr("Always")
 
771
            }
 
772
            progression: true
 
773
            onClicked: pageStack.push(Qt.resolvedUrl("Configuration.qml"))
 
774
        }
 
775
    }
 
776
 
539
777
    function convert_bytes_to_size(bytes) {
540
778
        var SIZE_IN_GIB = 1024.0 * 1024.0 * 1024.0;
541
779
        var SIZE_IN_MIB = 1024.0 * 1024.0;