Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions | Static Private Member Functions | Private Attributes
ImportEudoraAddressImpl Class Reference
Inheritance diagram for ImportEudoraAddressImpl:
Inheritance graph
[legend]
Collaboration diagram for ImportEudoraAddressImpl:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ImportEudoraAddressImpl ()
virtual ~ImportEudoraAddressImpl ()
NS_DECL_ISUPPORTS NS_IMETHOD GetSupportsMultiple (PRBool *_retval)
NS_IMETHOD GetAutoFind (PRUnichar **description, PRBool *_retval)
NS_IMETHOD GetNeedsFieldMap (nsIFileSpec *location, PRBool *_retval)
NS_IMETHOD GetDefaultLocation (nsIFileSpec **location, PRBool *found, PRBool *userVerify)
NS_IMETHOD FindAddressBooks (nsIFileSpec *location, nsISupportsArray **_retval)
NS_IMETHOD InitFieldMap (nsIFileSpec *location, nsIImportFieldMap *fieldMap)
NS_IMETHOD ImportAddressBook (nsIImportABDescriptor *source, nsIAddrDatabase *destination, nsIImportFieldMap *fieldMap, PRBool isAddrLocHome, PRUnichar **errorLog, PRUnichar **successLog, PRBool *fatalError)
NS_IMETHOD GetImportProgress (PRUint32 *_retval)
NS_IMETHOD GetSampleData (PRInt32 index, PRBool *pFound, PRUnichar **pStr)
NS_IMETHOD SetSampleLocation (nsIFileSpec *)
PRBool GetSupportsMultiple ()
PRBool GetAutoFind (out wstring description)
PRBool GetNeedsFieldMap (in nsIFileSpec location)
void GetDefaultLocation (out nsIFileSpec location, out boolean found, out boolean userVerify)
nsISupportsArray FindAddressBooks (in nsIFileSpec location)
void InitFieldMap (in nsIFileSpec location, in nsIImportFieldMap fieldMap)
void ImportAddressBook (in nsIImportABDescriptor source, in nsIAddrDatabase destination, in nsIImportFieldMap fieldMap, in boolean isAddrLocHome, out wstring errorLog, out wstring successLog, out boolean fatalError)
unsigned long GetImportProgress ()
void SetSampleLocation (in nsIFileSpec location)
wstring GetSampleData (in long recordNumber, out boolean recordExists)

Static Public Member Functions

static nsresult Create (nsIImportAddressBooks **aImport)

Static Private Member Functions

static void ReportSuccess (nsString &name, nsString *pStream)

Private Attributes

PRUint32 m_bytes

Detailed Description

Definition at line 138 of file nsEudoraImport.cpp.


Constructor & Destructor Documentation

Definition at line 587 of file nsEudoraImport.cpp.

{
}

Here is the caller graph for this function:

Definition at line 592 of file nsEudoraImport.cpp.

{
}

Member Function Documentation

Definition at line 573 of file nsEudoraImport.cpp.

