~nskaggs/ubuntu-calendar-app/apparmor-symlinks

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