add: if (!aNewItem.recurrenceId) {  aOldItem = aOldItem.parentItem; } 
context: function calAlarmService() {    this.wrappedJSObject = this;    this.mLoadedCalendars = {};    this.calendarObserver = {        alarmService: this,        // calIObserver:        onStartBatch: function() { },        onEndBatch: function() { },        onLoad: function co_onLoad(calendar) {            // ignore any onLoad events until initial getItems() call of startup has finished:            if (calendar && this.alarmService.mLoadedCalendars[calendar.id]) {                // a refreshed calendar signals that it has been reloaded                // (and cannot notify detailed changes), thus reget all alarms of it:                this.alarmService.initAlarms([calendar]);            }        },        onAddItem: function(aItem) {            var occs = [];            if (aItem.recurrenceInfo) {                var start = this.alarmService.mRangeEnd.clone();                // We search 1 month in each direction for alarms.  Therefore,                // we need to go back 2 months from the end to get this right.                start.month -= 2;                start.normalize();                occs = aItem.recurrenceInfo.getOccurrences(start, this.alarmService.mRangeEnd, 0, {});            } else {                occs = [aItem];            }            function hasAlarm(a) {                return a.alarmOffset || a.parentItem.alarmOffset;            }            occs = occs.filter(hasAlarm);            for each (var occ in occs) {                this.alarmService.addAlarm(occ);            }        },        onModifyItem: function(aNewItem, aOldItem) {            this.alarmService.removeAlarm(aOldItem);            this.onAddItem(aNewItem);        },        onDeleteItem: function(aDeletedItem) {            this.alarmService.removeAlarm(aDeletedItem);        },        onError: function(aErrNo, aMessage) { }    };    this.calendarManagerObserver = {        alarmService: this,        onCalendarRegistered: function(aCalendar) {            this.alarmService.observeCalendar(aCalendar);            // initial refresh of alarms for new calendar:            this.alarmService.initAlarms([aCalendar]);        },        onCalendarUnregistering: function(aCalendar) {            // XXX todo: we need to think about calendar unregistration;            // there may still be dangling items (-> alarm dialog),            // dismissing those alarms may write data...            this.alarmService.unobserveCalendar(aCalendar);        },        onCalendarDeleting: function(aCalendar) {},        onCalendarPrefSet: function(aCalendar, aName, aValue) {},        onCalendarPrefDeleting: function(aCalendar, aName) {}    };}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/9421/1cd49074143f54263da74bb865cc138a08539b45/calAlarmService.js/clean/calendar/base/src/calAlarmService.js