WWW update
[ubi] / qml / ubi / SettingsPage.qml
1 import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
2 import "components"
3 import "UIConstants.js" as Const
4
5 Page {
6     id: root
7     title: qsTr("Settings")
8
9     property alias taskMenu: taskMenu
10
11     Component.onCompleted: {
12         var _lang = Utils.locale();
13         if(_lang=="pl_PL")
14             lang.text = "Polski";
15         if(_lang=="it_IT")
16             lang.text = "Italiano";
17         if(_lang=="en_US")
18             lang.text = "English";
19
20         login.text = Utils.name();
21     }
22
23     Flickable {
24         width: root.width
25         height: root.height
26
27         contentHeight: content.height+Const.TOP_BAR_HEIGHT
28                        +Const.SYSTEM_BAR_HEIGHT+Const.TEXT_MARGIN
29         y: Const.TOP_BAR_HEIGHT
30
31         Column {
32             id: content
33             spacing: Const.DEFAULT_MARGIN
34             x: Const.TEXT_MARGIN
35
36             Text {
37                 font.pixelSize: 30
38                 color: "white"
39                 text: qsTr("Language:")
40             }
41             Text {
42                 id: lang
43                 font.pixelSize: 30
44                 color: "black"
45             }
46             Button {
47                 label: qsTr("Change")
48                 onButtonClicked: {
49                     dialogLang.open();
50                 }
51             }
52             Line {
53                 width: root.width-2*Const.TEXT_MARGIN
54             }
55             Text {
56                 font.pixelSize: 30
57                 color: "white"
58                 text: qsTr("Logged as:")
59             }
60             Text {
61                 id: login
62                 font.pixelSize: 30
63                 color: "black"
64             }
65             Button {
66                 label: qsTr("Log out")
67                 onButtonClicked: {
68                     Utils.resetAuthorization();
69                     pageStack.initialPage = "LoginPage.qml";
70                     pageStack.clear();
71                 }
72             }
73         }
74
75     }
76
77     DialogCombo {
78         id: dialogLang
79         z: 200
80         text: qsTr("Choose language:")
81         onOpened: {
82             mask.state = "dialog";
83         }
84         onClosed: {
85             mask.state = "idle";
86             Utils.setLocale(option);
87             tip.show(qsTr("Restart application!"));
88         }
89         onCanceled: {
90             mask.state = "idle";
91         }
92     }
93
94     TaskMenu {
95         z: 200
96         id: taskMenu
97         menuHeight: menuFixed.height+4*Const.DEFAULT_MARGIN
98
99         menuDynamic: _menuDyn
100         Flow {
101             y: root.height-taskMenu.menuHeight-Const.SYSTEM_BAR_HEIGHT+1*Const.DEFAULT_MARGIN
102             id: _menuDyn
103         }
104     }
105 }