rem: var prefService = Components.classes["@mozilla.org/preferences-service;1"] .getService(Components.interfaces.nsIPrefService); var alarmsBranch = prefService.getBranch("calendar.alarms.");  if (alarmsBranch.getIntPref("onforevents") == 1) { var alarmOffset = Components.classes["@mozilla.org/calendar/duration;1"] .createInstance(Components.interfaces.calIDuration); try { var units = alarmsBranch.getCharPref("eventalarmunit"); alarmOffset[units] = alarmsBranch.getIntPref("eventalarmlen"); } catch(ex) { alarmOffset.minutes = 15; } calendarEvent.alarmOffset = alarmOffset; calendarEvent.alarmRelated = calendarEvent.ALARM_RELATED_START; } 
add: setDefaultAlarmValues(calendarEvent); 
context: function newEvent(startDate, endDate, allDay){   // create a new event to be edited and added   var calendarEvent = createEvent();   if (!startDate) {       startDate = gCalendarWindow.currentView.getNewEventDate();   }   calendarEvent.startDate.jsDate = startDate;   if (!endDate) {       var MinutesToAddOn = getIntPref(gCalendarWindow.calendarPreferences.calendarPref, "event.defaultlength", gCalendarBundle.getString("defaultEventLength" ) );              endDate = new Date(startDate);       endDate.setMinutes(endDate.getMinutes() + MinutesToAddOn);   }   calendarEvent.endDate.jsDate = endDate   var prefService = Components.classes["@mozilla.org/preferences-service;1"]                               .getService(Components.interfaces.nsIPrefService);   var alarmsBranch = prefService.getBranch("calendar.alarms.");   if (alarmsBranch.getIntPref("onforevents") == 1) {       var alarmOffset = Components.classes["@mozilla.org/calendar/duration;1"]                                   .createInstance(Components.interfaces.calIDuration);       try {           var units = alarmsBranch.getCharPref("eventalarmunit");           alarmOffset[units] = alarmsBranch.getIntPref("eventalarmlen");       } catch(ex) {           alarmOffset.minutes = 15;       }       calendarEvent.alarmOffset = alarmOffset;       calendarEvent.alarmRelated = calendarEvent.ALARM_RELATED_START;   }   if (allDay)       calendarEvent.startDate.isDate = true;   var calendar = getSelectedCalendarOrNull();   createEventWithDialog(calendar, null, null, null, calendarEvent);}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/0d9e4537e032a7216ce8181cb1586e5601128b42/calendar.js/clean/calendar/resources/content/calendar.js