Merge lp:~pkunal-parmar/ubuntu-calendar-app/EventDetails-Refactoring into lp:ubuntu-calendar-app

Proposed by Kunal Parmar
Status: Merged
Approved by: Mihir Soni
Approved revision: 262
Merged at revision: 262
Proposed branch: lp:~pkunal-parmar/ubuntu-calendar-app/EventDetails-Refactoring
Merge into: lp:ubuntu-calendar-app
Diff against target: 166 lines (+71/-36)
2 files modified
AllDayEventComponent.qml (+2/-2)
EventDetails.qml (+69/-34)
To merge this branch: bzr merge lp:~pkunal-parmar/ubuntu-calendar-app/EventDetails-Refactoring
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Mihir Soni Approve
Review via email: mp+218352@code.launchpad.net

Commit message

In case of recurrent event, event object will be of EventOccurrence type, which does not contain Attendees and Recurrence information.

To get those information we need to retrieve parent event and display details from parent event.

If event object is of Event type then we can continue using it.

Description of the change

In case of recurrent event, event object will be of EventOccurrence type, which does not contain Attendees and Recurrence information.

To get those information we need to retrieve parent event and display details from parent event.

If event object is of Event type then we can continue using it.

To post a comment you must log in.
Revision history for this message
Kunal Parmar (pkunal-parmar) wrote :

This needs to be done in NewEvent as well, I am planning to handle that in separate MR.

Revision history for this message
Mihir Soni (mihirsoni) wrote :

Looks good to me, and works great
Thanks kunal.

