rem: editNewEvent( calendarEvent ); 
context: function pasteFromClipboard(){   const kClipboardIID = Components.interfaces.nsIClipboard;   if( canPaste() ) {         calendarEvent = createEvent();       // 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.nsISupportsWString).data;	 //DEBUG alert("clipboard type: " + flavour.value);	 switch (flavour.value) {	 case "text/calendar": // at the moment "text/calendar" only contains standard iCalendar text 	 case "text/unicode":         // strip VCALENDAR part. Workaround for parseIcalString         // TODO: Clean this up if parseIcalString is fixed         var i = data.indexOf("BEGIN:VEVENT");         calendarEvent.parseIcalString(data.substring(i, data.length));         if(calendarEvent.start.year == 0) // Is there a beter way to detect failed parsing?         {            // initialize start and end dates.            initCalendarEvent( calendarEvent )            // parsing import iCalendar failed. Save clipboard text into description.            calendarEvent.description = data;               }         break;	 default:             alert("Unknown clipboard type: " + flavour.value);	 }      }      editNewEvent( calendarEvent );   }   else     alert( "No iCalendar or text on the clipboard." );}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/23b9b03e6c9ba6463a474b7b7b108540202a9b40/clipboard.js/buggy/calendar/resources/content/clipboard.js