Debian Codegraph @

qml/Components/PageSettings.qml

raw
1 /*
2 * This file is part of the 2FA Manager App for Ubuntu Touch
3 * Copyright (C) 2019 Joan CiberSheep
4 *
5 * This App is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation.
8 *
9 *
10 * This App is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 import QtQuick 2.9
21 import Lomiri.Components 1.3
22
23 import QtQuick.LocalStorage 2.0
24
25
26 Page {
27 id: settingsPage
28 objectName: "settingsPage"
29 anchors.fill: parent
30
31 header: HeaderSettings {
32 id: pageHeader
33 title: i18n.tr("Settings")
34 flickable: settingsFlickable
35 }
36
37 ScrollView {
38 width: parent.width
39 height: parent.height
40 contentItem: settingsFlickable
41 }
42
43 Flickable {
44 id: settingsFlickable
45 width: parent.width
46 height: parent.height
47 contentHeight: mainColumn.height
48 topMargin: units.gu(2)
49 bottomMargin: units.gu(4)
50
51 Column {
52 id: mainColumn
53 width: parent.width
54 anchors.top: parent.top
55 anchors.topMargin: units.gu(1)
56 spacing: units.gu(2)
57
58 Text {
59 text: "<b>"+ i18n.tr("Theme") + "</b>"
60 color: mainColor
61 width: parent.width - units.gu(2)
62 anchors.horizontalCenter: parent.horizontalCenter
63 }
64
65 ListItem {
66 id: themeTF
67 width: parent.width
68 height: cTheme.height > 0
69 ? cTheme.height
70 : units.gu(7)
71 divider.visible: false
72 highlightColor: root.highlightColor
73
74 property string themeName
75
76 ChooserTheme {
77 id: cTheme
78 width: parent.width
79
80 onSelectedThemeChanged: themeTF.themeName = selectedTheme
81 }
82 }
83
84 Text {
85 text: "<b>"+ i18n.tr("Backup and import") + "</b>"
86 color: mainColor
87 width: parent.width - units.gu(2)
88 anchors.horizontalCenter: parent.horizontalCenter
89 }
90
91 ListView {
92 width: parent.width
93 height: units.gu(7) * settingsModel.count
94 interactive: false
95
96 model: settingsModel
97 delegate: settingsDelegate
98 }
99
100 ListModel {
101 id: settingsModel
102
103 function initialize() {
104 settingsModel.append({
105 "text": i18n.tr("Manage Backup"),
106 "subText": i18n.tr("Export, import keys and create a back up file"),
107 "page": "PageBackup.qml"
108 });
109
110 /*
111 settingsModel.append({
112 "text": i18n.tr("Check Database"),
113 "subText": i18n.tr("Try to solve issues with imported key"),
114 "page": "PageCheckdB.qml"
115 });
116 */
117 }
118
119 Component.onCompleted: initialize()
120 }
121
122 Component {
123 id: settingsDelegate
124
125 ListItem {
126 width: parent.width
127 divider.visible: false
128 highlightColor: root.highlightColor
129
130 ListItemLayout {
131 width: parent.width
132 title.text: text
133 subtitle.text: subText
134
135 ProgressionSlot {}
136 }
137
138 onClicked: mainStack.push(Qt.resolvedUrl(page));
139 }
140 }
141 }
142 }
143
144 Component.onCompleted: {
145 //Load settings from config
146 }
147 }