2e29b097837ec5b035419224fbd2295e70fe3811
[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         } else {
16             lang.text = "English";
17         }
18         login.text = Utils.name();
19     }
20
21     Flickable {
22         width: root.width
23         height: root.height
24
25         contentHeight: content.height+Const.TOP_BAR_HEIGHT
26                        +Const.SYSTEM_BAR_HEIGHT+Const.TEXT_MARGIN
27         y: Const.TOP_BAR_HEIGHT
28
29         Column {
30             id: content
31             spacing: Const.DEFAULT_MARGIN
32             x: Const.TEXT_MARGIN
33
34             Text {
35                 font.pixelSize: 30
36                 color: "white"
37                 text: qsTr("Language:")
38             }
39             Text {
40                 id: lang
41                 font.pixelSize: 30
42                 color: "black"
43             }
44             Button {
45                 label: qsTr("Change")
46                 onButtonClicked: {
47                     dialogLang.open();
48                 }
49             }
50             Line {
51                 width: root.width-2*Const.TEXT_MARGIN
52             }
53             Text {
54                 font.pixelSize: 30
55                 color: "white"
56                 text: qsTr("Logged as:")
57             }
58             Text {
59                 id: login
60                 font.pixelSize: 30
61                 color: "black"
62             }
63             Button {
64                 label: qsTr("Log out")
65                 onButtonClicked: {
66                     Utils.resetAuthorization();
67                     pageStack.initialPage = "LoginPage.qml";
68                     pageStack.clear();
69                 }
70             }
71         }
72
73     }
74
75     DialogCombo {
76         id: dialogLang
77         z: 200
78         text: qsTr("Choose language:")
79         onOpened: {
80             mask.state = "dialog";
81         }
82         onClosed: {
83             mask.state = "idle";
84             Utils.setLocale(option);
85             tip.show(qsTr("Restart application!"));
86         }
87         onCanceled: {
88             mask.state = "idle";
89         }
90     }
91
92     TaskMenu {
93         z: 200
94         id: taskMenu
95         menuHeight: menuFixed.height+4*Const.DEFAULT_MARGIN
96
97         menuDynamic: _menuDyn
98         Flow {
99             y: root.height-taskMenu.menuHeight-Const.SYSTEM_BAR_HEIGHT+1*Const.DEFAULT_MARGIN
100             id: _menuDyn
101         }
102     }
103 }