summaryrefslogtreecommitdiffstats
path: root/framework/qml/StatusBar.qml
diff options
context:
space:
mode:
Diffstat (limited to 'framework/qml/StatusBar.qml')
-rw-r--r--framework/qml/StatusBar.qml79
1 files changed, 79 insertions, 0 deletions
diff --git a/framework/qml/StatusBar.qml b/framework/qml/StatusBar.qml
new file mode 100644
index 00000000..fa85f872
--- /dev/null
+++ b/framework/qml/StatusBar.qml
@@ -0,0 +1,79 @@
1/*
2 * Copyright (C) 2017 Christian Mollekopf, <mollekopf@kolabsys.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * 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, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19import QtQuick 2.7
20import org.kube.framework 1.0 as Kube
21
22Item {
23 id: root
24 property string accountId: ""
25 Repeater {
26 model: Kube.AccountsModel {
27 accountId: root.accountId
28 }
29
30 Column {
31 anchors.fill: root
32 spacing: Kube.Units.smallSpacing
33 Kube.Label {
34 id: statusText
35 anchors.horizontalCenter: parent.horizontalCenter
36 visible: false
37 color: Kube.Colors.highlightedTextColor
38 states: [
39 State {
40 name: "disconnected"; when: model.status == Kube.AccountsModel.OfflineStatus
41 PropertyChanges { target: statusBar; visible: true }
42 PropertyChanges { target: statusText; text: "Disconnected"; visible: true }
43 },
44 State {
45 name: "busy"; when: model.status == Kube.AccountsModel.BusyStatus
46 PropertyChanges { target: statusBar; visible: true }
47 PropertyChanges { target: statusText; text: "Synchronizing..."; visible: true }
48 PropertyChanges { target: progressBar; visible: true }
49 },
50 State {
51 name: "error"; when: model.status == Kube.AccountsModel.ErrorStatus
52 PropertyChanges { target: statusBar; visible: true }
53 //TODO get to an error description
54 PropertyChanges { target: statusText; text: "Error"; visible: true }
55 }
56 ]
57 }
58 Kube.ProgressBar {
59 id: progressBar
60 anchors.horizontalCenter: parent.horizontalCenter
61 height: 2
62 width: parent.width - Kube.Units.smallSpacing * 2
63
64 indeterminate: true
65 visible: false
66
67 Kube.Listener {
68 filter: Kube.Messages.progressNotification
69 onMessageReceived: {
70 progressBar.indeterminate = false
71 progressBar.from = 0
72 progressBar.to = message.total
73 progressBar.value = message.progress
74 }
75 }
76 }
77 }
78 }
79}