diff --git a/calendar/base/content/calendar-multiday-view.css b/calendar/base/content/calendar-multiday-view.css index 664fea7fefc..516908e963e 100644 --- a/calendar/base/content/calendar-multiday-view.css +++ b/calendar/base/content/calendar-multiday-view.css @@ -147,6 +147,7 @@ calendar-time-bar { /*== calendar-multiday-view ==*/ calendar-multiday-view { -moz-binding: url(chrome://calendar/content/calendar-multiday-view.xml#calendar-multiday-view); + -moz-user-focus: normal; } .calendar-day-label-box { diff --git a/calendar/base/content/calendar-multiday-view.xml b/calendar/base/content/calendar-multiday-view.xml index 858b698a033..4606256f924 100644 --- a/calendar/base/content/calendar-multiday-view.xml +++ b/calendar/base/content/calendar-multiday-view.xml @@ -216,25 +216,20 @@ @@ -445,13 +440,20 @@ var itemIndex = -1; var i; for (i = 0; i < this.mEvents.length; i++) { - if (this.mEvents[i].event == aOccurrence) { + occ = this.mEvents[i].event; + if (occ.item == aOccurrence.item && + occ.occurrenceStartDate.compare(aOccurrence.occurrenceStartDate) == 0 && + occ.occurrenceEndDate.compare(aOccurrence.occurrenceEndDate) == 0) + { itemIndex = i; break; } } if (itemIndex != -1) { + if (this.mSelectedOccurrence == this.mEvents[itemIndex]) + this.mSelectedOccurrence = null; + this.mEvents.splice(itemIndex, 1); return true; } else { @@ -1087,15 +1089,13 @@ - dump ("event select\n"); this.calendarView.selectedOccurrence = this.mOccurrence; event.preventBubble(); @@ -1192,22 +1192,23 @@ if (!(aNewItem instanceof Components.interfaces.calIEvent)) return; - var occs = aOldItem.getOccurrencesBetween(this.calView.startDate, - this.calView.endDate, - {}); + var occs; + occs = aOldItem.getOccurrencesBetween(this.calView.startDate, + this.calView.endDate, + {}); for each (occ in occs) { this.calView.doDeleteEvent(occ); } - var occs = aNewItem.getOccurrencesBetween(this.calView.startDate, - this.calView.endDate, - {}); + occs = aNewItem.getOccurrencesBetween(this.calView.startDate, + this.calView.endDate, + {}); for each (occ in occs) { this.calView.doAddEvent(occ); } }, onDeleteItem: function (aItem) { - dump ("++ DeleteItem\n"); + //dump ("++ DeleteItem\n"); if (!(aItem instanceof Components.interfaces.calIEvent)) return; @@ -1227,12 +1228,12 @@ // XXXvv we can be smarter about how we handle this stuff // onCalendarAdded: function (aCalendar) { - dump ("view onCalendarAdded\n"); + //dump ("view onCalendarAdded\n"); this.calView.refresh(); }, onCalendarRemoved: function (aCalendar) { - dump ("view onCalendarRemoved\n"); + //dump ("view onCalendarRemoved\n"); this.calView.refresh(); }, @@ -1248,7 +1249,7 @@ onOperationComplete: function(aCalendar, aStatus, aOperationType, aId, aDetail) { // nothing to do - dump ("+++ OnOperationComplete (detail: " + aDetail + ")"); + //dump ("+++ OnOperationComplete (detail: " + aDetail + ")\n"); }, onGetResult: function(aCalendar, aStatus, aItemType, aDetail, aCount, aItems) { if (!Components.isSuccessCode(aStatus)) @@ -1306,7 +1307,7 @@ + diff --git a/calendar/base/public/calICalendar.idl b/calendar/base/public/calICalendar.idl index 50e2185d5ae..0f93e39c683 100644 --- a/calendar/base/public/calICalendar.idl +++ b/calendar/base/public/calICalendar.idl @@ -98,7 +98,7 @@ interface calICalendar : nsISupports ITEM_FILTER_TYPE_JOURNAL); /** - * If set, return calIOccurence items, otherwise return subclasses of + * If set, return calIItemOccurence items, otherwise return subclasses of * calIItemBase. */ const unsigned long ITEM_FILTER_CLASS_OCCURRENCES = 1 << 5; diff --git a/calendar/base/public/calICalendarViewController.idl b/calendar/base/public/calICalendarViewController.idl index 1b350466125..63f295579dc 100644 --- a/calendar/base/public/calICalendarViewController.idl +++ b/calendar/base/public/calICalendarViewController.idl @@ -42,6 +42,7 @@ interface calICalendar; interface calIDateTime; interface calIEvent; +interface calIItemOccurrence; [scriptable, uuid(1f783898-f4c2-4b2d-972e-360e0de38237)] interface calICalendarViewController : nsISupports @@ -72,12 +73,18 @@ interface calICalendarViewController : nsISupports in calIDateTime aEndTime); /** - * Modify aEvent. If aNewStartTime and aNewEndTime are given, + * Modify aOccurrence. If aNewStartTime and aNewEndTime are given, * update the event to those times. Otherwise ask the user to modify. */ - void modifyEvent (in calICalendar aCalendar, - in calIEvent aEvent, - in calIDateTime aNewStartTime, - in calIDateTime aNewEndTime); + void modifyOccurrence (in calIItemOccurrence aOccurrence, + in calIDateTime aNewStartTime, + in calIDateTime aNewEndTime); + + /** + * Delete the given event. This should prompt whether to delete + * just this occurrence or all occurrences, and do whatever else + * is appropriate. + */ + void deleteOccurrence (in calIItemOccurrence aOccurrence); }; diff --git a/calendar/lightning/content/calendar-management.js b/calendar/lightning/content/calendar-management.js index 9f91d6ebfae..911704f4b3c 100644 --- a/calendar/lightning/content/calendar-management.js +++ b/calendar/lightning/content/calendar-management.js @@ -98,15 +98,30 @@ var ltnCalendarViewController = { } }, - modifyEvent: function (aCalendar, aEvent, aNewStartTime, aNewEndTime) { + modifyOccurrence: function (aOccurrence, aNewStartTime, aNewEndTime) { + if (aOccurrence.recurrenceInfo) { + dump ("*** Don't know what to do in modifyOccurrence for a recurring event!\n"); + return; + } + if (aNewStartTime && aNewEndTime && !aNewStartTime.isDate && !aNewEndTime.isDate) { - var event = aEvent.clone(); + var event = aOccurrence.item.clone(); event.startDate = aNewStartTime; event.endDate = aNewEndTime; - aEvent.parent.modifyItem(event, null); + event.parent.modifyItem(event, null); } else { - modifyEventWithDialog(aEvent); + modifyEventWithDialog(aOccurrence.item); } + }, + + deleteOccurrence: function (aOccurrence) { + dump ("+++ deleteOccurrence\n"); + if (aOccurrence.recurrenceInfo) { + dump ("*** Don't know what do in deleteOccurrence for a recurring event!\n"); + return; + } + + aOccurrence.item.parent.deleteItem(aOccurrence.item, null); } };