Back to index

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

List of all members.

Public Member Functions

 ImportOutlookAddressImpl ()
virtual ~ImportOutlookAddressImpl ()
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)

Private Member Functions

void ReportSuccess (nsString &name, nsString *pStream)

Private Attributes

PRUint32 m_msgCount
PRUint32 m_msgTotal
nsOutlookMail m_address

Detailed Description

Definition at line 124 of file nsOutlookImport.cpp.


Constructor & Destructor Documentation

Definition at line 551 of file nsOutlookImport.cpp.

{
       m_msgCount = 0;
       m_msgTotal = 0;
}

Here is the caller graph for this function:

Definition at line 558 of file nsOutlookImport.cpp.

{
}

Member Function Documentation

Definition at line 537 of file nsOutlookImport.cpp.

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

    *aImport = new ImportOutlookAddressImpl();
    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 584 of file nsOutlookImport.cpp.

{
    NS_PRECONDITION(_retval != nsnull, "null ptr");
    if (!_retval)
        return NS_ERROR_NULL_POINTER;
       
       return( m_address.GetAddressBooks( _retval));
}

Here is the call graph for this function:

PRBool nsIImportAddressBooks::GetAutoFind ( out wstring  description) [inherited]

Here is the caller graph for this function:

Definition at line 567 of file nsOutlookImport.cpp.

{
    NS_PRECONDITION(description != nsnull, "null ptr");
    NS_PRECONDITION(_retval != nsnull, "null ptr");
    if (! description || !_retval)
        return NS_ERROR_NULL_POINTER;
    
    *_retval = PR_TRUE;
    nsString str;
       nsOutlookStringBundle::GetStringByID( OUTLOOKIMPORT_ADDRNAME, str);
       *description = ToNewUnicode(str);
    
    return( NS_OK);
}

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_IMETHOD ImportOutlookAddressImpl::GetDefaultLocation ( nsIFileSpec **  location,
PRBool found,
PRBool userVerify 
) [inline]

Definition at line 147 of file nsOutlookImport.cpp.

              { return( NS_ERROR_FAILURE);}

Here is the caller graph for this function:

Definition at line 658 of file nsOutlookImport.cpp.

{
    NS_PRECONDITION(_retval != nsnull, "null ptr");
    if (!_retval)
        return NS_ERROR_NULL_POINTER;
       
       PRUint32 result = m_msgCount;
       if (m_msgTotal) {
              result *= 100;
              result /= m_msgTotal;
       }
       else
              result = 0;
       
       if (result > 100)
              result = 100;

       *_retval = result;
       
       return( NS_OK);
}

Here is the caller graph for this function:

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

Definition at line 144 of file nsOutlookImport.cpp.

{ *_retval = PR_FALSE; return( NS_OK);}
NS_IMETHOD ImportOutlookAddressImpl::GetSampleData ( PRInt32  index,
PRBool pFound,
PRUnichar **  pStr 
) [inline]

Definition at line 169 of file nsOutlookImport.cpp.

              { return( NS_ERROR_FAILURE);}
wstring nsIImportAddressBooks::GetSampleData ( in long  recordNumber,
out boolean  recordExists 
) [inherited]

Here is the caller graph for this function:

Definition at line 138 of file nsOutlookImport.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 ImportOutlookAddressImpl::ImportAddressBook ( nsIImportABDescriptor source,
nsIAddrDatabase destination,
nsIImportFieldMap fieldMap,
PRBool  isAddrLocHome,
PRUnichar **  errorLog,
PRUnichar **  successLog,
PRBool fatalError 
)

Definition at line 595 of file nsOutlookImport.cpp.

{
       m_msgCount = 0;
       m_msgTotal = 0;
    NS_PRECONDITION(source != nsnull, "null ptr");
    NS_PRECONDITION(destination != nsnull, "null ptr");
       NS_PRECONDITION(fatalError != nsnull, "null ptr");
       
       nsCOMPtr<nsIStringBundle> bundle( dont_AddRef( nsOutlookStringBundle::GetStringBundleProxy()));

       nsString      success;
       nsString      error;
    if (!source || !destination || !fatalError) {
              IMPORT_LOG0( "*** Bad param passed to outlook address import\n");
              nsOutlookStringBundle::GetStringByID( OUTLOOKIMPORT_ADDRESS_BADPARAM, error, bundle);
              if (fatalError)
                     *fatalError = PR_TRUE;
              ImportOutlookMailImpl::SetLogs( success, error, pErrorLog, pSuccessLog);
           return NS_ERROR_NULL_POINTER;
       }
      
    nsString  name;
    PRUnichar *      pName;
    if (NS_SUCCEEDED( source->GetPreferredName( &pName))) {
       name = pName;
       nsCRT::free( pName);
    }
    
    
       PRUint32      id;
    if (NS_FAILED( source->GetIdentifier( &id))) {
              ImportOutlookMailImpl::ReportError( OUTLOOKIMPORT_ADDRESS_BADSOURCEFILE, name, &error);
              ImportOutlookMailImpl::SetLogs( success, error, pErrorLog, pSuccessLog);            
       return( NS_ERROR_FAILURE);
    }
       
           
    nsresult rv = NS_OK;
       
       rv = m_address.ImportAddresses( &m_msgCount, &m_msgTotal, name.get(), id, destination, error);
    
       if (NS_SUCCEEDED( rv) && error.IsEmpty()) {
              ReportSuccess( name, &success);
       }
       else {
              ImportOutlookMailImpl::ReportError( OUTLOOKIMPORT_ADDRESS_CONVERTERROR, name, &error);
       }

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

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

  rv = destination->Commit(nsAddrDBCommitType::kLargeCommit);
       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 154 of file nsOutlookImport.cpp.

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

Definition at line 680 of file nsOutlookImport.cpp.

{
       if (!pStream)
              return;
       // load the success string
       nsIStringBundle *pBundle = nsOutlookStringBundle::GetStringBundleProxy();
       PRUnichar *pFmt = nsOutlookStringBundle::GetStringByID( OUTLOOKIMPORT_ADDRESS_SUCCESS, pBundle);
       PRUnichar *pText = nsTextFormatter::smprintf( pFmt, name.get());
       pStream->Append( pText);
       nsTextFormatter::smprintf_free( pText);
       nsOutlookStringBundle::FreeString( pFmt);
       ImportOutlookMailImpl::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 172 of file nsOutlookImport.cpp.

{ return( NS_OK); }

Member Data Documentation

Definition at line 180 of file nsOutlookImport.cpp.

Definition at line 178 of file nsOutlookImport.cpp.

Definition at line 179 of file nsOutlookImport.cpp.


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