12
11
property var date: new Date();
13
property var event:null;
13
15
property var startDate;
14
16
property var endDate;
15
17
property int optionSelectorWidth: frequencyLabel.width > remindLabel.width ? frequencyLabel.width : remindLabel.width
17
19
property alias scrollY: flickable.contentY
20
property bool isEdit: false
19
22
Component.onCompleted: {
24
pageStack.header.visible = true;
20
26
// If startDate is setted by argument we have to not change it
21
27
if (typeof(startDate) === 'undefined')
22
28
startDate = new Date(date)
26
32
endDate = new Date(date)
27
33
endDate.setMinutes( endDate.getMinutes() + 10)
30
35
internal.eventModel = GlobalModel.gloablModel();
48
event = Qt.createQmlObject("import QtOrganizer 5.0; Event { }", Qt.application,"NewEvent.qml");
49
startDate = new Date(date)
50
endDate = new Date(date)
51
endDate.setMinutes( endDate.getMinutes() + 10)
32
53
startTime.text = Qt.formatDateTime(startDate, "dd MMM yyyy hh:mm");
33
54
endTime.text = Qt.formatDateTime(endDate, "dd MMM yyyy hh:mm");
57
function editEvent(e) {
58
startDate =new Date(e.startDateTime);
59
endDate = new Date(e.endDateTime);
60
startTime.text = Qt.formatDateTime(e.startDateTime, "dd MMM yyyy hh:mm");
61
endTime.text = Qt.formatDateTime(e.endDateTime, "dd MMM yyyy hh:mm");
63
titleEdit.text = e.displayLabel;
65
locationEdit.text = e.location;
67
messageEdit.text = e.description;
70
for( var j = 0 ; j < e.attendees.length ; ++j ) {
71
personEdit.text += e.attendees[j].name;
72
if(j!== e.attendees.length-1)
73
personEdit.text += ",";
77
//Save the new or Existing event
36
78
function saveToQtPim() {
38
79
internal.clearFocus()
40
80
if ( startDate >= endDate ) {
41
81
PopupUtils.open(errorDlgComponent,root,{"text":i18n.tr("End time can't be before start time")});
44
var event = Qt.createQmlObject("import QtOrganizer 5.0; Event { }", Qt.application,"NewEvent.qml");
46
83
event.startDateTime = startDate;
47
84
event.endDateTime = endDate;
48
85
event.displayLabel = titleEdit.text;
49
86
event.description = messageEdit.text;
51
87
event.location = locationEdit.text
88
event.attendees = []; // if Edit remove all attendes & add them again if any
53
89
if( personEdit.text != "") {
54
90
var attendee = Qt.createQmlObject("import QtOrganizer 5.0; EventAttendee{}", Qt.application, "NewEvent.qml");
55
91
attendee.name = personEdit.text;
56
attendee.emailAddress = "none@nowhere.com";
57
92
event.setDetail(attendee);
60
94
internal.eventModel.saveItem(event);