review: Approve
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'AllDayEventComponent.qml'
2--- AllDayEventComponent.qml 2014-04-05 06:36:28 +0000
3+++ AllDayEventComponent.qml 2014-05-06 05:15:57 +0000
4@@ -71,7 +71,7 @@
5 if( allDayLabel.events.length > 1 ) {
6 PopupUtils.open(popoverComponent, root,{"events": allDayLabel.events})
7 } else {
8- pageStack.push(Qt.resolvedUrl("EventDetails.qml"),{"event":allDayLabel.events[0],"model": model});
9+ pageStack.push(Qt.resolvedUrl("EventDetails.qml"),{"event":allDayLabel.events[0],"model": root.model});
10 }
11 }
12 }
13@@ -138,7 +138,7 @@
14 anchors.fill: parent
15 onClicked: {
16 popover.hide();
17- pageStack.push(Qt.resolvedUrl("EventDetails.qml"),{"event":modelData,"model": model});
18+ pageStack.push(Qt.resolvedUrl("EventDetails.qml"),{"event":modelData,"model": root.model});
19 }
20 }
21 }
22
23=== modified file 'EventDetails.qml'
24--- EventDetails.qml 2014-04-24 14:36:20 +0000
25+++ EventDetails.qml 2014-05-06 05:15:57 +0000
26@@ -37,56 +37,49 @@
27 }
28 }
29 }
30- function showEvent(e) {
31- // TRANSLATORS: this is a time formatting string,
32- // see http://qt-project.org/doc/qt-5.0/qtqml/qml-qtquick2-date.html#details for valid expressions
33- var timeFormat = i18n.tr("hh:mm");
34- var startTime = e.startDateTime.toLocaleTimeString(Qt.locale(), timeFormat);
35- var endTime = e.endDateTime.toLocaleTimeString(Qt.locale(), timeFormat);
36-
37- startHeader.value = startTime;
38- endHeader.value = endTime;
39-
40- allDayEventCheckbox.checked = e.allDay;
41-
42- // This is the event title
43- if( e.displayLabel) {
44- titleLabel.text = e.displayLabel;
45- }
46-
47- if( e.description ) {
48- descLabel.text = e.description;
49- }
50- var attendees = e.attendees;
51+
52+ function updateRecurrence( event ) {
53+ var index = 0;
54+ if(event.recurrence ) {
55+ var recurrenceRule = event.recurrence.recurrenceRules;
56+ if(recurrenceRule.length > 0){
57+ index = recurrenceRule[0].frequency ;
58+ }
59+ else{
60+ index = 0
61+ }
62+ }
63+ recurrentHeader.value = Defines.recurrenceLabel[index];
64+ }
65+
66+ function updateContacts(event) {
67+ var attendees = event.attendees;
68 contactModel.clear();
69 if( attendees !== undefined ) {
70 for( var j = 0 ; j < attendees.length ; ++j ) {
71 contactModel.append( {"name": attendees[j].name,"participationStatus": attendees[j].participationStatus } );
72 }
73 }
74+ }
75
76+ function updateReminder(event) {
77 var index = 0;
78- if(e.recurrence ) {
79- var recurrenceRule = e.recurrence.recurrenceRules;
80- index = ( recurrenceRule.length > 0 ) ? recurrenceRule[0].frequency : 0;
81- }
82- recurrentHeader.value = Defines.recurrenceLabel[index];
83-
84- index = 0;
85- var reminder = e.detail( Detail.VisualReminder);
86+ var reminder = event.detail( Detail.VisualReminder);
87 if( reminder ) {
88 var reminderTime = reminder.secondsBeforeStart;
89 var foundIndex = Defines.reminderValue.indexOf(reminderTime);
90 index = foundIndex != -1 ? foundIndex : 0;
91 }
92 reminderHeader.value = Defines.reminderLabel[index];
93+ }
94
95- if( e.location ) {
96- locationLabel.text = e.location;
97+ function updateLocation(event) {
98+ if( event.location ) {
99+ locationLabel.text = event.location;
100
101 // FIXME: need to cache map image to avoid duplicate download every time
102- var imageSrc = "http://maps.googleapis.com/maps/api/staticmap?center="+e.location+
103- "&markers=color:red|"+e.location+"&zoom=15&size="+mapContainer.width+
104+ var imageSrc = "http://maps.googleapis.com/maps/api/staticmap?center="+event.location+
105+ "&markers=color:red|"+event.location+"&zoom=15&size="+mapContainer.width+
106 "x"+mapContainer.height+"&sensor=false";
107 mapImage.source = imageSrc;
108 }
109@@ -97,6 +90,49 @@
110 }
111 }
112
113+ function showEvent(e) {
114+ // TRANSLATORS: this is a time formatting string,
115+ // see http://qt-project.org/doc/qt-5.0/qtqml/qml-qtquick2-date.html#details for valid expressions
116+ var timeFormat = i18n.tr("hh:mm");
117+ var startTime = e.startDateTime.toLocaleTimeString(Qt.locale(), timeFormat);
118+ var endTime = e.endDateTime.toLocaleTimeString(Qt.locale(), timeFormat);
119+
120+ var parentEvent;
121+ if( e.parentId ){
122+ var requestId = -1;
123+ model.onItemsFetched.connect( function(id,fetchedItems){
124+ if(requestId === id && fetchedItems.length > 0) {
125+ parentEvent = fetchedItems[0];
126+ updateRecurrence(parentEvent);
127+ updateContacts(parentEvent);
128+ }
129+ });
130+ requestId = model.fetchItems([e.parentId]);
131+ }
132+
133+ startHeader.value = startTime;
134+ endHeader.value = endTime;
135+
136+ allDayEventCheckbox.checked = e.allDay;
137+
138+ // This is the event title
139+ if( e.displayLabel) {
140+ titleLabel.text = e.displayLabel;
141+ }
142+
143+ if( e.description ) {
144+ descLabel.text = e.description;
145+ }
146+
147+ updateContacts(e);
148+
149+ updateRecurrence(e);
150+
151+ updateReminder(e);
152+
153+ updateLocation(e);
154+ }
155+
156 Keys.onEscapePressed: {
157 pageStack.pop();
158 }
159@@ -274,7 +310,6 @@
160 id: recurrentHeader
161 xMargin: column.recurranceAreaMaxWidth
162 header: i18n.tr("This happens")
163- value :"Only once" //Neds to change
164 }
165 EventDetailsInfo{
166 id: reminderHeader

Subscribers

People subscribed via source and target branches

to status/vote changes: