Back to index

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

List of all members.

Public Member Functions

 ImportOEAddressImpl ()
virtual ~ImportOEAddressImpl ()
NS_DECL_ISUPPORTS NS_IMETHOD GetSupportsMultiple (PRBool *_retval)
NS_IMETHOD GetAutoFind (PRUnichar **description, PRBool *_retval)
NS_IMETHOD GetNeedsFieldMap (nsIFileSpec *pLoc, 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

CWABm_pWab
int m_doneSoFar

Detailed Description

Definition at line 124 of file nsOEImport.cpp.


Constructor & Destructor Documentation

Definition at line 566 of file nsOEImport.cpp.

{
       m_pWab = nsnull;
}

Here is the caller graph for this function:

Definition at line 572 of file nsOEImport.cpp.

{
       if (m_pWab)
              delete m_pWab;
}

Member Function Documentation

Definition at line 552 of file nsOEImport.cpp.

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

    *aImport = new ImportOEAddressImpl();
    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 599 of file nsOEImport.cpp.

{
    NS_PRECONDITION(_retval != nsnull, "null ptr");
    if (!_retval)
        return NS_ERROR_NULL_POINTER;
       
       nsresult rv = NS_NewISupportsArray( _retval);
       if (NS_FAILED( rv)) {
              return( rv);
       }
       // Make sure we can load up the windows address book...
       
       rv = NS_ERROR_FAILURE;
       
       if (m_pWab)
              delete m_pWab;
       m_pWab = new CWAB( nsnull);
       
       nsIImportABDescriptor *            pID;
       nsISupports *                      pInterface;
       nsString                                  str; str.Append(nsOEStringBundle::GetStringByID( OEIMPORT_DEFAULT_NAME));
       
       if (m_pWab->Loaded()) {
              // create a new nsIImportABDescriptor and add it to the array
              nsCOMPtr<nsIImportService> impSvc(do_GetService(NS_IMPORTSERVICE_CONTRACTID, &rv));
              if (NS_SUCCEEDED( rv)) {
                     rv = impSvc->CreateNewABDescriptor( &pID);
                     if (NS_SUCCEEDED( rv)) {
                            pID->SetIdentifier( 0x4F453334);
                            pID->SetRef( 1);
                            pID->SetSize( 100);
                            pID->SetPreferredName( str.get());
                            rv = pID->QueryInterface( kISupportsIID, (void **) &pInterface);
                            (*_retval)->AppendElement( pInterface);
                            pInterface->Release();
                            pID->Release();
                     }
              }
       }
       
       if (NS_FAILED( rv)) {
              delete m_pWab;
              m_pWab = nsnull;
       }
       
       
       return( NS_OK);
}

Here is the call graph for this function:

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

Here is the caller graph for this function:

NS_IMETHODIMP ImportOEAddressImpl::GetAutoFind ( PRUnichar **  description,
PRBool _retval 
)

Definition at line 583 of file nsOEImport.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; str.Append(nsOEStringBundle::GetStringByID(OEIMPORT_AUTOFIND));
    *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 ImportOEAddressImpl::GetDefaultLocation ( nsIFileSpec **  location,
PRBool found,
PRBool userVerify 
) [inline]

Definition at line 147 of file nsOEImport.cpp.

              { return( NS_ERROR_FAILURE);}

Here is the caller graph for this function:

Definition at line 710 of file nsOEImport.cpp.

{
    NS_PRECONDITION(_retval != nsnull, "null ptr");
    if (! _retval)
        return NS_ERROR_NULL_POINTER;
       
       *_retval = (PRUint32) m_doneSoFar;
       return( NS_OK);
}

Here is the caller graph for this function:

Definition at line 144 of file nsOEImport.cpp.

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

Definition at line 169 of file nsOEImport.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 nsOEImport.cpp.

{ *_retval = PR_FALSE; 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 ImportOEAddressImpl::ImportAddressBook ( nsIImportABDescriptor source,
nsIAddrDatabase destination,
nsIImportFieldMap fieldMap,
PRBool  isAddrLocHome,
PRUnichar **  errorLog,
PRUnichar **  successLog,
PRBool fatalError 
)

Definition at line 650 of file nsOEImport.cpp.

{
    NS_PRECONDITION(source != nsnull, "null ptr");
    // NS_PRECONDITION(destination != nsnull, "null ptr");
    // NS_PRECONDITION(fieldMap != nsnull, "null ptr");
    NS_PRECONDITION(fatalError != nsnull, "null ptr");
    if (!source || !fatalError)
        return NS_ERROR_NULL_POINTER;

       // we assume it is our one and only address book.
       if (!m_pWab) {
              IMPORT_LOG0( "Wab not loaded in ImportAddressBook call\n");
              return( NS_ERROR_FAILURE);
       }
    
  IMPORT_LOG0( "IMPORTING OUTLOOK EXPRESS ADDRESS BOOK\n");

  nsCOMPtr<nsIStringBundle> bundle( dont_AddRef( nsOEStringBundle::GetStringBundleProxy()));
  nsString    success;
  nsString    error;
  if (!source || !destination || !fatalError)
  {
    nsOEStringBundle::GetStringByID( OEIMPORT_ADDRESS_BADPARAM, error, bundle);
    if (fatalError)
      *fatalError = PR_TRUE;
    ImportOEMailImpl::SetLogs( success, error, errorLog, successLog);
    return NS_ERROR_NULL_POINTER;
  }

  m_doneSoFar = 0;
  nsOEAddressIterator * pIter = new nsOEAddressIterator( m_pWab, destination);
  HRESULT hr = m_pWab->IterateWABContents( pIter, &m_doneSoFar);
  delete pIter;

  nsString    name;
  if (SUCCEEDED(hr))
  {
    nsXPIDLString pName;
    if (NS_SUCCEEDED( source->GetPreferredName(getter_Copies(pName))))
    {
      name = pName;
      ReportSuccess( name, &success);
    }
  }
  else
    ImportOEMailImpl::ReportError( OEIMPORT_ADDRESS_CONVERTERROR, name, &error);

  ImportOEMailImpl::SetLogs( success, error, errorLog, successLog);
    
  nsresult 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 nsOEImport.cpp.

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

Definition at line 720 of file nsOEImport.cpp.

{
  if (!pStream)
    return;
  // load the success string
  nsIStringBundle *pBundle = nsOEStringBundle::GetStringBundleProxy();
  PRUnichar *pFmt = nsOEStringBundle::GetStringByID( OEIMPORT_ADDRESS_SUCCESS, pBundle);
  PRUnichar *pText = nsTextFormatter::smprintf( pFmt, name.get());
  pStream->Append( pText);
  nsTextFormatter::smprintf_free( pText);
  nsOEStringBundle::FreeString( pFmt);
  ImportOEMailImpl::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 nsOEImport.cpp.

{ return( NS_OK); }

Member Data Documentation

Definition at line 179 of file nsOEImport.cpp.

Definition at line 178 of file nsOEImport.cpp.


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