WWW update
[ubi] / qml / ubi / LoginPage.qml
index 2c9202b..c5a16c7 100644 (file)
@@ -1,42 +1,13 @@
 import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
 import "components"
 import "u1.js" as U1
+import "UIConstants.js" as Const
 
 Page {
     id: root
     title: qsTr("Login")
     orientation: "auto"
 
-    Column {
-        id: column
-        anchors.centerIn: parent
-        spacing: 20
-
-        Text {
-            font.pixelSize: 30
-            color: "white"
-            text: qsTr("Ubuntu One sign in:")
-        }
-
-        TextField {
-            id: user
-            placeholderText: qsTr("User ID")
-            width: 400
-        }
-
-        TextField {
-            id: pass
-            width: 400
-            placeholderText: qsTr("Password")
-            echoMode: TextInput.Password
-        }
-
-        Button {
-            label: qsTr("Save")
-            onButtonClicked: root.getToken()
-        }
-    }
-
     function getToken() {
         mask.state = "busy";
         U1.getToken(user.text,pass.text,root)
@@ -51,18 +22,70 @@ Page {
         Utils.setName(account.username);
 
         tip.show(qsTr("Logged in!"));
-        pageStack.initialPage = "StartPage.qml";
+        pageStack.initialPage = "FilesPage.qml";
+        pageStack.currentPage.init();
     }
 
     function onErr(status) {
         mask.state = "idle";
-        //console.log("onErr");
         if(status==401) {
-            tip.show(qsTr("Authorization failed!"));
+            tip.show(qsTr("Ubuntu One authorization has failed. Try once again or check login settings."));
         } else if(status==0) {
-            tip.show(qsTr("Unable to connect!"));
+            tip.show(qsTr("Unable to connect. Check internet connection."));
         } else {
-            tip.show(qsTr("Error: ")+status);
+            tip.show(qsTr("Unknown error: ")+status);
         }
     }
+
+    Flickable {
+        width: root.width
+        height: root.height
+
+        contentHeight: content.height+Const.TOP_BAR_HEIGHT+Const.SYSTEM_BAR_HEIGHT+Const.TEXT_MARGIN
+
+        Column {
+            id: content
+            spacing: Const.DEFAULT_MARGIN
+            x: Const.TEXT_MARGIN
+            width: root.width-2*Const.TEXT_MARGIN
+
+            Spacer {}
+
+            Text {
+                font.pixelSize: 30
+                color: "white"
+                text: qsTr("Ubuntu One sign in:")
+            }
+
+            Spacer {}
+
+            TextField {
+                id: user
+                placeholderText: qsTr("User ID")
+                anchors.left: parent.left
+                anchors.right: parent.right
+            }
+
+            TextField {
+                id: pass
+                placeholderText: qsTr("Password")
+                echoMode: TextInput.Password
+                anchors.left: parent.left
+                anchors.right: parent.right
+            }
+
+            Spacer {}
+
+            Button {
+                label: qsTr("Save")
+                onButtonClicked: {
+                    root.getToken();
+                    user.closeSoftwareInputPanel();
+                    pass.closeSoftwareInputPanel();
+                }
+                anchors.left: parent.left
+            }
+        }
+    }
+
 }