@@ -1,144 +0,0 @@
1−/*
2− *
3− * Copyright (C) 2016 Canonical Ltd.
4− *
5− * This program is free software: you can redistribute it and/or modify it
6− * under the terms of the GNU General Public License version 3, as published
7− * by the Free Software Foundation.
8− *
9− * This program is distributed in the hope that it will be useful, but
10− * WITHOUT ANY WARRANTY; without even the implied warranties of
11− * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
12− * PURPOSE. See the GNU General Public License for more details.
13− *
14− * You should have received a copy of the GNU General Public License along
15− * with this program. If not, see <http://www.gnu.org/licenses/>.
16− */
17−
18−import QtQuick 2.4
19−import QtQuick.Layouts 1.1
20−import Ubuntu.Components 1.3
21−import Ubuntu.Components.ListItems 1.3 as ListItems
22−import Ubuntu.SystemSettings.Update 1.0
23−
24−Item {
25− id: g
26−
27− property bool batchMode
28− property int status // A UpdateManager::Status
29− property bool requireRestart: false
30− property int updatesCount: 0
31− property bool online: false
32−
33− property bool hidden: {
34− switch (status) {
35− case UpdateManager.StatusNetworkError:
36− case UpdateManager.StatusServerError:
37− return true;
38− }
39− return !online ||
40− (updatesCount <= 1 && status === UpdateManager.StatusIdle) ||
41− batchMode
42− }
43−
44− signal stop()
45− signal requestInstall()
46− signal install()
47−
48− Behavior on height {
49− UbuntuNumberAnimation {}
50− }
51−
52− RowLayout {
53− id: checking
54− spacing: units.gu(2)
55− anchors {
56− fill: parent
57− margins: units.gu(2)
58− }
59−
60− Behavior on opacity {
61− UbuntuNumberAnimation {}
62− }
63−
64− opacity: visible ? 1 : 0
65− visible: {
66− switch (g.status) {
67− case UpdateManager.StatusCheckingClickUpdates:
68− case UpdateManager.StatusCheckingImageUpdates:
69− case UpdateManager.StatusCheckingAllUpdates:
70− return true;
71− }
72− return false;
73− }
74−
75− ActivityIndicator {
76− running: parent.visible
77− }
78−
79− Label {
80− objectName: "checkLabel"
81− Layout.fillWidth: true
82− elide: Text.ElideRight
83− text: i18n.tr("Checking for updates…")
84− }
85−
86− Button {
87− objectName: "updatesGlobalStopButton"
88− text: i18n.tr("Stop")
89− onClicked: g.stop()
90− Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
91− }
92− }
93−
94− RowLayout {
95− id: install
96− anchors {
97− fill: parent
98− margins: units.gu(2)
99− }
100− spacing: units.gu(2)
101−
102− Behavior on opacity {
103− UbuntuNumberAnimation {}
104− }
105−
106− opacity: visible ? 1 : 0
107− visible: {
108− var canInstall = g.status === UpdateManager.StatusIdle;
109− return canInstall && updatesCount > 1;
110− }
111−
112− Label {
113− objectName: "updatesGlobalInfoLabel"
114− // // TRANSLATORS: %1 is number of software updates available.
115− text: i18n.tr("%1 update available",
116− "%1 updates available",
117− updatesCount).arg(updatesCount)
118− Layout.fillWidth: true
119− }
120−
121− Button {
122− objectName: "updatesGlobalInstallButton"
123− text: {
124− if (g.requireRestart === true) {
125− return i18n.tr("Update all…");
126− } else {
127− return i18n.tr("Update all");
128− }
129− }
130− onClicked: g.requestInstall()
131− color: theme.palette.normal.positive
132− strokeColor: "transparent"
133− }
134− }
135−
136− ListItems.ThinDivider {
137− visible: !g.hidden
138− anchors {
139− left: parent.left
140− right: parent.right
141− bottom: parent.bottom
142− }
143− }
144−}