зеркало из https://github.com/mozilla/pjs.git
Bug 83585 - Changes for new feature to import comm 4.x ab
r=chuang and sr=sspitzer checking in for rdayal@netscape.com
This commit is contained in:
Родитель
adddb15311
Коммит
a13c578c74
|
@ -1940,7 +1940,7 @@ nsMessengerMigrator::migrateAddressBookPrefEnum(const char *aPref, void *aClosur
|
|||
NS_ASSERTION(NS_SUCCEEDED(rv),"ab migration failed: failed to convert na2 to ldif");
|
||||
if (NS_FAILED(rv)) return;
|
||||
|
||||
rv = ab->ConvertLDIFtoMAB(tmpLDIFFileSpec, PR_TRUE /* migrating */);
|
||||
rv = ab->ConvertLDIFtoMAB(tmpLDIFFileSpec, PR_TRUE /* migrating */, nsnull, PR_FALSE, PR_FALSE /* Importing Comm4x */);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv),"ab migration filed: failed to convert ldif to mab\n");
|
||||
if (NS_FAILED(rv)) return;
|
||||
|
||||
|
|
|
@ -142,10 +142,11 @@ public:
|
|||
NS_IMETHOD InitFieldMap(nsIFileSpec *location, nsIImportFieldMap *fieldMap)
|
||||
{ return( NS_ERROR_FAILURE); }
|
||||
|
||||
/* void ImportAddressBook (in nsIImportABDescriptor source, in nsISupports destination, in nsISupports fieldMap, out boolean fatalError); */
|
||||
/* void ImportAddressBook (in nsIImportABDescriptor source, in nsIAddrDatabase destination, in nsIImportFieldMap fieldMap, in boolean isAddrLocHome, out wstring errorLog, out wstring successLog, out boolean fatalError); */
|
||||
NS_IMETHOD ImportAddressBook( nsIImportABDescriptor *source,
|
||||
nsIAddrDatabase * destination,
|
||||
nsIImportFieldMap * fieldMap,
|
||||
PRBool isAddrLocHome,
|
||||
PRUnichar ** errorLog,
|
||||
PRUnichar ** successLog,
|
||||
PRBool * fatalError);
|
||||
|
@ -665,6 +666,7 @@ void ImportEudoraAddressImpl::ReportSuccess( nsString& name, nsString *pStream)
|
|||
NS_IMETHODIMP ImportEudoraAddressImpl::ImportAddressBook( nsIImportABDescriptor *pSource,
|
||||
nsIAddrDatabase * pDestination,
|
||||
nsIImportFieldMap * fieldMap,
|
||||
PRBool isAddrLocHome,
|
||||
PRUnichar ** pErrorLog,
|
||||
PRUnichar ** pSuccessLog,
|
||||
PRBool * fatalError)
|
||||
|
|
|
@ -131,10 +131,11 @@ public:
|
|||
NS_IMETHOD InitFieldMap(nsIFileSpec *location, nsIImportFieldMap *fieldMap)
|
||||
{ return( NS_ERROR_FAILURE); }
|
||||
|
||||
/* void ImportAddressBook (in nsIImportABDescriptor source, in nsISupports destination, in nsISupports fieldMap, out boolean fatalError); */
|
||||
/* void ImportAddressBook (in nsIImportABDescriptor source, in nsIAddrDatabase destination, in nsIImportFieldMap fieldMap, in boolean isAddrLocHome, out wstring errorLog, out wstring successLog, out boolean fatalError); */
|
||||
NS_IMETHOD ImportAddressBook( nsIImportABDescriptor *source,
|
||||
nsIAddrDatabase * destination,
|
||||
nsIImportFieldMap * fieldMap,
|
||||
PRBool isAddrLocHome,
|
||||
PRUnichar ** errorLog,
|
||||
PRUnichar ** successLog,
|
||||
PRBool * fatalError);
|
||||
|
@ -612,6 +613,7 @@ NS_IMETHODIMP ImportOEAddressImpl::FindAddressBooks(nsIFileSpec *location, nsISu
|
|||
NS_IMETHODIMP ImportOEAddressImpl::ImportAddressBook( nsIImportABDescriptor *source,
|
||||
nsIAddrDatabase * destination,
|
||||
nsIImportFieldMap * fieldMap,
|
||||
PRBool isAddrLocHome,
|
||||
PRUnichar ** errorLog,
|
||||
PRUnichar ** successLog,
|
||||
PRBool * fatalError)
|
||||
|
|
|
@ -130,10 +130,11 @@ public:
|
|||
NS_IMETHOD InitFieldMap(nsIFileSpec *location, nsIImportFieldMap *fieldMap)
|
||||
{ return( NS_ERROR_FAILURE); }
|
||||
|
||||
/* void ImportAddressBook (in nsIImportABDescriptor source, in nsISupports destination, in nsISupports fieldMap, out boolean fatalError); */
|
||||
/* void ImportAddressBook (in nsIImportABDescriptor source, in nsIAddrDatabase destination, in nsIImportFieldMap fieldMap, in boolean isAddrLocHome, out wstring errorLog, out wstring successLog, out boolean fatalError); */
|
||||
NS_IMETHOD ImportAddressBook( nsIImportABDescriptor *source,
|
||||
nsIAddrDatabase * destination,
|
||||
nsIImportFieldMap * fieldMap,
|
||||
PRBool isAddrLocHome,
|
||||
PRUnichar ** errorLog,
|
||||
PRUnichar ** successLog,
|
||||
PRBool * fatalError);
|
||||
|
@ -554,6 +555,7 @@ NS_IMETHODIMP ImportOutlookAddressImpl::FindAddressBooks(nsIFileSpec *location,
|
|||
NS_IMETHODIMP ImportOutlookAddressImpl::ImportAddressBook( nsIImportABDescriptor *source,
|
||||
nsIAddrDatabase * destination,
|
||||
nsIImportFieldMap * fieldMap,
|
||||
PRBool isAddrLocHome,
|
||||
PRUnichar ** pErrorLog,
|
||||
PRUnichar ** pSuccessLog,
|
||||
PRBool * fatalError)
|
||||
|
|
|
@ -127,6 +127,7 @@ interface nsIImportAddressBooks : nsISupports
|
|||
void ImportAddressBook( in nsIImportABDescriptor source,
|
||||
in nsIAddrDatabase destination,
|
||||
in nsIImportFieldMap fieldMap,
|
||||
in boolean isAddrLocHome,
|
||||
out wstring errorLog,
|
||||
out wstring successLog,
|
||||
out boolean fatalError);
|
||||
|
|
|
@ -80,7 +80,7 @@ interface nsIImportGeneric : nsISupports
|
|||
failure of the import. Failure can be reported even if WantsProgress
|
||||
returned TRUE.
|
||||
*/
|
||||
boolean BeginImport( in nsISupportsWString successLog, in nsISupportsWString errorLog);
|
||||
boolean BeginImport( in nsISupportsWString successLog, in nsISupportsWString errorLog, in boolean isAddrLocHome);
|
||||
/*
|
||||
If WantsProgress returned TRUE then this will indicate if the import should
|
||||
continue. If this returns FALSE then no other methods should be called
|
||||
|
|
|
@ -65,10 +65,11 @@ interface nsIImportService : nsISupports
|
|||
|
||||
};
|
||||
|
||||
|
||||
%{ C++
|
||||
#define NS_IMPORTSERVICE_CID \
|
||||
{ /* 5df96d60-1726-11d3-a206-00a0cc26da63 */ \
|
||||
0x5df96d60, 0x1726, 0x11d3, \
|
||||
{0xa2, 0x06, 0x0, 0xa0, 0xcc, 0x26, 0xda, 0x63}}
|
||||
|
||||
#define NS_IMPORTSERVICE_CONTRACTID "@mozilla.org/import/import-service;1"
|
||||
%}
|
||||
|
|
|
@ -25,9 +25,12 @@ var gImportMsgsBundle;
|
|||
var importService = 0;
|
||||
var successStr = null;
|
||||
var errorStr = null;
|
||||
var inputStr = null ;
|
||||
var progressInfo = null;
|
||||
var selectedModuleName = null;
|
||||
|
||||
var selLocIsHome = false ;
|
||||
var addInterface = null ;
|
||||
|
||||
function OnLoadImportDialog()
|
||||
{
|
||||
|
@ -197,6 +200,9 @@ function ImportDialogOKButton()
|
|||
top.errorStr = Components.classes["@mozilla.org/supports-wstring;1"].createInstance();
|
||||
if (top.errorStr)
|
||||
top.errorStr = top.errorStr.QueryInterface( Components.interfaces.nsISupportsWString);
|
||||
top.inputStr = Components.classes["@mozilla.org/supports-wstring;1"].createInstance();
|
||||
if (top.inputStr)
|
||||
top.inputStr = top.inputStr.QueryInterface( Components.interfaces.nsISupportsWString);
|
||||
|
||||
if (ImportAddress( module, top.successStr, top.errorStr) == true) {
|
||||
// We think it was a success, either, we need to
|
||||
|
@ -364,6 +370,43 @@ function ContinueImport( info) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
function ShowResults(doesWantProgress, result)
|
||||
{
|
||||
if (result)
|
||||
{
|
||||
if (doesWantProgress)
|
||||
{
|
||||
var deck = document.getElementById("stateDeck");
|
||||
var header = document.getElementById("header");
|
||||
var progressStatusEl = document.getElementById("progressStatus");
|
||||
var progressTitleEl = document.getElementById("progressTitle");
|
||||
|
||||
var meterText = gImportMsgsBundle.getFormattedString('MailProgressMeterText',
|
||||
[ name ]);
|
||||
header.setAttribute("description", meterText);
|
||||
|
||||
progressStatusEl.setAttribute("label", "");
|
||||
progressTitleEl.setAttribute("label", meterText);
|
||||
|
||||
deck.setAttribute("index", "2");
|
||||
progressInfo.progressWindow = top.window;
|
||||
progressInfo.intervalState = setInterval("ContinueImportCallback()", 100);
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowImportResults(true, 'Address');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowImportResults(false, 'Address');
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
|
||||
function ShowImportResults(good, module)
|
||||
{
|
||||
var modSuccess = 'Import' + module + 'Success';
|
||||
|
@ -610,7 +653,7 @@ function ImportMail( module, success, error) {
|
|||
}
|
||||
|
||||
if (mailInterface.WantsProgress()) {
|
||||
if (mailInterface.BeginImport( success, error)) {
|
||||
if (mailInterface.BeginImport( success, error, false)) {
|
||||
top.progressInfo.importInterface = mailInterface;
|
||||
// top.intervalState = setInterval( "ContinueImport()", 100);
|
||||
return true;
|
||||
|
@ -619,7 +662,7 @@ function ImportMail( module, success, error) {
|
|||
return false;
|
||||
}
|
||||
else
|
||||
return mailInterface.BeginImport( success, error) ? true : false;
|
||||
return mailInterface.BeginImport( success, error, false) ? true : false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -633,7 +676,7 @@ function ImportAddress( module, success, error) {
|
|||
|
||||
top.progressInfo.importSuccess = false;
|
||||
|
||||
var addInterface = module.GetImportInterface( "addressbook");
|
||||
addInterface = module.GetImportInterface( "addressbook");
|
||||
if (addInterface != null)
|
||||
addInterface = addInterface.QueryInterface( Components.interfaces.nsIImportGeneric);
|
||||
if (addInterface == null) {
|
||||
|
@ -641,7 +684,7 @@ function ImportAddress( module, success, error) {
|
|||
return( false);
|
||||
}
|
||||
|
||||
|
||||
var path ;
|
||||
var loc = addInterface.GetStatus( "autoFind");
|
||||
if (loc == false) {
|
||||
loc = addInterface.GetData( "addressLocation");
|
||||
|
@ -698,6 +741,8 @@ function ImportAddress( module, success, error) {
|
|||
// ask for file
|
||||
try {
|
||||
filePicker.init( top.window, gImportMsgsBundle.getString('ImportSelectAddrFile'), Components.interfaces.nsIFilePicker.modeOpen);
|
||||
if (selectedModuleName == gImportMsgsBundle.getString('Comm4xImportName'))
|
||||
filePicker.appendFilter(gImportMsgsBundle.getString('Comm4xFiles'),"*.na2");
|
||||
filePicker.appendFilters( Components.interfaces.nsIFilePicker.filterAll);
|
||||
filePicker.show();
|
||||
if (filePicker.file && (filePicker.file.path.length > 0))
|
||||
|
@ -709,6 +754,8 @@ function ImportAddress( module, success, error) {
|
|||
}
|
||||
}
|
||||
|
||||
path = filePicker.file.leafName;
|
||||
|
||||
if (file == null) {
|
||||
return( false);
|
||||
}
|
||||
|
@ -718,6 +765,21 @@ function ImportAddress( module, success, error) {
|
|||
addInterface.SetData( "addressLocation", file);
|
||||
}
|
||||
|
||||
// no need to use the fieldmap for 4.x import since we are using separate dialog
|
||||
if (selectedModuleName == gImportMsgsBundle.getString('Comm4xImportName'))
|
||||
{
|
||||
var deck = document.getElementById("stateDeck");
|
||||
deck.setAttribute("index", "4");
|
||||
var isHomeRadioGroup = document.getElementById("homeorwork");
|
||||
isHomeRadioGroup.selectedItem = document.getElementById("workRadio");
|
||||
var forwardButton = document.getElementById("forward");
|
||||
forwardButton.removeAttribute("disabled");
|
||||
var warning = document.getElementById("warning");
|
||||
var textStr = " " + path ;
|
||||
warning.setAttribute ('value', textStr) ;
|
||||
return false;
|
||||
}
|
||||
|
||||
var map = addInterface.GetData( "fieldMap");
|
||||
if (map != null) {
|
||||
map = map.QueryInterface( Components.interfaces.nsIImportFieldMap);
|
||||
|
@ -737,7 +799,7 @@ function ImportAddress( module, success, error) {
|
|||
}
|
||||
|
||||
if (addInterface.WantsProgress()) {
|
||||
if (addInterface.BeginImport( success, error)) {
|
||||
if (addInterface.BeginImport( success, error, selLocIsHome)) {
|
||||
top.progressInfo.importInterface = addInterface;
|
||||
// top.intervalState = setInterval( "ContinueImport()", 100);
|
||||
return( true);
|
||||
|
@ -747,7 +809,7 @@ function ImportAddress( module, success, error) {
|
|||
}
|
||||
}
|
||||
else {
|
||||
if (addInterface.BeginImport( success, error)) {
|
||||
if (addInterface.BeginImport( success, error, selLocIsHome)) {
|
||||
return( true);
|
||||
}
|
||||
else {
|
||||
|
@ -786,9 +848,33 @@ function next()
|
|||
case "3":
|
||||
close();
|
||||
break;
|
||||
case "4" :
|
||||
var isHomeRadioGroup = document.getElementById("homeorwork");
|
||||
if (isHomeRadioGroup.selectedItem.getAttribute("value") == "Home")
|
||||
selLocIsHome = true ;
|
||||
ExportComm4x() ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
||||
function ExportComm4x()
|
||||
{
|
||||
var result ;
|
||||
if (addInterface.WantsProgress())
|
||||
{
|
||||
result = addInterface.BeginImport( successStr, errorStr, selLocIsHome) ;
|
||||
top.progressInfo.importInterface = addInterface;
|
||||
ShowResults(true, result) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = addInterface.BeginImport( successStr, errorStr, selLocIsHome) ;
|
||||
ShowResults(false, result) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
function enableAdvance()
|
||||
{
|
||||
var tree = document.getElementById("moduleList");
|
||||
|
|
|
@ -85,6 +85,20 @@ Rights Reserved.
|
|||
<html id="results" flex="1"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
<vbox class="wizard-box">
|
||||
<html>&FieldDiscInputText1.label;</html>
|
||||
<html>&FieldDiscInputText2.label;</html>
|
||||
<separator/>
|
||||
<separator class="thin"/>
|
||||
<radiogroup id="homeorwork" orient="vertical" class="indent" autostretch="never">
|
||||
<radio group="homeorwork" value="Home" id="homeRadio" label="&importDialog.homeTitle;"/>
|
||||
<radio group="homeorwork" value="Work" id="workRadio" label="&importDialog.workTitle;"/>
|
||||
</radiogroup>
|
||||
<separator/>
|
||||
<separator/>
|
||||
<html>&FieldDiscWarning.label;</html>
|
||||
<text id="warning" flex="1"/>
|
||||
</vbox>
|
||||
</deck>
|
||||
|
||||
<separator/>
|
||||
|
|
|
@ -88,8 +88,8 @@ public:
|
|||
/* boolean WantsProgress (); */
|
||||
NS_IMETHOD WantsProgress(PRBool *_retval);
|
||||
|
||||
/* boolean BeginImport (in nsIOutputStream successLog, in nsIOutputStream errorLog); */
|
||||
NS_IMETHOD BeginImport(nsISupportsWString *successLog, nsISupportsWString *errorLog, PRBool *_retval);
|
||||
/* boolean BeginImport (in nsISupportsWString successLog, in nsISupportsWString errorLog, in boolean isAddrLocHome); */
|
||||
NS_IMETHOD BeginImport(nsISupportsWString *successLog, nsISupportsWString *errorLog, PRBool isAddrLocHome, PRBool *_retval) ;
|
||||
|
||||
/* boolean ContinueImport (); */
|
||||
NS_IMETHOD ContinueImport(PRBool *_retval);
|
||||
|
@ -141,6 +141,7 @@ public:
|
|||
nsISupportsWString * successLog;
|
||||
nsISupportsWString * errorLog;
|
||||
char * pDestinationUri;
|
||||
PRBool bAddrLocInput ;
|
||||
|
||||
AddressThreadData();
|
||||
~AddressThreadData();
|
||||
|
@ -555,7 +556,7 @@ void nsImportGenericAddressBooks::SetLogs( nsString& success, nsString& error, n
|
|||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImportGenericAddressBooks::BeginImport(nsISupportsWString *successLog, nsISupportsWString *errorLog, PRBool *_retval)
|
||||
NS_IMETHODIMP nsImportGenericAddressBooks::BeginImport(nsISupportsWString *successLog, nsISupportsWString *errorLog, PRBool isAddrLocHome, PRBool *_retval)
|
||||
{
|
||||
NS_PRECONDITION(_retval != nsnull, "null ptr");
|
||||
if (!_retval)
|
||||
|
@ -605,6 +606,7 @@ NS_IMETHODIMP nsImportGenericAddressBooks::BeginImport(nsISupportsWString *succe
|
|||
NS_IF_ADDREF( m_pSuccessLog);
|
||||
if (m_pDestinationUri)
|
||||
m_pThreadData->pDestinationUri = nsCRT::strdup( m_pDestinationUri);
|
||||
m_pThreadData->bAddrLocInput = isAddrLocHome ;
|
||||
|
||||
PRThread *pThread = PR_CreateThread( PR_USER_THREAD, &ImportAddressThread, m_pThreadData,
|
||||
PR_PRIORITY_NORMAL,
|
||||
|
@ -918,24 +920,10 @@ PR_STATIC_CALLBACK( void) ImportAddressThread( void *stuff)
|
|||
PRUnichar *pSuccess = nsnull;
|
||||
PRUnichar *pError = nsnull;
|
||||
|
||||
/*
|
||||
if (pData->fieldMap) {
|
||||
PRInt32 sz = 0;
|
||||
PRInt32 mapIndex;
|
||||
PRBool active;
|
||||
pData->fieldMap->GetMapSize( &sz);
|
||||
IMPORT_LOG1( "**** Field Map Size: %d\n", (int) sz);
|
||||
for (PRInt32 i = 0; i < sz; i++) {
|
||||
pData->fieldMap->GetFieldMap( i, &mapIndex);
|
||||
pData->fieldMap->GetFieldActive( i, &active);
|
||||
IMPORT_LOG3( "Field map #%d: index=%d, active=%d\n", (int) i, (int) mapIndex, (int) active);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
rv = pData->addressImport->ImportAddressBook( book,
|
||||
pDestDB, // destination
|
||||
pData->fieldMap, // fieldmap
|
||||
pData->bAddrLocInput,
|
||||
&pError,
|
||||
&pSuccess,
|
||||
&fatalError);
|
||||
|
|
|
@ -124,8 +124,8 @@ public:
|
|||
/* boolean WantsProgress (); */
|
||||
NS_IMETHOD WantsProgress(PRBool *_retval);
|
||||
|
||||
/* boolean BeginImport (in nsIOutputStream successLog, in nsIOutputStream errorLog); */
|
||||
NS_IMETHOD BeginImport(nsISupportsWString *successLog, nsISupportsWString *errorLog, PRBool *_retval);
|
||||
/* boolean BeginImport (in nsISupportsWString successLog, in nsISupportsWString errorLog, in boolean isAddrLocHome); */
|
||||
NS_IMETHODIMP BeginImport(nsISupportsWString *successLog, nsISupportsWString *errorLog, PRBool isAddrLocHome, PRBool *_retval) ;
|
||||
|
||||
/* boolean ContinueImport (); */
|
||||
NS_IMETHOD ContinueImport(PRBool *_retval);
|
||||
|
@ -528,8 +528,7 @@ void nsImportGenericMail::GetMailboxName( PRUint32 index, nsISupportsWString *pS
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsImportGenericMail::BeginImport(nsISupportsWString *successLog, nsISupportsWString *errorLog, PRBool *_retval)
|
||||
NS_IMETHODIMP nsImportGenericMail::BeginImport(nsISupportsWString *successLog, nsISupportsWString *errorLog, PRBool isAddrLocHome, PRBool *_retval)
|
||||
{
|
||||
NS_PRECONDITION(_retval != nsnull, "null ptr");
|
||||
if (!_retval)
|
||||
|
|
|
@ -85,10 +85,11 @@ public:
|
|||
/* nsISupports InitFieldMap(nsIFileSpec location, nsIImportFieldMap fieldMap); */
|
||||
NS_IMETHOD InitFieldMap(nsIFileSpec *location, nsIImportFieldMap *fieldMap);
|
||||
|
||||
/* void ImportAddressBook (in nsIImportABDescriptor source, in nsISupports destination, in nsISupports fieldMap, out boolean fatalError); */
|
||||
/* void ImportAddressBook (in nsIImportABDescriptor source, in nsIAddrDatabase destination, in nsIImportFieldMap fieldMap, in boolean isAddrLocHome, out wstring errorLog, out wstring successLog, out boolean fatalError); */
|
||||
NS_IMETHOD ImportAddressBook( nsIImportABDescriptor *source,
|
||||
nsIAddrDatabase * destination,
|
||||
nsIImportFieldMap * fieldMap,
|
||||
PRBool isAddrLocHome,
|
||||
PRUnichar ** errorLog,
|
||||
PRUnichar ** successLog,
|
||||
PRBool * fatalError);
|
||||
|
@ -439,6 +440,7 @@ void ImportAddressImpl::SetLogs( nsString& success, nsString& error, PRUnichar *
|
|||
NS_IMETHODIMP ImportAddressImpl::ImportAddressBook( nsIImportABDescriptor *pSource,
|
||||
nsIAddrDatabase * pDestination,
|
||||
nsIImportFieldMap * fieldMap,
|
||||
PRBool isAddrLocHome,
|
||||
PRUnichar ** pErrorLog,
|
||||
PRUnichar ** pSuccessLog,
|
||||
PRBool * fatalError)
|
||||
|
|
Загрузка…
Ссылка в новой задаче