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