Merge lp:~mihirsoni/ubuntu-calendar-app/editEvent into lp:ubuntu-calendar-app

Proposed by Mihir Soni
Status: Merged
Approved by: Kunal Parmar
Approved revision: 161
Merged at revision: 177
Proposed branch: lp:~mihirsoni/ubuntu-calendar-app/editEvent
Merge into: lp:ubuntu-calendar-app
Diff against target: 169 lines (+58/-19)
2 files modified
EventDetails.qml (+11/-4)
NewEvent.qml (+47/-15)
To merge this branch: bzr merge lp:~mihirsoni/ubuntu-calendar-app/editEvent
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Kunal Parmar Approve
David Planella Approve
Olivier Tilloy (community) Needs Fixing
Review via email: mp+190106@code.launchpad.net

Commit message

Added Edit event support

Description of the change

Added edit event support using new UDS presentation.

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Olivier Tilloy (osomon) wrote :

53 + title: isEdit===false? i18n.tr("New Event"):i18n.tr("Edit Event")

this would be clearer if written:

    title: isEdit ? i18n.tr("Edit Event") : i18n.tr("New Event")

Revision history for this message
Olivier Tilloy (osomon) wrote :

38 + console.log("I am adding");
43 + console.log("I am editing");

Please remove those logs if the functionality is working fine.

Revision history for this message
Olivier Tilloy (osomon) wrote :

I got stuck on the edit screen by doing the following:

 - create a new event today
 - in the day view click on the event to see its details
 - click on the edit button in the toolbar
 - click on the cancel button to go back to the event details
 - click on the back button to go back to the day view -> what happens is I’m taken back to the "edit event" page instead

review: Needs Fixing
Revision history for this message
Kunal Parmar (pkunal-parmar) wrote :

61 - pageStack.pop();
62 + if(isEdit)
63 + pageStack.push(Qt.resolvedUrl("EventDetails.qml"),{"event":event});
64 + else
65 + pageStack.pop();

You dont need to push EventDetails page again.

62 + if(isEdit)
63 + pageStack.push(Qt.resolvedUrl("EventDetails.qml"),{"event":event});

In any case we need to pop current page to go back to original page. so this modification is not necessary,

review: Needs Fixing
Revision history for this message
David Planella (dpm) wrote :

Mihir, now the EDS branch has landed and we can land the new views too. Have you had the chance to look into the fixes Kunal was mentioning in his last comment?

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

176 +}

Just a small nitpick: could you revert the change to the manifest file? It's not related to this branch.

Other than that, it looks good to me, thanks!

review: Approve
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Kunal Parmar (pkunal-parmar) wrote :

Its almost ready, but still clean up is required

Revision history for this message
Kunal Parmar (pkunal-parmar) wrote :

147 + function clearFocus() {
148 + Qt.inputMethod.hide()
149 + titleEdit.focus = false
150 + locationEdit.focus = false
151 + personEdit.focus = false
152 + startTime.focus = false
153 + endTime.focus = false
154 + messageEdit.focus = false
155 + }

