Dekko
Loading...
Searching...
No Matches
ContactView.qml
1import QtQuick 2.4
2import Lomiri.Components 1.3
3import Dekko.Contacts 1.0
4import Dekko.Lomiri.Components 1.0
5import Dekko.Lomiri.Constants 1.0
6import "../../actions/views"
7
8
10 id: contactsListPage
11 pageHeader.title: qsTr("Contact")
12 pageHeader.backAction:!dekko.isLargeFF ? bkAction : null
13
14 property Contact contact
15 property bool editModeEnabled: false
16
17 pageHeader.primaryAction: editModeEnabled ? saveAction : editAction
18
19 Action {
20 id: editAction
21 iconName: "edit"
22 onTriggered: editModeEnabled = true
23 }
24
25 Action {
26 id: saveAction
27 iconName: "save"
28 onTriggered: {
29 ContactActions.saveContact(contact)
30 editModeEnabled = false
31 }
32 }
33
34 Action {
35 id: bkAction
36 iconName: "back"
37// onTriggered: ViewActions.popStage()
38 }
39
41 margins: 0
42// spacing: 0
43 ListItem {
44 height: layout1.height
45 divider.visible: false
46 ListItemLayout {
47 id: layout1
48 title.text: contact.firstname
49 Avatar {
50 height: units.gu(5.5)
51 width: height
52 fontSize: "large"
53 name: contact.firstname
54 initials: contact.initials
55 email: contact.emailAddresses.count ? contact.emailAddresses.getFirst().address : ""
56 SlotsLayout.position: SlotsLayout.Leading
57 }
58 }
59 }
61 title: qsTr("Email")
62 visible: contact.emailAddresses.count
63 spacing: editModeEnabled ? units.gu(1) : 0
64 Repeater {
65 model: contact.emailAddresses
67 detail: model.address
68 editable: editModeEnabled
69 detailAction: Action {
70 iconName: "ok"
71 onTriggered: console.log("ACTION CLICKED")
72 }
73 onValueChanged: model.qtObject.address = val
74 }
75 }
76 }
78 title: qsTr("Phone")
79 visible: contact.contactNumbers.count
80 spacing: units.gu(1)
81 Repeater {
82 model: contact.contactNumbers
84 title: model.qtObject.typeToString(model.type)
85 detail: model.number
86 editable: editModeEnabled
87 onValueChanged: model.qtObject.number = val
88 }
89 }
90 }
92 title: qsTr("Address")
93 spacing: units.gu(1)
95 editable: editModeEnabled
96 title: qsTr("Street")
97 detail: contact.address.street
98 onValueChanged: contact.address.street = val
99 }
101 editable: editModeEnabled
102 title: qsTr("City")
103 detail: contact.address.city
104 onValueChanged: contact.address.city = val
105 }
107 editable: editModeEnabled
108 title: qsTr("Zip")
109 detail: contact.address.zip
110 onValueChanged: contact.address.zip = val
111 }
113 editable: editModeEnabled
114 title: qsTr("Country")
115 detail: contact.address.country
116 onValueChanged: contact.address.country = val
117 }
118 }
119 }
120}