282.1.1
by Kunal Parmar
First attempt |
1 |
import QtQuick 2.0 |
2 |
import Ubuntu.Components 0.1 |
|
3 |
import Ubuntu.Components.Popups 0.1 |
|
4 |
import Ubuntu.Components.ListItems 0.1 |
|
5 |
import Ubuntu.Components.Themes.Ambiance 0.1 |
|
6 |
import QtOrganizer 5.0 |
|
7 |
import QtContacts 5.0 |
|
8 |
||
9 |
import "Defines.js" as Defines |
|
10 |
||
11 |
Popover { |
|
12 |
id: root
|
|
282.2.2
by nskaggs
add objectnames |
13 |
objectName: "contactPopover" |
282.1.1
by Kunal Parmar
First attempt |
14 |
|
282.1.3
by Kunal Parmar
Contact to new event |
15 |
signal contactSelected(var contact); |
16 |
||
282.1.1
by Kunal Parmar
First attempt |
17 |
Label { |
282.1.35
by nskaggs
re-add kunal's change and revert mine (his is nicer :-) ) |
18 |
id: noContact
|
282.1.1
by Kunal Parmar
First attempt |
19 |
anchors.centerIn: parent |
282.1.20
by Kunal Parmar
localization |
20 |
text: i18n.tr("No contact") |
282.1.1
by Kunal Parmar
First attempt |
21 |
visible: contactModel.contacts.length === 0 |
22 |
}
|
|
23 |
||
24 |
UnionFilter { |
|
25 |
id: filter
|
|
26 |
filters: [ |
|
27 |
DetailFilter{ |
|
28 |
detail: ContactDetail.Name |
|
282.1.35
by nskaggs
re-add kunal's change and revert mine (his is nicer :-) ) |
29 |
field: Name.FirstName |
282.1.1
by Kunal Parmar
First attempt |
30 |
matchFlags: Filter.MatchContains |
31 |
value: searchBox.text |
|
32 |
},
|
|
33 |
DetailFilter{ |
|
34 |
detail: ContactDetail.Name |
|
282.1.35
by nskaggs
re-add kunal's change and revert mine (his is nicer :-) ) |
35 |
field: Name.LastName |
36 |
matchFlags: Filter.MatchContains |
|
37 |
value: searchBox.text |
|
38 |
},
|
|
39 |
DetailFilter{ |
|
40 |
detail: ContactDetail.DisplayLabel |
|
41 |
field: DisplayLabel.Label |
|
282.1.1
by Kunal Parmar
First attempt |
42 |
matchFlags: Filter.MatchContains |
43 |
value: searchBox.text |
|
44 |
}
|
|
45 |
]
|
|
46 |
}
|
|
47 |
||
48 |
ContactModel { |
|
49 |
id: contactModel
|
|
50 |
manager: "galera" |
|
51 |
filter: filter |
|
52 |
autoUpdate: true |
|
53 |
}
|
|
54 |
||
55 |
Column { |
|
282.1.5
by Kunal Parmar
minor refinement |
56 |
anchors.top: parent.top |
57 |
anchors.left: parent.left |
|
58 |
anchors.right: parent.right |
|
59 |
anchors.margins: units.gu(1) |
|
282.1.1
by Kunal Parmar
First attempt |
60 |
|
61 |
NewEventEntryField{ |
|
62 |
id: searchBox
|
|
282.2.2
by nskaggs
add objectnames |
63 |
objectName: "contactPopoverInput" |
282.1.1
by Kunal Parmar
First attempt |
64 |
focus: true |
65 |
width: parent.width |
|
282.1.20
by Kunal Parmar
localization |
66 |
placeholderText: i18n.tr("Search contact") |
282.1.1
by Kunal Parmar
First attempt |
67 |
primaryItem: Image { |
68 |
height: parent.height*0.5 |
|
69 |
width: parent.height*0.5 |
|
70 |
anchors.verticalCenter: parent.verticalCenter |
|
71 |
anchors.verticalCenterOffset: -units.gu(0.2) |
|
72 |
source: Qt.resolvedUrl("search.svg") |
|
73 |
}
|
|
74 |
}
|
|
75 |
||
76 |
ListView { |
|
77 |
id: contactList
|
|
282.1.24
by nskaggs
tweak tests to support new guest selection method |
78 |
objectName: "contactPopoverList" |
282.1.1
by Kunal Parmar
First attempt |
79 |
width: parent.width |
80 |
model: contactModel |
|
282.1.3
by Kunal Parmar
Contact to new event |
81 |
height: units.gu(30) |
282.1.1
by Kunal Parmar
First attempt |
82 |
clip: true |
83 |
delegate: Standard{ |
|
282.1.24
by nskaggs
tweak tests to support new guest selection method |
84 |
objectName: "contactPopoverList%1".arg(index) |
282.1.1
by Kunal Parmar
First attempt |
85 |
property var item: contactModel.contacts[index] |
282.1.3
by Kunal Parmar
Contact to new event |
86 |
height: units.gu(4) |
282.1.35
by nskaggs
re-add kunal's change and revert mine (his is nicer :-) ) |
87 |
text: item ? item.displayLabel.label : "" |
282.1.3
by Kunal Parmar
Contact to new event |
88 |
|
89 |
onClicked: { |
|
90 |
root.contactSelected(item); |
|
91 |
onClicked: PopupUtils.close(root) |
|
92 |
}
|
|
282.1.1
by Kunal Parmar
First attempt |
93 |
}
|
94 |
}
|
|
95 |
}
|
|
96 |
}
|