args.onOk = function putItems(aCal) { putItemsIntoCal(aCal, items); }; 
args.onOk = function putItems(aCal) { putItemsIntoCal(aCal, items, filePath); }; 
function loadEventsFromFile(aCalendar){    const nsIFilePicker = Components.interfaces.nsIFilePicker;      var fp = Components.classes["@mozilla.org/filepicker;1"]                       .createInstance(nsIFilePicker);    fp.init(window, calGetString("calendar", "Open"), nsIFilePicker.modeOpen);    fp.defaultExtension = "ics";    // Get a list of exporters    var contractids = new Array();    var catman = Components.classes["@mozilla.org/categorymanager;1"]                           .getService(Components.interfaces.nsICategoryManager);    var catenum = catman.enumerateCategory('cal-importers');    while (catenum.hasMoreElements()) {        var entry = catenum.getNext();        entry = entry.QueryInterface(Components.interfaces.nsISupportsCString);        var contractid = catman.getCategoryEntry('cal-importers', entry);        var exporter = Components.classes[contractid]                                 .getService(Components.interfaces.calIImporter);        var types = exporter.getFileTypes({});        var type;        for each (type in types) {            fp.appendFilter(type.description, type.extensionFilter);            contractids.push(contractid);        }    }    fp.show();    if (fp.file && fp.file.path && fp.file.path.length > 0) {        var filePath = fp.file.path;        var importer = Components.classes[contractids[fp.filterIndex]]                                 .getService(Components.interfaces.calIImporter);        const nsIFileInputStream = Components.interfaces.nsIFileInputStream;        const nsIScriptableInputStream = Components.interfaces.nsIScriptableInputStream;        var inputStream = Components.classes["@mozilla.org/network/file-input-stream;1"]                                    .createInstance(nsIFileInputStream);        try        {           inputStream.init( fp.file, MODE_RDONLY, 0444, {} );           var items = importer.importFromStream(inputStream, {});           inputStream.close();        }        catch(ex)        {           showError(calGetString("calendar", "unableToRead") + filePath + "\n" + ex);        }        if (aCalendar) {            putItemsIntoCal(aCalendar, items);            return;        }        var count = new Object();        var calendars = getCalendarManager().getCalendars(count);        if (count.value == 1) {            // There's only one calendar, so it's silly to ask what calendar            // the user wants to import into.            putItemsIntoCal(calendars[0], items);        } else {            // Ask what calendar to import into            var args = new Object();            args.onOk = function putItems(aCal) { putItemsIntoCal(aCal, items); };            args.promptText = calGetString("calendar", "importPrompt");            openDialog("chrome://calendar/content/chooseCalendarDialog.xul",                        "_blank", "chrome,titlebar,modal,resizable", args);        }    }}
5459	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/5459/9a4a610f46e352dc9f61d73f19ec14fa438d1452/import-export.js/clean/calendar/base/content/import-export.js