{
    NS_PRECONDITION(aImport != nsnull, "null ptr");
    if (! aImport)
        return NS_ERROR_NULL_POINTER;

    *aImport = new ImportEudoraAddressImpl();
    if (! *aImport)
        return NS_ERROR_OUT_OF_MEMORY;

    NS_ADDREF(*aImport);
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 645 of file nsEudoraImport.cpp.

{
    NS_PRECONDITION(pLoc != nsnull, "null ptr");
    NS_PRECONDITION(ppArray != nsnull, "null ptr");
    if (!pLoc || !ppArray)
        return NS_ERROR_NULL_POINTER;
       
       PRBool exists = PR_FALSE;
       nsresult rv = pLoc->Exists( &exists);
       if (NS_FAILED( rv) || !exists)
              return( NS_ERROR_FAILURE);

       rv = m_eudora.FindAddressBooks( pLoc, ppArray);
       if (NS_FAILED( rv) && *ppArray) {
              NS_RELEASE( *ppArray);
              *ppArray = nsnull;
       }
       
       return( rv);
}
PRBool nsIImportAddressBooks::GetAutoFind ( out wstring  description) [inherited]

Here is the caller graph for this function:

Definition at line 601 of file nsEudoraImport.cpp.

Here is the call graph for this function:

void nsIImportAddressBooks::GetDefaultLocation ( out nsIFileSpec  location,
out boolean  found,
out boolean  userVerify 
) [inherited]

Here is the caller graph for this function:

NS_IMETHODIMP ImportEudoraAddressImpl::GetDefaultLocation ( nsIFileSpec **  location,
PRBool found,
PRBool userVerify 
)

Definition at line 617 of file nsEudoraImport.cpp.

{
    NS_PRECONDITION(found != nsnull, "null ptr");
    NS_PRECONDITION(ppLoc != nsnull, "null ptr");
    NS_PRECONDITION(userVerify != nsnull, "null ptr");
    if (! found || !userVerify || !ppLoc)
        return NS_ERROR_NULL_POINTER;
    
       *ppLoc = nsnull;
       nsresult             rv;
       nsIFileSpec * spec;
       if (NS_FAILED( rv = NS_NewFileSpec( &spec)))
              return( rv);
       
       *found = m_eudora.FindAddressFolder( spec);
       if (!(*found)) {
              NS_IF_RELEASE( spec);
       }
       else {
              *ppLoc = spec;
       }
       *userVerify = PR_TRUE;
       
       return( NS_OK);    
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 766 of file nsEudoraImport.cpp.

{
    NS_PRECONDITION(_retval != nsnull, "null ptr");
       if (!_retval)
              return( NS_ERROR_NULL_POINTER);
       
       *_retval = m_bytes;

       return( NS_OK);
}

Here is the caller graph for this function:

NS_IMETHOD ImportEudoraAddressImpl::GetNeedsFieldMap ( nsIFileSpec location,
PRBool _retval 
) [inline]

Definition at line 158 of file nsEudoraImport.cpp.

{ *_retval = PR_FALSE; return( NS_OK);}
wstring nsIImportAddressBooks::GetSampleData ( in long  recordNumber,
out boolean  recordExists 
) [inherited]
NS_IMETHOD ImportEudoraAddressImpl::GetSampleData ( PRInt32  index,
PRBool pFound,
PRUnichar **  pStr 
) [inline]

Definition at line 182 of file nsEudoraImport.cpp.

              { return( NS_ERROR_FAILURE);}

Here is the caller graph for this function:

Definition at line 152 of file nsEudoraImport.cpp.

{ *_retval = PR_TRUE; return( NS_OK);}
void nsIImportAddressBooks::ImportAddressBook ( in nsIImportABDescriptor  source,
in nsIAddrDatabase  destination,
in nsIImportFieldMap  fieldMap,
in boolean  isAddrLocHome,
out wstring  errorLog,
out wstring  successLog,
out boolean  fatalError 
) [inherited]
NS_IMETHODIMP ImportEudoraAddressImpl::ImportAddressBook ( nsIImportABDescriptor source,
nsIAddrDatabase destination,
nsIImportFieldMap fieldMap,
PRBool  isAddrLocHome,
PRUnichar **  errorLog,
PRUnichar **  successLog,
PRBool fatalError 
)

Definition at line 684 of file nsEudoraImport.cpp.

{
    NS_PRECONDITION(pSource != nsnull, "null ptr");
    NS_PRECONDITION(pDestination != nsnull, "null ptr");
    NS_PRECONDITION(fatalError != nsnull, "null ptr");
       
       nsCOMPtr<nsIStringBundle> bundle( dont_AddRef( nsEudoraStringBundle::GetStringBundleProxy()));

       nsString      success;
       nsString      error;
    if (!pSource || !pDestination || !fatalError) {
              IMPORT_LOG0( "*** Bad param passed to eudora address import\n");
              nsEudoraStringBundle::GetStringByID( EUDORAIMPORT_ADDRESS_BADPARAM, error, bundle);
              if (fatalError)
                     *fatalError = PR_TRUE;
              ImportEudoraMailImpl::SetLogs( success, error, pErrorLog, pSuccessLog);
           return NS_ERROR_NULL_POINTER;
       }
      
    PRBool           abort = PR_FALSE;
    nsString  name;
    PRUnichar *      pName;
    if (NS_SUCCEEDED( pSource->GetPreferredName( &pName))) {
       name = pName;
       nsCRT::free( pName);
    }
    
       PRUint32 addressSize = 0;
       pSource->GetSize( &addressSize);
       if (addressSize == 0) {
              IMPORT_LOG0( "Address book size is 0, skipping mailbox.\n");
              ReportSuccess( name, &success);
              ImportEudoraMailImpl::SetLogs( success, error, pErrorLog, pSuccessLog);
              return( NS_OK);
       }

    
       nsIFileSpec   *      inFile;
    if (NS_FAILED( pSource->GetFileSpec( &inFile))) {
              ImportEudoraMailImpl::ReportError( EUDORAIMPORT_ADDRESS_BADSOURCEFILE, name, &error);
              ImportEudoraMailImpl::SetLogs( success, error, pErrorLog, pSuccessLog);             
       return( NS_ERROR_FAILURE);
    }

#ifdef IMPORT_DEBUG
       char *pPath;
       inFile->GetNativePath( &pPath);    
       IMPORT_LOG1( "Import address book: %s\n", pPath);
       nsCRT::free( pPath);
#endif
       
           
    nsresult rv = NS_OK;
       
       m_bytes = 0;
       rv = m_eudora.ImportAddresses( &m_bytes, &abort, name.get(), inFile, pDestination, error);

    inFile->Release();

           
    
       if (NS_SUCCEEDED( rv) && error.IsEmpty()) {
              ReportSuccess( name, &success);
       }
       else {
              ImportEudoraMailImpl::ReportError( EUDORAIMPORT_ADDRESS_CONVERTERROR, name, &error);
       }

       ImportEudoraMailImpl::SetLogs( success, error, pErrorLog, pSuccessLog);

       IMPORT_LOG0( "*** Returning from eudora address import\n");

    return( rv);
}

Here is the call graph for this function:

void nsIImportAddressBooks::InitFieldMap ( in nsIFileSpec  location,
in nsIImportFieldMap  fieldMap 
) [inherited]

Here is the caller graph for this function:

Definition at line 167 of file nsEudoraImport.cpp.

              { return( NS_ERROR_FAILURE); }
void ImportEudoraAddressImpl::ReportSuccess ( nsString name,
nsString pStream 
) [static, private]

Definition at line 668 of file nsEudoraImport.cpp.

{
       if (!pStream)
              return;
       // load the success string
       nsIStringBundle *pBundle = nsEudoraStringBundle::GetStringBundleProxy();
       PRUnichar *pFmt = nsEudoraStringBundle::GetStringByID( EUDORAIMPORT_ADDRESS_SUCCESS, pBundle);
       PRUnichar *pText = nsTextFormatter::smprintf( pFmt, name.get());
       pStream->Append( pText);
       nsTextFormatter::smprintf_free( pText);
       nsEudoraStringBundle::FreeString( pFmt);
       ImportEudoraMailImpl::AddLinebreak( pStream);
       NS_IF_RELEASE( pBundle);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Here is the caller graph for this function:

Definition at line 185 of file nsEudoraImport.cpp.

{ return( NS_OK); }

Member Data Documentation

Definition at line 197 of file nsEudoraImport.cpp.


The documentation for this class was generated from the following file: