ubuntu-touch-coreapps-reviewers team mailing list archive
-
ubuntu-touch-coreapps-reviewers team
-
Mailing list archive
-
Message #09251
[Merge] lp:~artmello/ubuntu-calendar-app/ubuntu-calendar-app-fix_attendees_undefined into lp:ubuntu-calendar-app
Arthur Mello has proposed merging lp:~artmello/ubuntu-calendar-app/ubuntu-calendar-app-fix_attendees_undefined into lp:ubuntu-calendar-app.
Commit message:
Use details method to get attendees list instead of "attendees" property since a binding issue was returning an empty attendees list for some use cases
Fix the attendee status on the event's details page
Requested reviews:
Ubuntu Calendar Developers (ubuntu-calendar-dev)
For more details, see:
https://code.launchpad.net/~artmello/ubuntu-calendar-app/ubuntu-calendar-app-fix_attendees_undefined/+merge/291186
Use details method to get attendees list instead of "attendees" property since a binding issue was returning an empty attendees list for some use cases
Fix the attendee status on the event's details page
--
Your team Ubuntu Calendar Developers is requested to review the proposed merge of lp:~artmello/ubuntu-calendar-app/ubuntu-calendar-app-fix_attendees_undefined into lp:ubuntu-calendar-app.
=== modified file 'EventBubble.qml'
--- EventBubble.qml 2016-03-31 19:19:33 +0000
+++ EventBubble.qml 2016-04-06 21:18:53 +0000
@@ -105,7 +105,9 @@
}
function getOwnersStatus(collection) {
- var attendees = event.attendees;
+ // Use details method to get attendees list instead of "attendees" property
+ // since a binding issue was returning an empty attendees list for some use cases
+ var attendees = event.details(Detail.EventAttendee);
if( attendees !== undefined ) {
for (var j = 0 ; j < attendees.length ; ++j) {
var contact = attendees[j];
=== modified file 'EventDetails.qml'
--- EventDetails.qml 2016-03-23 11:35:59 +0000
+++ EventDetails.qml 2016-04-06 21:18:53 +0000
@@ -79,7 +79,6 @@
if (fetchedItems.length > 0) {
internal.parentEvent = fetchedItems[0];
updateRecurrence(internal.parentEvent);
- updateContacts(internal.parentEvent);
} else {
console.warn("Fail to fetch pareten event")
}
@@ -103,12 +102,9 @@
}
function updateContacts(event) {
- var attendees
- var attendingCount, notAttendingCount
-
- attendingCount = 0
- notAttendingCount = 0
- attendees = event.attendees
+ // Use details method to get attendees list instead of "attendees" property
+ // since a binding issue was returning an empty attendees list for some use cases
+ var attendees = event.details(Detail.EventAttendee)
contactModel.clear();
@@ -116,20 +112,19 @@
for (var j = 0 ; j < attendees.length ; ++j) {
var name = attendees[j].name.trim().length === 0 ? attendees[j].emailAddress.replace("mailto:", "")
: attendees[j].name
-
- // Sort the participating guests by Attending, Not-Attending and No-Reply for easier diaply in the list view.
- if(attendees[j].participationStatus === 0) {
- contactModel.insert(attendingCount+notAttendingCount, {"name": name,"participationStatus": attendees[j].participationStatus})
- notAttendingCount++
- }
-
- else if(attendees[j].participationStatus === 1) {
- contactModel.insert(attendingCount, {"name": name,"participationStatus": attendees[j].participationStatus})
- attendingCount++
- }
-
- else {
- contactModel.append({"name": name,"participationStatus": attendees[j].participationStatus});
+ var participationStatus = attendees[j].participationStatus
+ if (participationStatus === EventAttendee.StatusAccepted) {
+ contactModel.append({"name": name, "participationStatus": i18n.tr("Attending")});
+
+ } else if (participationStatus === EventAttendee.StatusDeclined) {
+ contactModel.append({"name": name, "participationStatus": i18n.tr("Not Attending")});
+
+ } else if (participationStatus === EventAttendee.StatusTentative) {
+ contactModel.append({"name": name, "participationStatus": i18n.tr("Maybe")});
+
+ } else {
+ contactModel.append({"name": name, "participationStatus": i18n.tr("No Reply")});
+
}
}
}
@@ -355,7 +350,7 @@
}
}
- ListView{
+ ListView {
model: contactModel
width: parent.width
height: count !== 0 ? (count+1) * units.gu(7): 0
@@ -363,29 +358,19 @@
section.property: "participationStatus"
section.labelPositioning: ViewSection.InlineLabels
- section.delegate: ListItem {
- height: headerText.height + divider.height
+ section.delegate: ListItem {
+ height: sectionLayout.height
+ divider.visible: false
ListItemLayout {
- id: headerText
- title.text: {
- if (section === "0") {
- return i18n.tr("Not Attending")
- }
-
- else if (section === "1") {
- return i18n.tr("Attending")
- }
-
- else if (section === "2") {
- return i18n.tr("No Reply")
- }
- }
+ id: sectionLayout
+ title.text: section
title.font.weight: Font.DemiBold
}
}
delegate: ListItem {
- height: contactListItemLayout.height + divider.height
+ height: contactListItemLayout.height
+ divider.visible: false
ListItemLayout {
id: contactListItemLayout
title.text: name
@@ -393,6 +378,10 @@
}
}
+ // Add a ListItem to work as divider between the contact list model and the description list item
+ // This will be removed on the new event's details page
+ ListItem { height: units.gu(4) }
+
ListItem {
id: descLabel
height: descTitle.height + desc.implicitHeight + divider.height + units.gu(4)
=== modified file 'NewEvent.qml'
--- NewEvent.qml 2016-04-05 12:36:41 +0000
+++ NewEvent.qml 2016-04-06 21:18:53 +0000
@@ -160,9 +160,12 @@
var index = 0;
if( e.itemType === Type.Event ) {
- if(e.attendees){
- for( var j = 0 ; j < e.attendees.length ; ++j ) {
- contactModel.append({"contact": e.attendees[j]});
+ // Use details method to get attendees list instead of "attendees" property
+ // since a binding issue was returning an empty attendees list for some use cases
+ var attendees = e.details(Detail.EventAttendee);
+ if(attendees){
+ for( var j = 0 ; j < attendees.length ; ++j ) {
+ contactModel.append({"contact": attendees[j]});
}
}
}
Follow ups