~mihirsoni/ubuntu-calendar-app/1291906

12.1.3 by Frank Mertens
Added the NewEvent component from the EventAPI_EventView branch
1
import QtQuick 2.0
191.1.1 by Mario Guerriero
fixed bug #1270242
2
import QtOrganizer 5.0
12.1.3 by Frank Mertens
Added the NewEvent component from the EventAPI_EventView branch
3
import Ubuntu.Components 0.1
4
import Ubuntu.Components.Popups 0.1
110.1.18 by Kunal Parmar
merge from trunk
5
import Ubuntu.Components.ListItems 0.1
6
import Ubuntu.Components.Themes.Ambiance 0.1
211.2.1 by Mihir
Added limit functionality to event
7
import Ubuntu.Components.Pickers 0.1
197.1.7 by Yohan Boniface
Put back reminder management lost in previous merge
8
import QtOrganizer 5.0
12.1.3 by Frank Mertens
Added the NewEvent component from the EventAPI_EventView branch
9
197.1.7 by Yohan Boniface
Put back reminder management lost in previous merge
10
import "Defines.js" as Defines
12.1.3 by Frank Mertens
Added the NewEvent component from the EventAPI_EventView branch
11
110.1.18 by Kunal Parmar
merge from trunk
12
Page {
13
    id: root
334.1.2 by Leo Arias
First part of the refactor to the new event test.
14
    objectName: 'newEventPage'
308.2.1 by Mihir Soni
Resolved bug 1328203
15
    property var date;
140.1.4 by Mihir Soni
Merged to branch,added Edit support
16
17
    property var event:null;
233.1.1 by Kunal Parmar
EventView performance improvement
18
    property var model;
140.1.4 by Mihir Soni
Merged to branch,added Edit support
19
252.2.4 by Victor Thompson
Update properties
20
    property var startDate;
21
    property var endDate;
164.2.2 by Riccardo Padovani
Updated optionSelector
22
    property int optionSelectorWidth: frequencyLabel.width > remindLabel.width ? frequencyLabel.width : remindLabel.width
122.2.13 by Riccardo Padovani
Updated to last rev
23
110.1.23 by Kunal Parmar
new event test on device fix
24
    property alias scrollY: flickable.contentY
140.1.1 by Mihir Soni
Added edit functionality
25
    property bool isEdit: false
110.1.18 by Kunal Parmar
merge from trunk
26
197.1.1 by Yohan Boniface
First patch to switch to DatePicker
27
    onStartDateChanged: {
197.1.5 by Yohan Boniface
Allow endDate and startDate to have different days
28
        startDateInput.text = Qt.formatDateTime(startDate, "dd MMM yyyy");
197.1.1 by Yohan Boniface
First patch to switch to DatePicker
29
        startTimeInput.text = Qt.formatDateTime(startDate, "hh:mm");
30
    }
31
32
    onEndDateChanged: {
197.1.5 by Yohan Boniface
Allow endDate and startDate to have different days
33
        endDateInput.text = Qt.formatDateTime(endDate, "dd MMM yyyy");
197.1.1 by Yohan Boniface
First patch to switch to DatePicker
34
        endTimeInput.text = Qt.formatDateTime(endDate, "hh:mm");
35
    }
36
124.3.5 by Kunal Parmar
EDS integration done
37
    Component.onCompleted: {
308.2.1 by Mihir Soni
Resolved bug 1328203
38
        //If current date is setted by an argument we don't have to change it.
39
        if(typeof(date) === 'undefined'){
40
            date = new Date();
41
            var newDate = new Date();
42
            date.setHours(newDate.getHours(), newDate.getMinutes());
43
        }
44
122.2.10 by Riccardo Padovani
Updated to last version
45
        // If startDate is setted by argument we have to not change it
259.1.3 by Mihir Soni
current time
46
        //Set the nearest current time.
122.2.10 by Riccardo Padovani
Updated to last version
47
        if (typeof(startDate) === 'undefined')
252.2.3 by Victor Thompson
Fix solution
48
            startDate = new Date(root.roundDate(date))
122.2.10 by Riccardo Padovani
Updated to last version
49
50
        // If endDate is setted by argument we have to not change it
51
        if (typeof(endDate) === 'undefined') {
252.2.3 by Victor Thompson
Fix solution
52
            endDate = new Date(root.roundDate(date))
53
            endDate.setMinutes(endDate.getMinutes() + 30)
308.2.1 by Mihir Soni
Resolved bug 1328203
54
            endTimeInput.text = Qt.formatDateTime(endDate, "hh:mm");
122.2.10 by Riccardo Padovani
Updated to last version
55
        }
124.3.9 by Kunal Parmar
Merged from Trunk
56
140.1.1 by Mihir Soni
Added edit functionality
57
        if(event === null){
197.1.3 by Yohan Boniface
Merge with trunk
58
            isEdit = false;
140.1.1 by Mihir Soni
Added edit functionality
59
            addEvent();
315.1.1 by Mihir Soni
focus to event Title while creating new event
60
            titleEdit.forceActiveFocus();
140.1.1 by Mihir Soni
Added edit functionality
61
        }
140.1.14 by Mihir Soni
Deleted all attendees while editing
62
        else{
140.1.4 by Mihir Soni
Merged to branch,added Edit support
63
            isEdit = true;
140.1.1 by Mihir Soni
Added edit functionality
64
            editEvent(event);
140.1.4 by Mihir Soni
Merged to branch,added Edit support
65
        }
66
    }
197.1.7 by Yohan Boniface
Put back reminder management lost in previous merge
67
140.1.4 by Mihir Soni
Merged to branch,added Edit support
68
    //Data for Add events
69
    function addEvent() {
140.1.14 by Mihir Soni
Deleted all attendees while editing
70
        event = Qt.createQmlObject("import QtOrganizer 5.0; Event { }", Qt.application,"NewEvent.qml");
110.1.18 by Kunal Parmar
merge from trunk
71
    }
140.1.4 by Mihir Soni
Merged to branch,added Edit support
72
    //Editing Event
73
    function editEvent(e) {
74
        startDate =new Date(e.startDateTime);
75
        endDate = new Date(e.endDateTime);
192.2.1 by Kunal Parmar
Reminder support added
76
197.1.7 by Yohan Boniface
Put back reminder management lost in previous merge
77
        if(e.displayLabel) {
140.1.4 by Mihir Soni
Merged to branch,added Edit support
78
            titleEdit.text = e.displayLabel;
197.1.7 by Yohan Boniface
Put back reminder management lost in previous merge
79
        }
297.1.1 by Mihir Soni
All day edit
80
        if(e.allDay){
81
            allDayEventCheckbox.checked =true;
82
        }
264.1.1 by Kunal Parmar
Editing by eventtype
83
197.1.7 by Yohan Boniface
Put back reminder management lost in previous merge
84
        if(e.location) {
140.1.4 by Mihir Soni
Merged to branch,added Edit support
85
            locationEdit.text = e.location;
197.1.7 by Yohan Boniface
Put back reminder management lost in previous merge
86
        }
264.1.1 by Kunal Parmar
Editing by eventtype
87
140.1.4 by Mihir Soni
Merged to branch,added Edit support
88
        if( e.description ) {
89
            messageEdit.text = e.description;
90
        }
264.1.4 by Kunal Parmar
parentEvent moved to internal
91
        if( e.itemType === Type.Event ) {
264.1.1 by Kunal Parmar
Editing by eventtype
92
            if(e.attendees){
93
                for( var j = 0 ; j < e.attendees.length ; ++j ) {
94
                    personEdit.text += e.attendees[j].name;
95
                    if(j!== e.attendees.length-1)
96
                        personEdit.text += ",";
97
                }
98
            }
99
211.2.32 by Mihir Soni
Merge with trunk
100
            var index = 0;
264.1.1 by Kunal Parmar
Editing by eventtype
101
            if(e.recurrence ) {
102
                var recurrenceRule = e.recurrence.recurrenceRules;
103
                index = ( recurrenceRule.length > 0 ) ? recurrenceRule[0].frequency : 0;
211.2.32 by Mihir Soni
Merge with trunk
104
                if(index > 0 ){
105
                    limit.visible = true;
106
                    if(recurrenceRule[0].limit !== undefined){
107
                        var temp = recurrenceRule[0].limit;
211.2.35 by Mihir Soni
Added display of repetition ends
108
                        if(parseInt(temp)){
211.2.32 by Mihir Soni
Merge with trunk
109
                            limitOptions.selectedIndex = 1;
110
                            limitCount.text = temp;
111
                        }
112
                        else{
113
                            limitOptions.selectedIndex = 2;
114
                            datePick.date= temp;
115
                        }
211.2.4 by Mihir Soni
Edit functionality implemented.
116
                    }
117
                    else{
211.2.32 by Mihir Soni
Merge with trunk
118
                        // If limit is infinite
119
                        limitOptions.selectedIndex = 0;
211.2.4 by Mihir Soni
Edit functionality implemented.
120
                    }
211.2.2 by Mihir Soni
Added , edit support for limit
121
                }
122
            }
264.1.1 by Kunal Parmar
Editing by eventtype
123
            recurrenceOption.selectedIndex = index;
124
        }
197.1.7 by Yohan Boniface
Put back reminder management lost in previous merge
125
126
        index = 0;
127
        var reminder = e.detail( Detail.VisualReminder);
128
        if( reminder ) {
129
            var reminderTime = reminder.secondsBeforeStart;
130
            var foundIndex = Defines.reminderValue.indexOf(reminderTime);
131
            index = foundIndex != -1 ? foundIndex : 0;
132
        }
133
        reminderOption.selectedIndex = index;
140.1.4 by Mihir Soni
Merged to branch,added Edit support
134
    }
191.2.1 by Mario Guerriero
added support for recurrence in edit and display mode
135
140.1.4 by Mihir Soni
Merged to branch,added Edit support
136
    //Save the new or Existing event
124.3.9 by Kunal Parmar
Merged from Trunk
137
    function saveToQtPim() {
138
        internal.clearFocus()
197.1.5 by Yohan Boniface
Allow endDate and startDate to have different days
139
        if ( startDate >= endDate && !allDayEventCheckbox.checked) {
124.3.10 by Kunal Parmar
error dialog integrated
140
            PopupUtils.open(errorDlgComponent,root,{"text":i18n.tr("End time can't be before start time")});
124.3.9 by Kunal Parmar
Merged from Trunk
141
        } else {
142
            event.startDateTime = startDate;
143
            event.endDateTime = endDate;
144
            event.displayLabel = titleEdit.text;
140.1.9 by Mihir Soni
removed static text
145
            event.description = messageEdit.text;
124.3.9 by Kunal Parmar
Merged from Trunk
146
            event.location = locationEdit.text
197.1.7 by Yohan Boniface
Put back reminder management lost in previous merge
147
191.4.1 by Kunal Parmar
Applying changes
148
            event.allDay = allDayEventCheckbox.checked;
149
211.2.35 by Mihir Soni
Added display of repetition ends
150
151
            if( event.itemType === Type.Event ) {
152
                event.attendees = []; // if Edit remove all attendes & add them again if any
153
                if( personEdit.text != "") {
154
                    var attendee = Qt.createQmlObject("import QtOrganizer 5.0; EventAttendee{}", event, "NewEvent.qml");
155
                    attendee.name = personEdit.text;
156
                    event.setDetail(attendee);
157
                }
158
159
                var recurrenceRule = Defines.recurrenceValue[ recurrenceOption.selectedIndex ];
160
                var rule = Qt.createQmlObject("import QtOrganizer 5.0; RecurrenceRule {}", event.recurrence,"NewEvent.qml");
161
                if( recurrenceRule !== RecurrenceRule.Invalid ) {
162
163
                    rule.frequency = recurrenceRule;
164
                    if(limitOptions.selectedIndex === 1 && recurrenceOption.selectedIndex > 0){
165
                        rule.limit =  parseInt(limitCount.text);
166
                    }
167
                    else if(limitOptions.selectedIndex === 2 && recurrenceOption.selectedIndex > 0){
168
                        rule.limit =  datePick.date;
169
                    }
170
                    else{
171
                        rule.limit = undefined;
172
                    }
173
                }
174
            }
175
            event.recurrence.recurrenceRules = [rule];
176
            //remove old reminder value
177
            var oldVisualReminder = event.detail(Detail.VisualReminder);
178
            if(oldVisualReminder) {
179
                event.removeDetail(oldVisualReminder);
180
            }
181
182
            var oldAudibleReminder = event.detail(Detail.AudibleReminder);
183
            if(oldAudibleReminder) {
184
                event.removeDetail(oldAudibleReminder);
185
            }
186
187
            var reminderTime = Defines.reminderValue[ reminderOption.selectedIndex ];
188
            if( reminderTime !== 0 ) {
189
                var visualReminder =  Qt.createQmlObject("import QtOrganizer 5.0; VisualReminder{}", event, "NewEvent.qml");
190
                visualReminder.repetitionCount = 3;
191
                visualReminder.repetitionDelay = 120;
192
                visualReminder.message = titleEdit.text
193
                visualReminder.secondsBeforeStart = reminderTime;
194
                event.setDetail(visualReminder);
195
196
                var audibleReminder =  Qt.createQmlObject("import QtOrganizer 5.0; AudibleReminder{}", event, "NewEvent.qml");
197
                audibleReminder.repetitionCount = 3;
198
                audibleReminder.repetitionDelay = 120;
199
                audibleReminder.secondsBeforeStart = reminderTime;
200
                event.setDetail(audibleReminder);
201
            }
202
203
            model.saveItem(event);
204
            pageStack.pop();
140.1.1 by Mihir Soni
Added edit functionality
205
        }
124.3.9 by Kunal Parmar
Merged from Trunk
206
    }
207
197.1.2 by Yohan Boniface
Highlight datetime input when datepicker is open
208
    function openDatePicker (element, caller, callerProperty, mode) {
209
        element.highlighted = true;
210
        var picker = PickerPanel.openDatePicker(caller, callerProperty, mode);
211
        if (!picker) return;
212
        picker.closed.connect(function () {
213
            element.highlighted = false;
214
        });
221.1.2 by Brian LaRochelle
Move changes from rev 222 into functions of the root of NewEvent {}
215
    }
216
252.2.1 by Victor Thompson
* Use date rounded up to nearest half hour
217
    // Calucate default hour and minute for start and end time on event
218
    function roundDate(date) {
252.2.3 by Victor Thompson
Fix solution
219
        var tempDate = new Date(date)
220
        if(tempDate.getMinutes() < 30)
221
            return tempDate.setMinutes(30)
222
        tempDate.setMinutes(0)
223
        return tempDate.setHours(tempDate.getHours() + 1)
221.1.2 by Brian LaRochelle
Move changes from rev 222 into functions of the root of NewEvent {}
224
    }
225
110.1.20 by Kunal Parmar
setting height to resolve binding error
226
    width: parent.width
227
    height: parent.height
228
140.1.4 by Mihir Soni
Merged to branch,added Edit support
229
    title: isEdit ? i18n.tr("Edit Event"):i18n.tr("New Event")
110.1.18 by Kunal Parmar
merge from trunk
230
183.1.1 by Kunal Parmar
Key Navigation implemented
231
    Keys.onEscapePressed: {
232
        pageStack.pop();
233
    }
234
253.4.1 by Renato Araujo Oliveira Filho
Make sure that the field is always visible on NewEvent page.
235
    // we use a custom toolbar in this view
110.1.18 by Kunal Parmar
merge from trunk
236
    tools: ToolbarItems {
237
        locked: true
253.4.1 by Renato Araujo Oliveira Filho
Make sure that the field is always visible on NewEvent page.
238
        opened: false
110.1.18 by Kunal Parmar
merge from trunk
239
    }
140.1.10 by Mihir Soni
Resolved issue showing error
240
241
    Component{
242
        id: errorDlgComponent
243
        Dialog {
244
            id: dialog
245
            title: i18n.tr("Error")
246
            Button {
247
                text: i18n.tr("Ok")
248
                onClicked: PopupUtils.close(dialog)
249
            }
250
        }
251
    }
191.4.1 by Kunal Parmar
Applying changes
252
110.1.18 by Kunal Parmar
merge from trunk
253
    Flickable{
110.1.23 by Kunal Parmar
new event test on device fix
254
        id: flickable
253.4.1 by Renato Araujo Oliveira Filho
Make sure that the field is always visible on NewEvent page.
255
256
        property var activeItem: null
257
258
        function makeMeVisible(item) {
259
            if (!item) {
260
                return
261
            }
262
263
            activeItem = item
264
            var position = flickable.contentItem.mapFromItem(item, 0, 0);
265
266
            // check if the item is already visible
267
            var bottomY = flickable.contentY + flickable.height
268
            var itemBottom = position.y + item.height
269
            if (position.y >= flickable.contentY && itemBottom <= bottomY) {
270
                return;
271
            }
272
273
            // if it is not, try to scroll and make it visible
274
            var targetY = position.y + item.height - flickable.height
275
            if (targetY >= 0 && position.y) {
276
                flickable.contentY = targetY;
277
            } else if (position.y < flickable.contentY) {
278
                // if it is hidden at the top, also show it
279
                flickable.contentY = position.y;
280
            }
281
            flickable.returnToBounds()
282
        }
283
12.1.3 by Frank Mertens
Added the NewEvent component from the EventAPI_EventView branch
284
        anchors {
110.1.18 by Kunal Parmar
merge from trunk
285
            top: parent.top
286
            topMargin: units.gu(2)
253.4.1 by Renato Araujo Oliveira Filho
Make sure that the field is always visible on NewEvent page.
287
            bottom: toolbar.top
12.1.3 by Frank Mertens
Added the NewEvent component from the EventAPI_EventView branch
288
            left: parent.left
289
            right: parent.right
110.1.18 by Kunal Parmar
merge from trunk
290
            leftMargin: units.gu(2)
291
            rightMargin: units.gu(2)
292
        }
293
294
        contentWidth: width
295
        contentHeight: column.height
296
197.1.3 by Yohan Boniface
Merge with trunk
297
        Column {
110.1.18 by Kunal Parmar
merge from trunk
298
            id: column
299
12.1.3 by Frank Mertens
Added the NewEvent component from the EventAPI_EventView branch
300
            width: parent.width
110.1.18 by Kunal Parmar
merge from trunk
301
            spacing: units.gu(1)
302
197.1.3 by Yohan Boniface
Merge with trunk
303
            UbuntuShape {
110.1.18 by Kunal Parmar
merge from trunk
304
                width:parent.width
305
                height: timeColumn.height
306
307
                Column{
308
                    id: timeColumn
12.1.3 by Frank Mertens
Added the NewEvent component from the EventAPI_EventView branch
309
                    width: parent.width
110.1.18 by Kunal Parmar
merge from trunk
310
                    anchors.centerIn: parent
311
                    spacing: units.gu(1)
312
197.1.5 by Yohan Boniface
Allow endDate and startDate to have different days
313
                    Item {
191.4.1 by Kunal Parmar
Applying changes
314
                        width: parent.width
197.1.5 by Yohan Boniface
Allow endDate and startDate to have different days
315
                        height: startDateInput.height
316
317
                        NewEventEntryField{
318
                            id: startDateInput
319
                            title: i18n.tr("Start")
197.1.15 by nskaggs
first working version of newevent test
320
                            objectName: "startDateInput"
197.1.5 by Yohan Boniface
Allow endDate and startDate to have different days
321
322
                            text: ""
323
324
                            width: allDayEventCheckbox.checked ? parent.width : parent.width / 2
325
326
                            MouseArea{
327
                                anchors.fill: parent
328
                                onClicked: openDatePicker(startDateInput, root, "startDate", "Years|Months|Days")
329
                            }
197.1.3 by Yohan Boniface
Merge with trunk
330
                        }
331
197.1.1 by Yohan Boniface
First patch to switch to DatePicker
332
                        NewEventEntryField{
197.1.3 by Yohan Boniface
Merge with trunk
333
                            id: startTimeInput
197.1.5 by Yohan Boniface
Allow endDate and startDate to have different days
334
                            title: i18n.tr("at")
197.1.1 by Yohan Boniface
First patch to switch to DatePicker
335
                            objectName: "startTimeInput"
336
337
                            text: ""
338
197.1.5 by Yohan Boniface
Allow endDate and startDate to have different days
339
                            width: (parent.width / 2) - units.gu(1)
340
                            anchors.right: parent.right
341
                            visible: !allDayEventCheckbox.checked
342
343
                            MouseArea{
344
                                anchors.fill: parent
345
                                onClicked: openDatePicker(startTimeInput, root, "startDate", "Hours|Minutes")
346
                            }
347
                        }
348
                    }
349
350
                    Item {
351
                        width: parent.width
352
                        height: endDateInput.height
353
                        visible: !allDayEventCheckbox.checked
354
355
                        NewEventEntryField{
356
                            id: endDateInput
357
                            title: i18n.tr("End")
358
                            objectName: "endDateInput"
359
360
                            text: ""
361
197.1.3 by Yohan Boniface
Merge with trunk
362
                            width: parent.width / 2
197.1.1 by Yohan Boniface
First patch to switch to DatePicker
363
364
                            MouseArea{
365
                                anchors.fill: parent
197.1.5 by Yohan Boniface
Allow endDate and startDate to have different days
366
                                onClicked: openDatePicker(endDateInput, root, "endDate", "Years|Months|Days")
56.1.4 by Riccardo Padovani
Implemented DatePicker. Thanks to Michael Zanetti
367
                            }
12.1.3 by Frank Mertens
Added the NewEvent component from the EventAPI_EventView branch
368
                        }
197.1.1 by Yohan Boniface
First patch to switch to DatePicker
369
370
                        NewEventEntryField{
197.1.3 by Yohan Boniface
Merge with trunk
371
                            id: endTimeInput
197.1.5 by Yohan Boniface
Allow endDate and startDate to have different days
372
                            title: i18n.tr("at")
197.1.1 by Yohan Boniface
First patch to switch to DatePicker
373
                            objectName: "endTimeInput"
374
375
                            text: ""
376
377
                            width: (parent.width / 2) - units.gu(1)
378
                            anchors.right: parent.right
379
380
                            MouseArea{
381
                                anchors.fill: parent
197.1.2 by Yohan Boniface
Highlight datetime input when datepicker is open
382
                                onClicked: openDatePicker(endTimeInput, root, "endDate", "Hours|Minutes")
197.2.1 by David Planella
Merged from trunk
383
56.1.4 by Riccardo Padovani
Implemented DatePicker. Thanks to Michael Zanetti
384
                            }
12.1.3 by Frank Mertens
Added the NewEvent component from the EventAPI_EventView branch
385
                        }
386
                    }
387
                }
388
            }
191.4.1 by Kunal Parmar
Applying changes
389
390
            Row {
391
                width: parent.width
392
                spacing: units.gu(1)
393
                anchors.margins: units.gu(0.5)
394
395
                Label {
396
                    text: i18n.tr("All Day event:")
397
                    anchors.verticalCenter: allDayEventCheckbox.verticalCenter
398
                }
399
400
                CheckBox {
401
                    id: allDayEventCheckbox
402
                    checked: false
403
                }
404
            }
405
197.1.3 by Yohan Boniface
Merge with trunk
406
            ThinDivider{}
407
110.1.18 by Kunal Parmar
merge from trunk
408
            NewEventEntryField{
409
                id: titleEdit
410
                width: parent.width
411
                title: i18n.tr("Event Name")
412
                objectName: "newEventName"
413
            }
414
290.2.1 by Kunal Parmar
removing ubuntu shape from description field
415
            Column{
416
                id: descriptionColumn
417
                width: parent.width
418
                spacing: units.gu(1)
419
420
                Label {
421
                    text: i18n.tr("Description")
422
                    anchors.margins: units.gu(0.5)
423
                    anchors.left: parent.left
424
                }
425
426
                TextArea{
427
                    id: messageEdit
197.1.17 by nskaggs
rebase with trunk, add description and guest input
428
                    objectName: "eventDescriptionInput"
110.1.18 by Kunal Parmar
merge from trunk
429
                    width: parent.width
290.2.1 by Kunal Parmar
removing ubuntu shape from description field
430
                    color: focus ? "#2C001E" : "#5D5D5D"
431
                    // default style
432
                    font {
433
                        pixelSize: focus ? FontUtils.sizeToPixels("large") : FontUtils.sizeToPixels("medium")
110.1.18 by Kunal Parmar
merge from trunk
434
                    }
435
                }
436
            }
437
438
            NewEventEntryField{
439
                id: locationEdit
440
                width: parent.width
441
                title: i18n.tr("Location")
33.1.7 by Omer Akram
add autopilot test for NewEvent dialog
442
                objectName: "eventLocationInput"
110.1.18 by Kunal Parmar
merge from trunk
443
            }
444
110.1.27 by Kunal Parmar
Further modification for new event testcase
445
            NewEventEntryField{
446
                id: personEdit
447
                width: parent.width
448
                title: i18n.tr("Guests")
449
                objectName: "eventPeopleInput"
264.1.3 by Kunal Parmar
Hard coding removed
450
                visible: event.itemType === Type.Event
110.1.27 by Kunal Parmar
Further modification for new event testcase
451
            }
452
164.2.2 by Riccardo Padovani
Updated optionSelector
453
            Item {
110.1.18 by Kunal Parmar
merge from trunk
454
                width: parent.width
191.2.1 by Mario Guerriero
added support for recurrence in edit and display mode
455
                height: recurrenceOption.height
264.1.3 by Kunal Parmar
Hard coding removed
456
                visible: event.itemType === Type.Event
110.1.18 by Kunal Parmar
merge from trunk
457
                Label{
458
                    id: frequencyLabel
459
                    text: i18n.tr("This happens");
460
                    anchors.verticalCenter: parent.verticalCenter
461
                }
462
                OptionSelector{
191.2.1 by Mario Guerriero
added support for recurrence in edit and display mode
463
                    id: recurrenceOption
164.2.2 by Riccardo Padovani
Updated optionSelector
464
                    anchors.right: parent.right
465
                    width: parent.width - optionSelectorWidth - units.gu(1)
197.1.7 by Yohan Boniface
Put back reminder management lost in previous merge
466
                    model: Defines.recurrenceLabel
467
                    containerHeight: itemHeight * 4
110.1.18 by Kunal Parmar
merge from trunk
468
                }
469
            }
211.2.1 by Mihir
Added limit functionality to event
470
            Item {
211.2.2 by Mihir Soni
Added , edit support for limit
471
                id: limit
211.2.7 by Mihir Soni
Modifications as per Review comments.
472
                visible: recurrenceOption.selectedIndex != 0
211.2.1 by Mihir
Added limit functionality to event
473
                width: parent.width
474
                height: limitOptions.height
475
                Label{
211.2.2 by Mihir Soni
Added , edit support for limit
476
                    id: limitLabel
211.2.25 by Mihir Soni
Changed width of label
477
                    text: i18n.tr("Recurring event ends");
211.2.28 by Mihir Soni
Changed width
478
                    anchors{
211.2.32 by Mihir Soni
Merge with trunk
479
                        left: parent.left
480
                        right: limitOptions.left
211.2.28 by Mihir Soni
Changed width
481
                    }
482
                    wrapMode: Text.WordWrap
483
                    maximumLineCount: 2
211.2.1 by Mihir
Added limit functionality to event
484
                    anchors.verticalCenter: parent.verticalCenter
485
                }
486
                OptionSelector{
487
                    id: limitOptions
488
                    anchors.right: parent.right
211.2.28 by Mihir Soni
Changed width
489
                    width: parent.width - optionSelectorWidth - units.gu(3)
211.2.1 by Mihir
Added limit functionality to event
490
                    model: Defines.limitLabel
491
                    containerHeight: itemHeight * 4
492
493
                }
494
            }
495
            NewEventEntryField{
496
                id: limitCount
497
                width: parent.width
498
                title: i18n.tr("Count")
499
                objectName: "eventLimitCount"
211.2.12 by Mihir Soni
Modified as per review comments
500
                visible:  recurrenceOption.selectedIndex != 0 && limitOptions.selectedIndex == 1;
211.2.14 by Mihir Soni
Removed top limit Int Validator
501
                validator: IntValidator{bottom: 1;}
211.2.20 by Mihir Soni
Modifed per the review comments
502
                inputMethodHints: Qt.ImhDialableCharactersOnly
211.2.7 by Mihir Soni
Modifications as per Review comments.
503
                focus: true
211.2.1 by Mihir
Added limit functionality to event
504
            }
505
            Item {
506
                id: limitDate
507
                width: parent.width
508
                height: datePick.height
211.2.12 by Mihir Soni
Modified as per review comments
509
                visible: recurrenceOption.selectedIndex != 0 && limitOptions.selectedIndex===2;
211.2.1 by Mihir
Added limit functionality to event
510
                DatePicker{
511
                    id:datePick;
512
                    width: parent.width
513
                }
514
            }
164.2.2 by Riccardo Padovani
Updated optionSelector
515
            Item{
110.1.18 by Kunal Parmar
merge from trunk
516
                width: parent.width
197.1.7 by Yohan Boniface
Put back reminder management lost in previous merge
517
                height: reminderOption.height
110.1.18 by Kunal Parmar
merge from trunk
518
                Label{
519
                    id: remindLabel
520
                    text: i18n.tr("Remind me");
521
                    anchors.verticalCenter: parent.verticalCenter
522
                }
197.1.7 by Yohan Boniface
Put back reminder management lost in previous merge
523
110.1.18 by Kunal Parmar
merge from trunk
524
                OptionSelector{
197.1.7 by Yohan Boniface
Put back reminder management lost in previous merge
525
                    id: reminderOption
164.2.2 by Riccardo Padovani
Updated optionSelector
526
                    anchors.right: parent.right
527
                    width: parent.width - optionSelectorWidth - units.gu(1)
197.1.7 by Yohan Boniface
Put back reminder management lost in previous merge
528
                    containerHeight: itemHeight * 4
529
                    model: Defines.reminderLabel
110.1.18 by Kunal Parmar
merge from trunk
530
                }
531
            }
88.1.1 by Olivier Tilloy
Dismiss the OSK when a text field looses focus.
532
        }
124.3.5 by Kunal Parmar
EDS integration done
533
    }
534
253.4.1 by Renato Araujo Oliveira Filho
Make sure that the field is always visible on NewEvent page.
535
    EditToolbar {
536
        id: toolbar
537
        anchors {
538
            left: parent.left
539
            right: parent.right
540
            bottom: parent.bottom
541
        }
542
        height: units.gu(6)
543
        acceptAction: Action {
544
            text: i18n.tr("Save")
545
            onTriggered: saveToQtPim();
546
        }
547
        rejectAction: Action {
548
            text: i18n.tr("Cancel")
549
            onTriggered: pageStack.pop();
550
        }
551
    }
552
553
    // used to keep the field visible when the keyboard appear or dismiss
554
    KeyboardRectangle {
555
        id: keyboard
556
557
        onHeightChanged: {
558
            if (flickable.activeItem) {
559
                flickable.makeMeVisible(flickable.activeItem)
560
            }
561
        }
562
    }
563
88.1.1 by Olivier Tilloy
Dismiss the OSK when a text field looses focus.
564
    QtObject {
565
        id: internal
566
567
        function clearFocus() {
568
            Qt.inputMethod.hide()
569
            titleEdit.focus = false
570
            locationEdit.focus = false
571
            personEdit.focus = false
197.1.5 by Yohan Boniface
Allow endDate and startDate to have different days
572
            startDateInput.focus = false
197.1.3 by Yohan Boniface
Merge with trunk
573
            startTimeInput.focus = false
197.1.5 by Yohan Boniface
Allow endDate and startDate to have different days
574
            endDateInput.focus = false
197.1.1 by Yohan Boniface
First patch to switch to DatePicker
575
            endTimeInput.focus = false
124.3.9 by Kunal Parmar
Merged from Trunk
576
            messageEdit.focus = false
88.1.1 by Olivier Tilloy
Dismiss the OSK when a text field looses focus.
577
        }
578
    }
12.1.3 by Frank Mertens
Added the NewEvent component from the EventAPI_EventView branch
579
}