Merge lp:~artmello/ubuntu-calendar-app/ubuntu-calendar-app-fix_attendees_list into lp:ubuntu-calendar-app

Proposed by Arthur Mello
Status: Merged
Approved by: Renato Araujo Oliveira Filho
Approved revision: 822
Merged at revision: 824
Proposed branch: lp:~artmello/ubuntu-calendar-app/ubuntu-calendar-app-fix_attendees_list
Merge into: lp:ubuntu-calendar-app
Diff against target: 282 lines (+148/-91)
1 file modified
EventDetails.qml (+148/-91)
To merge this branch: bzr merge lp:~artmello/ubuntu-calendar-app/ubuntu-calendar-app-fix_attendees_list
Reviewer Review Type Date Requested Status
Renato Araujo Oliveira Filho (community) Approve
Jenkins Bot continuous-integration Approve
Review via email: mp+292035@code.launchpad.net

Commit message

Fix attendees list view in event's details page

Description of the change

Fix attendees list view in event's details page

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

looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'EventDetails.qml'
2--- EventDetails.qml 2016-04-07 12:46:07 +0000
3+++ EventDetails.qml 2016-04-15 17:57:34 +0000
4@@ -108,25 +108,39 @@
5
6 contactModel.clear();
7
8+ var acceptedList = []
9+ var declinedList = []
10+ var tentativeList = []
11+ var unknownList = []
12+
13 if( attendees !== undefined ) {
14 for (var j = 0 ; j < attendees.length ; ++j) {
15 var name = attendees[j].name.trim().length === 0 ? attendees[j].emailAddress.replace("mailto:", "")
16 : attendees[j].name
17 var participationStatus = attendees[j].participationStatus
18- if (participationStatus === EventAttendee.StatusAccepted) {
19- contactModel.append({"name": name, "participationStatus": i18n.tr("Attending")});
20-
21- } else if (participationStatus === EventAttendee.StatusDeclined) {
22- contactModel.append({"name": name, "participationStatus": i18n.tr("Not Attending")});
23-
24- } else if (participationStatus === EventAttendee.StatusTentative) {
25- contactModel.append({"name": name, "participationStatus": i18n.tr("Maybe")});
26-
27+ if ( participationStatus === EventAttendee.StatusAccepted ) {
28+ acceptedList.push(name);
29+ } else if ( participationStatus === EventAttendee.StatusDeclined ) {
30+ declinedList.push(name);
31+ } else if ( participationStatus === EventAttendee.StatusTentative ) {
32+ tentativeList.push(name);
33 } else {
34- contactModel.append({"name": name, "participationStatus": i18n.tr("No Reply")});
35-
36+ unknownList.push(name);
37 }
38 }
39+
40+ for (var j = 0 ; j < acceptedList.length ; ++j) {
41+ contactModel.append({"name": acceptedList[j], "participationStatus": EventAttendee.StatusAccepted});
42+ }
43+ for (var j = 0 ; j < declinedList.length ; ++j) {
44+ contactModel.append({"name": declinedList[j], "participationStatus": EventAttendee.StatusDeclined});
45+ }
46+ for (var j = 0 ; j < tentativeList.length ; ++j) {
47+ contactModel.append({"name": tentativeList[j], "participationStatus": EventAttendee.StatusTentative});
48+ }
49+ for (var j = 0 ; j < unknownList.length ; ++j) {
50+ contactModel.append({"name": unknownList[j], "participationStatus": EventAttendee.StatusUnknown});
51+ }
52 }
53 }
54
55@@ -266,7 +280,7 @@
56 clip: interactive
57 anchors.fill: parent
58 contentWidth: parent.width
59- contentHeight: column.height + titleContainer.height
60+ contentHeight: titleContainer.height + calendarListItem.height + attendeesListLoader.height + descLabel.height + reminderListItem.height
61
62 Rectangle{
63 id: titleContainer
64@@ -316,44 +330,57 @@
65 }
66 }
67
68- Column{
69- id: column
70-
71- width: parent.width
72- anchors.top: titleContainer.bottom
73-
74- ListItem {
75- height: units.gu(6)
76- Row{
77- id: calendarNameRow
78-
79- spacing: units.gu(1)
80- anchors { verticalCenter: parent.verticalCenter; left: parent.left; right: parent.right; margins: units.gu(2) }
81-
82- Label {
83- text: i18n.tr("Calendar")
84- }
85-
86- UbuntuShape{
87- id: calendarIndicator
88- width: parent.height
89- height: width
90- color: collection.color
91- anchors.verticalCenter: parent.verticalCenter
92- }
93-
94- Label{
95- id:calendarName
96- objectName: "calendarName"
97- text: collection.name
98- }
99- }
100- }
101-
102- ListView {
103+ ListItem {
104+ id: calendarListItem
105+
106+ anchors {
107+ left: parent.left
108+ right: parent.right
109+ top: titleContainer.bottom
110+ }
111+
112+ height: units.gu(6)
113+
114+ Row{
115+ id: calendarNameRow
116+
117+ spacing: units.gu(1)
118+ anchors { verticalCenter: parent.verticalCenter; left: parent.left; right: parent.right; margins: units.gu(2) }
119+
120+ Label {
121+ text: i18n.tr("Calendar")
122+ }
123+
124+ UbuntuShape{
125+ id: calendarIndicator
126+ width: parent.height
127+ height: width
128+ color: collection.color
129+ anchors.verticalCenter: parent.verticalCenter
130+ }
131+
132+ Label{
133+ id:calendarName
134+ objectName: "calendarName"
135+ text: collection.name
136+ }
137+ }
138+ }
139+
140+ Loader {
141+ id: attendeesListLoader
142+
143+ anchors {
144+ left: parent.left
145+ right: parent.right
146+ top: calendarListItem.bottom
147+ }
148+
149+ active: contactModel.count > 0
150+ height: active ? item.contentHeight : 0
151+
152+ sourceComponent: ListView {
153 model: contactModel
154- width: parent.width
155- height: count !== 0 ? (count+1) * units.gu(7): 0
156 interactive: false
157
158 section.property: "participationStatus"
159@@ -363,51 +390,81 @@
160 divider.visible: false
161 ListItemLayout {
162 id: sectionLayout
163- title.text: section
164- title.font.weight: Font.DemiBold
165- }
166- }
167-
168- delegate: ListItem {
169- height: contactListItemLayout.height
170- divider.visible: false
171- ListItemLayout {
172- id: contactListItemLayout
173- title.text: name
174- }
175- }
176- }
177-
178- // Add a ListItem to work as divider between the contact list model and the description list item
179- ListItem { height: units.gu(4) }
180-
181- ListItem {
182- id: descLabel
183- height: descTitle.height + desc.implicitHeight + divider.height + units.gu(4)
184- visible: desc.text !== ""
185-
186- Label {
187- id: descTitle
188- text: i18n.tr("Description")
189- anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(2); topMargin: units.gu(1.5) }
190- }
191-
192- Label {
193- id: desc
194- text: event.description
195+ title.text: {
196+ if ( section == EventAttendee.StatusAccepted ) {
197+ return i18n.tr("Attending");
198+ } else if ( section == EventAttendee.StatusDeclined ) {
199+ return i18n.tr("Not Attending");
200+ } else if ( section == EventAttendee.StatusTentative ) {
201+ return i18n.tr("Maybe");
202+ } else {
203+ return i18n.tr("No Reply");
204+ }
205+ }
206+ }
207+ }
208+
209+ delegate: Label {
210+ anchors {
211+ left: parent.left;
212+ right: parent.right;
213+ leftMargin: units.gu(2)
214+ rightMargin: units.gu(2)
215+ }
216+
217 textSize: Label.Small
218 color: UbuntuColors.graphite
219 wrapMode: Text.WordWrap
220- anchors { left: parent.left; right: parent.right; top: descTitle.bottom; margins: units.gu(2); topMargin: units.gu(0.5) }
221- }
222- }
223-
224- ListItem {
225- height: reminderLayout.height + divider.height
226- ListItemLayout {
227- id: reminderLayout
228- title.text: i18n.tr("Reminder")
229- }
230+
231+ text: name
232+ }
233+
234+ footer: ListItem { height: units.gu(2) }
235+ }
236+ }
237+
238+ ListItem {
239+ id: descLabel
240+
241+ anchors {
242+ left: parent.left
243+ right: parent.right
244+ top: attendeesListLoader.bottom
245+ }
246+
247+ height: visible ? descTitle.height + desc.implicitHeight + divider.height + units.gu(4) : 0
248+ visible: desc.text !== ""
249+
250+ Label {
251+ id: descTitle
252+ text: i18n.tr("Description")
253+ anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(2); topMargin: units.gu(1.5) }
254+ }
255+
256+ Label {
257+ id: desc
258+ text: event.description
259+ textSize: Label.Small
260+ color: UbuntuColors.graphite
261+ wrapMode: Text.WordWrap
262+ anchors { left: parent.left; right: parent.right; top: descTitle.bottom; margins: units.gu(2); topMargin: units.gu(0.5) }
263+ }
264+ }
265+
266+ ListItem {
267+ id: reminderListItem
268+
269+ anchors {
270+ left: parent.left
271+ right: parent.right
272+ top: descLabel.bottom
273+ }
274+
275+ height: reminderLayout.height + divider.height
276+
277+ ListItemLayout {
278+ id: reminderLayout
279+ title.text: i18n.tr("Reminder")
280 }
281 }
282 }

Subscribers

People subscribed via source and target branches

to status/vote changes: