Merge lp:~renatofilho/ubuntu-calendar-app/fix-add-guest-search-field into lp:ubuntu-calendar-app

Proposed by Renato Araujo Oliveira Filho
Status: Rejected
Rejected by: Renato Araujo Oliveira Filho
Proposed branch: lp:~renatofilho/ubuntu-calendar-app/fix-add-guest-search-field
Merge into: lp:ubuntu-calendar-app
Prerequisite: lp:~renatofilho/ubuntu-calendar-app/sdk-1-3
Diff against target: 343 lines (+117/-43)
3 files modified
ContactChoicePopup.qml (+51/-14)
KeyboardRectangle.qml (+1/-0)
NewEvent.qml (+65/-29)
To merge this branch: bzr merge lp:~renatofilho/ubuntu-calendar-app/fix-add-guest-search-field
Reviewer Review Type Date Requested Status
Jenkins Bot continuous-integration Needs Fixing
Ubuntu Calendar Developers Pending
Review via email: mp+284121@code.launchpad.net

Commit message

Auto-focus search textfield when adding a guest.
Make sure that the popover stay visible when the keyboard appears.
Disabled auto-prediction for search field.

To post a comment you must log in.
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
749. By Renato Araujo Oliveira Filho

Use New ListItem API for guest list.

Update swipe actions to work using the ListItem.leadingActions

Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
750. By Renato Araujo Oliveira Filho

Merged: ~renatofilho/ubuntu-calendar-app/sdk-1-3

751. By Renato Araujo Oliveira Filho

Make sure that guest list still visible after the VKB appears.

Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
752. By Renato Araujo Oliveira Filho

Show a contact entry for each emailAddress in contact selection.
Does not allow select contacts with empty e-mail.

753. By Renato Araujo Oliveira Filho

Merged: ~renatofilho/ubuntu-calendar-app/sdk-1-3

Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
754. By Renato Araujo Oliveira Filho

Trunk merged.

Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Renato Araujo Oliveira Filho (renatofilho) wrote :

it was merged in another MR.

Unmerged revisions

754. By Renato Araujo Oliveira Filho

