WWW update
[ubi] / qml / ubi / InitPage.qml
1 import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
2 import "UIConstants.js" as Const
3 import "u1.js" as U1
4 import "components"
5
6 Showable {
7     id: root
8
9     hidden: false
10
11     Component.onCompleted: init()
12
13     function init() {
14         if(Utils.isAuthorized()) {
15             //title = "Hi, "+Utils.name();
16             login();
17         } else {
18             pageStack.initialPage = "LoginPage.qml";
19             hide();
20         }
21     }
22
23     function login() {
24         pageStack.currentPage.init();
25     }
26
27     function onRespRootNode(resp) {
28         hide();
29     }
30
31     function onErr(status) {
32         if(status==401) {
33             hide()
34             tip.show(qsTr("Ubuntu One authorization has failed. Try once again or check login settings."));
35         } else if(status==0) {
36             hide()
37             tip.show(qsTr("Unable to connect. Check internet connection and restart application."));
38         } else {
39             hide()
40             tip.show(qsTr("Unknown error: ")+status);
41         }
42     }
43
44     MouseArea {
45         anchors.fill: parent
46     }
47
48     Rectangle {
49         id: box
50
51         width: root.width; height: root.height
52         color: Const.DEFAULT_BACKGROUND_COLOR
53
54         Column {
55             spacing: Const.TEXT_MARGIN
56             anchors.horizontalCenter: parent.horizontalCenter
57             anchors.verticalCenter: parent.verticalCenter
58
59             Image {
60                 id: pic
61                 source: "images/ubi100.png"
62                 width: 104; height: 70
63                 anchors.horizontalCenter: parent.horizontalCenter
64             }
65
66             Text {
67                 id: loading
68                 anchors.horizontalCenter: parent.horizontalCenter
69                 font.pixelSize: 25
70                 color: "white"
71                 text: qsTr("Connecting...")
72             }
73
74             BusyIndicator {
75                 id: busy
76                 anchors.horizontalCenter: parent.horizontalCenter
77                 running: true
78             }
79         }
80
81         Button {
82             id: close
83             iconSource: "images/close.png"
84             anchors { right: parent.right; top: parent.top; margins: Const.DEFAULT_MARGIN }
85             onButtonClicked: Qt.quit()
86         }
87
88         Text {
89             anchors.bottom: ver.top
90             anchors.horizontalCenter: parent.horizontalCenter
91             font.pixelSize: 20
92             color: "white"
93             text: "v0.9.4-1 © 2012 Michal Kosciesza"
94         }
95
96         Text {
97             id: ver
98             anchors.bottom: box.bottom
99             anchors.bottomMargin: 2*Const.TEXT_MARGIN
100             anchors.horizontalCenter: parent.horizontalCenter
101             font.pixelSize: 20
102             color: "white"
103             text: "http://ubi.garage.maemo.org"
104         }
105
106     }
107 }