rem: if (failedCount) showError(failedCount+" items failed to import. The last error was: "+lastError.toString()); 
add: if (failedCount) { var msg = calGetString("calendar", "importItemsFailed", [failedCount, lastError.toString()]); showError(msg); } 
context: function putItemsIntoCal(destCal, aItems) {    // Set batch for the undo/redo transaction manager    startBatchTransaction();    // And set batch mode on the calendar, to tell the views to not    // redraw until all items are imported    destCal.startBatch();    // This listener is needed to find out when the last addItem really    // finished. Using a counter to find the last item (which might not    // be the last item added)    var count = 0;    var failedCount = 0;    // Used to store the last error. Only the last error, because we don't    // wan't to bomb the user with thousands of error messages in case    // something went really wrong.    // (example of something very wrong: importing the same file twice.    //  quite easy to trigger, so we really should do this)    var lastError;    var listener = {        onOperationComplete: function(aCalendar, aStatus, aOperationType, aId, aDetail) {            count++;            if (!Components.isSuccessCode(aStatus)) {                failedCount++;                lastError = aStatus;            }            // See if it is time to end the calendar's batch.            if (count == aItems.length) {                destCal.endBatch();                if (failedCount)                    showError(failedCount+" items failed to import. The last error was: "+lastError.toString());            }        }    }    for each (item in aItems) {        // XXX prompt when finding a duplicate.        try {            destCal.addItem(item, listener);        } catch(e) {            failedCount++;            lastError = e;            // Call the listener's operationComplete, to increase the            // counter and not miss failed items. Otherwise, endBatch might            // never be called.            listener.onOperationComplete(null, null, null, null, null);            Components.utils.reportError("Import error: "+e);        }    }    // End transmgr batch    endBatchTransaction();}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/9421/7c18281ebcd198b15e50ff3bc6f85283db953fb8/import-export.js/clean/calendar/base/content/import-export.js