Trunk merged.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ContactChoicePopup.qml'
2--- ContactChoicePopup.qml 2016-01-29 14:35:14 +0000
3+++ ContactChoicePopup.qml 2016-02-10 13:30:08 +0000
4@@ -29,7 +29,7 @@
5 id: root
6 objectName: "contactPopover"
7
8- signal contactSelected(var contact);
9+ signal contactSelected(var contact, string emailAddress);
10
11 Label {
12 id: noContact
13@@ -40,24 +40,27 @@
14
15 UnionFilter {
16 id: filter
17+
18+ property string searchString: ""
19+
20 filters: [
21 DetailFilter{
22 detail: ContactDetail.Name
23 field: Name.FirstName
24 matchFlags: Filter.MatchContains
25- value: searchBox.text
26+ value: filter.searchString
27 },
28 DetailFilter{
29 detail: ContactDetail.Name
30 field: Name.LastName
31 matchFlags: Filter.MatchContains
32- value: searchBox.text
33+ value: filter.searchString
34 },
35 DetailFilter{
36 detail: ContactDetail.DisplayLabel
37 field: DisplayLabel.Label
38 matchFlags: Filter.MatchContains
39- value: searchBox.text
40+ value: filter.searchString
41 }
42 ]
43 }
44@@ -69,6 +72,16 @@
45 autoUpdate: true
46 }
47
48+ Timer {
49+ id: idleSearch
50+
51+ interval: 500
52+ repeat: false
53+ onTriggered: {
54+ filter.searchString = searchBox.text
55+ }
56+ }
57+
58 Column {
59 anchors.top: parent.top
60 anchors.left: parent.left
61@@ -81,12 +94,16 @@
62 focus: true
63 width: parent.width
64 placeholderText: i18n.tr("Search contact")
65+ inputMethodHints: Qt.ImhNoPredictiveText
66 primaryItem: Icon {
67 height: parent.height*0.5
68 width: parent.height*0.5
69 anchors.verticalCenter: parent.verticalCenter
70 name:"find"
71- }
72+ }
73+ onTextChanged: {
74+ idleSearch.restart()
75+ }
76 }
77
78 ListView {
79@@ -96,17 +113,37 @@
80 model: contactModel
81 height: units.gu(15)
82 clip: true
83- delegate: Standard{
84- objectName: "contactPopoverList%1".arg(index)
85- property var item: contactModel.contacts[index]
86- height: units.gu(4)
87- text: item ? item.displayLabel.label : ""
88-
89- onClicked: {
90- root.contactSelected(item);
91- onClicked: PopupUtils.close(root)
92+ delegate: Column {
93+ width: contactList.width
94+ Repeater {
95+ anchors {
96+ left: parent.left
97+ right: parent.right
98+ }
99+ height: childrenRect.height
100+
101+ model: Math.max(1, contact.emails.length)
102+ delegate: ListItem {
103+ property string emailAddress: contact.emails.length > index ? contact.emails[index].emailAddress : ""
104+
105+ opacity: emailAddress.length > 0 ? 1.0 : 0.3
106+ width: contactList.width
107+ objectName: "contactPopoverList%1".arg(index)
108+ ListItemLayout {
109+ title.text: contact.displayLabel.label
110+ subtitle.text: emailAddress
111+ }
112+ onClicked: {
113+ if (emailAddress.length > 0) {
114+ root.contactSelected(contact, emailAddress);
115+ onClicked: PopupUtils.close(root)
116+ }
117+ }
118+ }
119 }
120 }
121 }
122 }
123+
124+ Component.onCompleted: searchBox.forceActiveFocus()
125 }
126
127=== modified file 'KeyboardRectangle.qml'
128--- KeyboardRectangle.qml 2016-01-25 13:20:32 +0000
129+++ KeyboardRectangle.qml 2016-02-10 13:30:08 +0000
130@@ -20,6 +20,7 @@
131
132 Item {
133 id: keyboardRect
134+
135 anchors.left: parent.left
136 anchors.right: parent.right
137 anchors.bottom: parent.bottom
138
139=== modified file 'NewEvent.qml'
140--- NewEvent.qml 2016-02-02 22:54:03 +0000
141+++ NewEvent.qml 2016-02-10 13:30:08 +0000
142@@ -20,7 +20,7 @@
143 import QtOrganizer 5.0
144 import Ubuntu.Components 1.3
145 import Ubuntu.Components.Popups 1.0
146-import Ubuntu.Components.ListItems 1.0 as ListItem
147+import Ubuntu.Components.ListItems 1.0 as ListItems
148 import Ubuntu.Components.Themes.Ambiance 1.0
149 import Ubuntu.Components.Pickers 1.0
150 import QtOrganizer 5.0
151@@ -411,7 +411,7 @@
152 }
153 }
154
155- ListItem.Standard {
156+ ListItems.Standard {
157 anchors {
158 left: parent.left
159 right: parent.right
160@@ -426,13 +426,13 @@
161 }
162 }
163
164- ListItem.ThinDivider {}
165+ ListItems.ThinDivider {}
166
167 Column {
168 width: parent.width
169 spacing: units.gu(1)
170
171- ListItem.Header{
172+ ListItems.Header{
173 text: i18n.tr("Event Details")
174 }
175
176@@ -496,7 +496,7 @@
177 width: parent.width
178 spacing: units.gu(1)
179
180- ListItem.Header {
181+ ListItems.Header {
182 text: i18n.tr("Calendar")
183 }
184
185@@ -534,29 +534,51 @@
186 width: parent.width
187 spacing: units.gu(1)
188
189- ListItem.Header {
190+ ListItems.Header {
191 text: i18n.tr("Guests")
192 }
193
194 Button{
195+ id: addGuestButton
196+ objectName: "addGuestButton"
197+
198+ property var contactsPopup: null
199+
200 text: i18n.tr("Add Guest")
201- objectName: "addGuestButton"
202-
203 anchors {
204 left: parent.left
205 right: parent.right
206 margins: units.gu(2)
207 }
208
209+ // WORKAROUND: causes the popover to follow the buttom position when keyboard appears
210+ Connections {
211+ target: keyboard
212+ onHeightChanged: {
213+ if (addGuestButton.contactsPopup) {
214+ addGuestButton.contactsPopup.caller = null
215+ addGuestButton.contactsPopup.caller = addGuestButton
216+ }
217+ }
218+ }
219+
220 onClicked: {
221- var popup = PopupUtils.open(Qt.resolvedUrl("ContactChoicePopup.qml"), contactList);
222- popup.contactSelected.connect( function(contact) {
223- var t = internal.contactToAttendee(contact);
224- if( !internal.isContactAlreadyAdded(contact) ) {
225+ if (contactsPopup)
226+ return
227+
228+ flickable.makeMeVisible(addGuestButton)
229+ contactsPopup = PopupUtils.open(Qt.resolvedUrl("ContactChoicePopup.qml"), addGuestButton);
230+ contactsPopup.contactSelected.connect( function(contact, emailAddress) {
231+ if(!internal.isContactAlreadyAdded(contact, emailAddress) ) {
232+ var t = internal.contactToAttendee(contact, emailAddress);
233 contactModel.append(t);
234 contactList.array.push(t);
235 }
236+
237 });
238+ contactsPopup.Component.onDestruction.connect( function() {
239+ addGuestButton.contactsPopup = null
240+ })
241 }
242 }
243
244@@ -585,27 +607,35 @@
245
246 Repeater{
247 model: contactModel
248- delegate: ListItem.Standard {
249+ delegate: ListItem {
250 objectName: "eventGuest%1".arg(index)
251- height: units.gu(4)
252- text: name
253- removable: true
254- onItemRemoved: {
255- contactList.array.splice(index, 1)
256- contactModel.remove(index)
257+
258+ ListItemLayout {
259+ title.text: name
260+ subtitle.text: emailAddress
261+ }
262+
263+ leadingActions: ListItemActions {
264+ actions: Action {
265+ iconName: "delete"
266+ onTriggered: {
267+ contactList.array.splice(index, 1)
268+ contactModel.remove(index)
269+ }
270+ }
271 }
272 }
273 }
274 }
275 }
276
277- ListItem.ThinDivider {
278+ ListItems.ThinDivider {
279 visible: event.itemType === Type.Event
280 }
281
282 }
283
284- ListItem.Subtitled{
285+ ListItems.Subtitled{
286 id:thisHappens
287 objectName :"thisHappens"
288
289@@ -621,11 +651,11 @@
290 onClicked: pageStack.push(Qt.resolvedUrl("EventRepetition.qml"),{"eventRoot": root,"isEdit":isEdit});
291 }
292
293- ListItem.ThinDivider {
294+ ListItems.ThinDivider {
295 visible: event.itemType === Type.Event
296 }
297
298- ListItem.Subtitled{
299+ ListItems.Subtitled{
300 id:eventReminder
301 objectName : "eventReminder"
302
303@@ -658,7 +688,7 @@
304 "eventTitle": titleEdit.text})
305 }
306
307- ListItem.ThinDivider {}
308+ ListItems.ThinDivider {}
309 }
310 }
311 // used to keep the field visible when the keyboard appear or dismiss
312@@ -685,20 +715,26 @@
313 messageEdit.focus = false
314 }
315
316- function isContactAlreadyAdded(contact) {
317+ function isContactAlreadyAdded(contact, emailAddress) {
318 for(var i=0; i < contactList.array.length ; ++i) {
319 var attendee = contactList.array[i];
320- if( attendee.attendeeId === contact.contactId) {
321- return true;
322+ if (emailAddress.length > 0) {
323+ if (attendee.emailAddress === emailAddress) {
324+ return true;
325+ }
326+ } else {
327+ if (attendee.attendeeId === contact.contactId) {
328+ return true
329+ }
330 }
331 }
332 return false;
333 }
334
335- function contactToAttendee(contact) {
336+ function contactToAttendee(contact, emailAddress) {
337 var attendee = Qt.createQmlObject("import QtOrganizer 5.0; EventAttendee{}", event, "NewEvent.qml");
338 attendee.name = contact.displayLabel.label
339- attendee.emailAddress = contact.email.emailAddress;
340+ attendee.emailAddress = emailAddress;
341 attendee.attendeeId = contact.contactId;
342 return attendee;
343 }

Subscribers

People subscribed via source and target branches

to status/vote changes: