rem: var MinutesToAddOn = getIntPref(gCalendarWindow.calendarPreferences.calendarPref, "event.defaultlength", 60 ); 
add: MinutesToAddOn = getIntPref(gCalendarWindow.calendarPreferences.calendarPref, "event.defaultlength", 60 ); 
context: function pasteFromClipboard(){   const kClipboardIID = Components.interfaces.nsIClipboard;   if( canPaste() ) {         // 1. get the clipboard service      var clipboard = getClipboard();      // 2. create the transferable      var trans = createTransferable();        if ( trans && clipboard) {                              // 3. register the data flavors you want, highest fidelity first!         trans.addDataFlavor("text/calendar");         trans.addDataFlavor("text/unicode");         // 4. get transferable from clipboard	 clipboard.getData ( trans, kClipboardIID.kGlobalClipboard);	 // 5. ask transferable for the best flavor. Need to create new JS         //    objects for the out params.	 var flavour = { };	 var data = { };	 var length = { };	 trans.getAnyTransferData(flavour, data, length);	 data = data.value.QueryInterface(Components.interfaces.nsISupportsString).data;	 //DEBUG alert("clipboard type: " + flavour.value);    var calendarEventArray;    var startDate;	 switch (flavour.value) {	 case "text/calendar":                        calendarEventArray = parseIcalData( data );                        //change the date of all the events to now            startDate = gCalendarWindow.currentView.getNewEventDate();            var MinutesToAddOn = getIntPref(gCalendarWindow.calendarPreferences.calendarPref, "event.defaultlength", 60 );               var endDateTime = startDate.getTime() + ( 1000 * 60 * MinutesToAddOn );               for( var i = 0; i < calendarEventArray.length; i++ )            {               calendarEventArray[i].start.setTime( startDate );               calendarEventArray[i].end.setTime( endDateTime );            }            addEventsToCalendar( calendarEventArray );            break;	 case "text/unicode":            if ( data.indexOf("BEGIN:VEVENT") == -1 )            {               // no iCalendar data, paste clipboard text into description of new event                calendarEvent = createEvent();               initCalendarEvent( calendarEvent );               calendarEvent.description = data;               editNewEvent( calendarEvent );            }            else            {               calendarEventArray = parseIcalData( data );               //change the date of all the events to now               startDate = gCalendarWindow.currentView.getNewEventDate();               var MinutesToAddOn = getIntPref(gCalendarWindow.calendarPreferences.calendarPref, "event.defaultlength", 60 );                     var endDateTime = startDate.getTime() + ( 1000 * 60 * MinutesToAddOn );                     for( var i = 0; i < calendarEventArray.length; i++ )               {                  calendarEventArray[i].start.setTime( startDate );                  calendarEventArray[i].end.setTime( endDateTime );               }                              addEventsToCalendar( calendarEventArray );            }            break;            	 default:             alert("Unknown clipboard type: " + flavour.value);	 }      }   }   else     alert( "No iCalendar or text on the clipboard." );}
meta: 8395	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/8395/76b784fca4394a565ab5193c3d63c72fbff3d57a/clipboard.js/buggy/calendar/resources/content/clipboard.js