38
function showEvent(e) {
39
// TRANSLATORS: this is a time formatting string,
40
// see http://qt-project.org/doc/qt-5.0/qtqml/qml-qtquick2-date.html#details for valid expressions
41
var timeFormat = i18n.tr("hh:mm");
42
var startTime = e.startDateTime.toLocaleTimeString(Qt.locale(), timeFormat);
43
var endTime = e.endDateTime.toLocaleTimeString(Qt.locale(), timeFormat);
45
startHeader.value = startTime;
46
endHeader.value = endTime;
48
allDayEventCheckbox.checked = e.allDay;
50
// This is the event title
52
titleLabel.text = e.displayLabel;
56
descLabel.text = e.description;
58
var attendees = e.attendees;
42
function updateRecurrence( event ) {
44
if(event.recurrence ) {
45
var recurrenceRule = event.recurrence.recurrenceRules;
46
if(recurrenceRule.length > 0){
47
index = recurrenceRule[0].frequency ;
53
recurrentHeader.value = Defines.recurrenceLabel[index];
56
function updateContacts(event) {
57
var attendees = event.attendees;
59
58
contactModel.clear();
60
59
if( attendees !== undefined ) {
61
60
for( var j = 0 ; j < attendees.length ; ++j ) {
62
61
contactModel.append( {"name": attendees[j].name,"participationStatus": attendees[j].participationStatus } );
66
function updateReminder(event) {
68
var recurrenceRule = e.recurrence.recurrenceRules;
69
index = ( recurrenceRule.length > 0 ) ? recurrenceRule[0].frequency : 0;
71
recurrentHeader.value = Defines.recurrenceLabel[index];
74
var reminder = e.detail( Detail.VisualReminder);
68
var reminder = event.detail( Detail.VisualReminder);
76
70
var reminderTime = reminder.secondsBeforeStart;
77
71
var foundIndex = Defines.reminderValue.indexOf(reminderTime);
78
72
index = foundIndex != -1 ? foundIndex : 0;
80
74
reminderHeader.value = Defines.reminderLabel[index];
82
var collection = model.collection( e.collectionId );
83
calendarIndicator.color = collection.color
84
calendarName.text = collection.name
87
locationLabel.text = e.location;
77
function updateLocation(event) {
78
if( event.location ) {
79
locationLabel.text = event.location;
89
81
// FIXME: need to cache map image to avoid duplicate download every time
90
var imageSrc = "http://maps.googleapis.com/maps/api/staticmap?center="+e.location+
91
"&markers=color:red|"+e.location+"&zoom=15&size="+mapContainer.width+
82
var imageSrc = "http://maps.googleapis.com/maps/api/staticmap?center="+event.location+
83
"&markers=color:red|"+event.location+"&zoom=15&size="+mapContainer.width+
92
84
"x"+mapContainer.height+"&sensor=false";
93
85
mapImage.source = imageSrc;
94
function updateCollection(event) {
95
var collection = model.collection( e.collectionId );
96
calendarIndicator.color = collection.color
97
calendarName.text = collection.name
100
function showEvent(e) {
101
// TRANSLATORS: this is a time formatting string,
102
// see http://qt-project.org/doc/qt-5/qml-qtqml-date.html#details for valid expressions
103
var timeFormat = i18n.tr("hh:mm");
104
// TRANSLATORS: this is a time & Date formatting string,
105
//see http://qt-project.org/doc/qt-5/qml-qtqml-date.html#details
106
var dateFormat = i18n.tr("dd-MMM-yyyy")
107
eventDate.value = e.startDateTime.toLocaleString(Qt.locale(),dateFormat);
108
var startTime = e.startDateTime.toLocaleTimeString(Qt.locale(), timeFormat);
109
var endTime = e.endDateTime.toLocaleTimeString(Qt.locale(), timeFormat);
111
if( e.itemType === Type.EventOccurrence ){
113
model.onItemsFetched.connect( function(id,fetchedItems){
114
if(requestId === id && fetchedItems.length > 0) {
115
internal.parentEvent = fetchedItems[0];
116
updateRecurrence(internal.parentEvent);
117
updateContacts(internal.parentEvent);
120
requestId = model.fetchItems([e.parentId]);
123
startHeader.value = startTime;
124
endHeader.value = endTime;
126
allDayEventCheckbox.checked = e.allDay;
128
// This is the event title
129
if( e.displayLabel) {
130
titleLabel.text = e.displayLabel;
133
if( e.description ) {
134
descLabel.text = e.description;
102
148
Keys.onEscapePressed: {
129
175
text: i18n.tr("Edit");
130
176
iconSource: Qt.resolvedUrl("edit.svg");
132
pageStack.push(Qt.resolvedUrl("NewEvent.qml"),{"event":event,"model":model});
178
if( event.itemType === Type.EventOccurrence ) {
179
var dialog = PopupUtils.open(Qt.resolvedUrl("EditEventConfirmationDialog.qml"),root,{"event": event});
180
dialog.editEvent.connect( function(eventId){
181
if( eventId === event.parentId ) {
182
pageStack.push(Qt.resolvedUrl("NewEvent.qml"),{"event":internal.parentEvent,"model":model});
184
pageStack.push(Qt.resolvedUrl("NewEvent.qml"),{"event":event,"model":model});
188
pageStack.push(Qt.resolvedUrl("NewEvent.qml"),{"event":event,"model":model});
197
property var parentEvent;
207
flickableItem: flicable
208
align: Qt.AlignTrailing
215
contentHeight: column.height + units.gu(3) /*top margin + spacing */
216
contentWidth: parent.width
218
interactive: contentHeight > height
146
222
spacing: units.gu(1)