/////js调用导入csv格式导入通讯录//////// var importService = 0; importService = Components.classes["@mozilla.org/import/import-service;1"] .getService(Components.interfaces.nsIImportService); var module = 0; if (exprotType == 'vcard') { module = importService.GetModule("addressbook", 0); } else//csv { module = importService.GetModule("addressbook", 2); } addInterface = module.GetImportInterface( "addressbook"); if (addInterface != null) addInterface = addInterface.QueryInterface( Components.interfaces.nsIImportGeneric); if (addInterface == null) { var errorText = bundle_import.GetStringFromName('ImportAddressBadModule'); var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService); promptService.alert(window, document.title, errorText); return( false); } addInterface.SetData("addressLocation", file); var map = addInterface.GetData( "fieldMap"); if (map != null) { map = map.QueryInterface( Components.interfaces.nsIImportFieldMap); if (map != null) { var result = new Object(); result.ok = false; top.window.openDialog( "chrome://messenger/content/fieldMapImport.xul", "", "chrome,modal,titlebar", {fieldMap: map, addInterface: addInterface, result: result}); } if (result.ok == false) return( false); } //fieldMapImport.xul确定按钮影响 function FieldImportOKButton() { var max = gListbox.getRowCount(); var fIndex; var on; // Ensure field map is the right size top.fieldMap.SetFieldMapSize(max); for (var i = 0; i < max; i++) { fIndex = gListbox.getItemAtIndex(i).getAttribute( 'field-index'); on = gListbox.getItemAtIndex(i).firstChild.getAttribute('checked'); top.fieldMap.SetFieldMap( i, fIndex); top.fieldMap.SetFieldActive( i, (on == "true")); } top.fieldMap.skipFirstRecord = gSkipFirstRecordButton.checked; top.dialogResult.ok = true; return true; } |
欢迎光临 firemail (http://firemail.wang:8088/) | Powered by Discuz! X3 |