internal object already has defined clearFocus() method, please remove redundant code
    QtObject {
        id: internal

Revision history for this message
Kunal Parmar (pkunal-parmar) wrote :

70 + internal.eventModel = GlobalModel.gloablModel(event);

what does this do? I do not see gloablModel() method which takes event as parameter? did you forgot to merge?

review: Needs Fixing
Revision history for this message
Kunal Parmar (pkunal-parmar) wrote :

61 + if( pageStack.header )
62 + pageStack.header.visible = true;
63 + if(event === null){
64 + internal.eventModel = GlobalModel.gloablModel();
65 + isEdit =false;
66 + addEvent();
67 + }
68 + else{
69 + pageStack.header.visible = true;

pageStack.header.visible = true;
is called twice

I think first call should be able to handle all case, you are facing some issue ?

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

FAILED: Autolanding.
Approved revid is not set in launchpad. This is most likely a launchpad issue and re-approve should fix it. There is also a chance (although a very small one) this is a permission problem of the ps-jenkins bot.
http://91.189.93.70:8080/job/ubuntu-calendar-app-autolanding/51/
Executed test runs:
    SUCCESS: http://91.189.93.70:8080/job/generic-mediumtests/1108
    SUCCESS: http://91.189.93.70:8080/job/ubuntu-calendar-app-precise-amd64-autolanding/51
    SUCCESS: http://91.189.93.70:8080/job/ubuntu-calendar-app-quantal-amd64-autolanding/53
    SUCCESS: http://91.189.93.70:8080/job/ubuntu-calendar-app-raring-amd64-autolanding/51
    SUCCESS: http://91.189.93.70:8080/job/ubuntu-calendar-app-saucy-amd64-autolanding/51

review: Needs Fixing (continuous-integration)
Revision history for this message
Kunal Parmar (pkunal-parmar) wrote :

Trying edit event is showing error

ile:///home/kunal/Dropbox/projects/qt/qml/ubuntu/calendar/review/editEvent/NewEvent.qml:61: Error: Cannot assign QQmlListReference to QString
virtual void QOrganizerEDSEngine::requestDestroyed(QtOrganizer::QOrganizerAbstractRequest*)

100 + if(e.attendees){
101 + personEdit.text = e.attendees;
102 + }

Due to above line, please see event details how to get attendee's name from attendees array.

review: Needs Fixing
Revision history for this message
Kunal Parmar (pkunal-parmar) wrote :

59 - internal.eventModel = GlobalModel.gloablModel();
60 -
61 + if( pageStack.header )

May be you need to restore "internal.eventModel = GlobalModel.gloablModel();" call and remove code you added in condition.

review: Needs Fixing
Revision history for this message
Kunal Parmar (pkunal-parmar) wrote :

115 + if(!isEdit) // if it is new event create new object
116 + event = Qt.createQmlObject("import QtOrganizer 5.0; Event { }", Qt.application,"NewEvent.qml");

I think its better to move event creation to addEvent method now.

review: Needs Fixing
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Kunal Parmar (pkunal-parmar) wrote :

            if( personEdit.text != "") {
                var attendee = Qt.createQmlObject("import QtOrganizer 5.0; EventAttendee{}", Qt.application, "NewEvent.qml");
                attendee.name = personEdit.text;
                attendee.emailAddress = "<email address hidden>";
                event.setDetail(attendee);
            }

In case of edit, I think we will need to delete all existing attendees first, I am not sure thought, we need to try it out this and see how it works.

bool OrganizerItem::removeDetail ( detail )

This method should be useful.

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

> if( personEdit.text != "") {
> var attendee = Qt.createQmlObject("import QtOrganizer 5.0;
> EventAttendee{}", Qt.application, "NewEvent.qml");
> attendee.name = personEdit.text;
> attendee.emailAddress = "<email address hidden>";
> event.setDetail(attendee);
> }
>
> In case of edit, I think we will need to delete all existing attendees first,
> I am not sure thought, we need to try it out this and see how it works.
>
> bool OrganizerItem::removeDetail ( detail )
>
> This method should be useful.

I have used this instead of remove details :
// attendees clear
        event.attendees = [];

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Kunal Parmar (pkunal-parmar) wrote :

This is looking nice now,
Can you remove this line, I added this for some testing and forgot to remove it.

136 attendee.emailAddress = "<email address hidden>";

review: Needs Fixing
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Kunal Parmar (pkunal-parmar) wrote :

There is typo here,
108 + if(j!== e.attendess.length-1)

it needs to be

e.attendees.length

review: Needs Fixing
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Kunal Parmar (pkunal-parmar) wrote :

this is looking good now, thanks :)

review: Approve
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
161. By Mihir Soni

Removed lines

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

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 2013-10-15 23:52:44 +0000
3+++ EventDetails.qml 2013-12-20 19:18:14 +0000
4@@ -21,7 +21,15 @@
5 if( pageStack.header )
6 pageStack.header.visible = true;
7 }
8-
9+ Connections{
10+ target: pageStack
11+ onCurrentPageChanged:{
12+ if( pageStack.currentPage === root) {
13+ pageStack.header.visible = false;
14+ showEvent(event);
15+ }
16+ }
17+ }
18 function showEvent(e) {
19 var location = "";
20
21@@ -72,17 +80,16 @@
22 }
23 }
24 */
25- /*
26+
27 ToolbarButton {
28 action:Action {
29 text: i18n.tr("Edit");
30 iconSource: Qt.resolvedUrl("edit.svg");
31 onTriggered: {
32- print(text + " not implemented");
33+ pageStack.push(Qt.resolvedUrl("NewEvent.qml"),{"event":event});
34 }
35 }
36 }
37- */
38 }
39 Rectangle {
40 id:eventDetilsView
41
42=== modified file 'NewEvent.qml'
43--- NewEvent.qml 2013-10-31 15:09:14 +0000
44+++ NewEvent.qml 2013-12-20 19:18:14 +0000
45@@ -8,15 +8,21 @@
46
47 Page {
48 id: root
49-
50 property var date: new Date();
51+
52+ property var event:null;
53+
54 property var startDate;
55 property var endDate;
56 property int optionSelectorWidth: frequencyLabel.width > remindLabel.width ? frequencyLabel.width : remindLabel.width
57
58 property alias scrollY: flickable.contentY
59+ property bool isEdit: false
60
61 Component.onCompleted: {
62+
63+ pageStack.header.visible = true;
64+
65 // If startDate is setted by argument we have to not change it
66 if (typeof(startDate) === 'undefined')
67 startDate = new Date(date)
68@@ -26,37 +32,65 @@
69 endDate = new Date(date)
70 endDate.setMinutes( endDate.getMinutes() + 10)
71 }
72-
73 internal.eventModel = GlobalModel.gloablModel();
74
75+ if(event === null){
76+ isEdit =false;
77+ addEvent();
78+ }
79+ else{
80+ isEdit = true;
81+ editEvent(event);
82+ }
83+ }
84+ //Data for Add events
85+ function addEvent() {
86+ event = Qt.createQmlObject("import QtOrganizer 5.0; Event { }", Qt.application,"NewEvent.qml");
87+ startDate = new Date(date)
88+ endDate = new Date(date)
89+ endDate.setMinutes( endDate.getMinutes() + 10)
90+
91 startTime.text = Qt.formatDateTime(startDate, "dd MMM yyyy hh:mm");
92 endTime.text = Qt.formatDateTime(endDate, "dd MMM yyyy hh:mm");
93 }
94-
95+ //Editing Event
96+ function editEvent(e) {
97+ startDate =new Date(e.startDateTime);
98+ endDate = new Date(e.endDateTime);
99+ startTime.text = Qt.formatDateTime(e.startDateTime, "dd MMM yyyy hh:mm");
100+ endTime.text = Qt.formatDateTime(e.endDateTime, "dd MMM yyyy hh:mm");
101+ if(e.displayLabel)
102+ titleEdit.text = e.displayLabel;
103+ if(e.location)
104+ locationEdit.text = e.location;
105+ if( e.description ) {
106+ messageEdit.text = e.description;
107+ }
108+ if(e.attendees){
109+ for( var j = 0 ; j < e.attendees.length ; ++j ) {
110+ personEdit.text += e.attendees[j].name;
111+ if(j!== e.attendees.length-1)
112+ personEdit.text += ",";
113+ }
114+ }
115+ }
116+ //Save the new or Existing event
117 function saveToQtPim() {
118-
119 internal.clearFocus()
120-
121 if ( startDate >= endDate ) {
122 PopupUtils.open(errorDlgComponent,root,{"text":i18n.tr("End time can't be before start time")});
123 } else {
124-
125- var event = Qt.createQmlObject("import QtOrganizer 5.0; Event { }", Qt.application,"NewEvent.qml");
126-
127 event.startDateTime = startDate;
128 event.endDateTime = endDate;
129 event.displayLabel = titleEdit.text;
130 event.description = messageEdit.text;
131-
132 event.location = locationEdit.text
133-
134+ event.attendees = []; // if Edit remove all attendes & add them again if any
135 if( personEdit.text != "") {
136 var attendee = Qt.createQmlObject("import QtOrganizer 5.0; EventAttendee{}", Qt.application, "NewEvent.qml");
137 attendee.name = personEdit.text;
138- attendee.emailAddress = "none@nowhere.com";
139 event.setDetail(attendee);
140 }
141-
142 internal.eventModel.saveItem(event);
143 pageStack.pop();
144 }
145@@ -65,7 +99,7 @@
146 width: parent.width
147 height: parent.height
148
149- title: i18n.tr("New Event")
150+ title: isEdit ? i18n.tr("Edit Event"):i18n.tr("New Event")
151
152 tools: ToolbarItems {
153 //keeping toolbar always open
154@@ -107,7 +141,6 @@
155 }
156 }
157 }
158-
159 Component {
160 id: timePicker
161 TimePicker {
162@@ -194,7 +227,6 @@
163 }
164 }
165 }
166-
167 NewEventEntryField{
168 id: titleEdit
169 width: parent.width

Subscribers

People subscribed via source and target branches

to status/vote changes: