Dekko
Loading...
Searching...
No Matches
AddressBookList.qml
1import QtQuick 2.4
2import Lomiri.Components 1.3
3import Dekko.Contacts 1.0
4import Dekko.Lomiri.Components 1.0
5import "../../actions/views"
6import Dekko.Lomiri.Constants 1.0
7
8
9DekkoPage {
10
11 pageHeader {
12 title: qsTr("Addressbooks")
13 backAction: Action {
14 iconName: "back"
15 onTriggered: {
16 ViewActions.popStage()
17 }
18 }
19 }
20
21
23 ScrollView {
24 anchors.fill: parent
25 ListView {
26 anchors.fill: parent
27 model: ContactsStore.addressBooksModel
28 add: DekkoAnimation.listViewAddTransition
29 addDisplaced: DekkoAnimation.listViewAddDisplacedTransition
30 remove: DekkoAnimation.listViewRemoveTransition
31 removeDisplaced: DekkoAnimation.listViewRemoveDisplacedTransition
32 delegate: Item {
33 width: parent.width
34 height: contents.height
35 property var addressbook: model.qtObject
36 Column {
37 id: contents
38 anchors {
39 left: parent.left
40 top: parent.top
41 topMargin: units.gu(1)
42 right: parent.right
43 }
44
45 Item {
46 width: parent.width
47 height: units.gu(2)
48 Label {
49 anchors {
50 left: parent.left
51 leftMargin: units.gu(2)
52 verticalCenter: parent.verticalCenter
53 }
54 text: addressbook.displayName
55 color: Suru.secondaryForegroundColor
56 }
57 }
58
59 ListItem {
60 height: configLayout.height
61 divider.visible: false
62 visible: !addressbook.collections.count
63 ListItemLayout {
64 id: configLayout
65 title.text: qsTr("Add Collection")
66 }
67 }
68
69 Repeater {
70 model: addressbook ? addressbook.collections : null
71 delegate: ListItem {
72 height: layout.height
73 ListItemLayout {
74 id: layout
75 title.text: model.name
76 Icon {
77 height: units.gu(3)
78 width: height
79 name: "contact-group"
80 SlotsLayout.position: SlotsLayout.Leading
81 }
82 ProgressionSlot {}
83 }
84 onClicked: ContactActions.setSelectedAddressBook(model.index)
85 divider.visible: false
86
87 Line {
88 anchors {
89 right: parent.right
90 bottom: parent.bottom
91 left: parent.left
92 leftMargin: units.gu(7)
93 }
94 }
95 }
96 }
97 }
98 }
99 }
100 }
101 }
102}