Debian Codegraph @

qml/Components/ChooserType.qml

raw
1 /*
2 * This file is based on work taken from Ubuntu Weather app as on September 2019. Copyright (C) 2019 UBports
3 * Copyright (C) 2019 Joan Cibersheep
4 *
5 *
6 * This App is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 3 as
8 * published by the Free Software Foundation.
9 *
10 *
11 * This App is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 import QtQuick 2.9
22 import Lomiri.Components 1.3
23
24 Item {
25 height: typeSetting.height
26
27 property string selectedType: "TOTP"
28
29 ListModel {
30 id: typeModel
31 Component.onCompleted: initialize()
32
33 function initialize() {
34 typeModel.append({"text": "TOTP"})
35 typeModel.append({"text": "HTOP"})
36 }
37 }
38
39 ExpandableListItem {
40 id: typeSetting
41 listViewHeight: typeModel.count*units.gu(6.1)
42 model: typeModel
43 title.text: selectedType
44
45 delegate: StandardListItem {
46 title.text: model.text
47 icon.name: "ok"
48 icon.visible: selectedType === model.text
49 onClicked: {
50 selectedType = model.text;
51 typeSetting.toggleExpansion();
52 }
53 }
54 }
55 }