Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Private Member Functions | Private Attributes
nsImportService Class Reference

#include <nsImportService.h>

Inheritance diagram for nsImportService:
Inheritance graph
[legend]
Collaboration diagram for nsImportService:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsImportService ()
virtual ~nsImportService ()
void DiscoverModules ()
long GetModuleCount (in string filter)
void GetModuleInfo (in string filter, in long index, out wstring name, out wstring description)
wstring GetModuleName (in string filter, in long index)
wstring GetModuleDescription (in string filter, in long index)
nsIImportModule GetModule (in string filter, in long index)
nsIImportModule GetModuleWithCID (in nsCIDRef cid)
nsIImportFieldMap CreateNewFieldMap ()
nsIImportMailboxDescriptor CreateNewMailboxDescriptor ()
nsIImportABDescriptor CreateNewABDescriptor ()
nsIImportGeneric CreateNewGenericMail ()
nsIImportGeneric CreateNewGenericAddressBooks ()
void SystemStringToUnicode (in string sysStr, in nsStringRef uniStr)
void SystemStringFromUnicode (in wstring uniStr, in nsCStringRef sysStr)

Private Member Functions

nsresult LoadModuleInfo (const char *pClsId, const char *pSupports)
nsresult DoDiscover (void)

Private Attributes

nsImportModuleListm_pModules
PRBool m_didDiscovery
nsCString m_sysCharset
nsIUnicodeDecoderm_pDecoder
nsIUnicodeEncoderm_pEncoder

Detailed Description

Definition at line 56 of file nsImportService.h.


Constructor & Destructor Documentation

Definition at line 80 of file nsImportService.cpp.

                                 : m_pModules( nsnull)
{
       // Init logging module.
  if (!IMPORTLOGMODULE)
    IMPORTLOGMODULE = PR_NewLogModule("IMPORT");
  IMPORT_LOG0( "* nsImport Service Created\n");

       m_didDiscovery = PR_FALSE;
       m_pDecoder = nsnull;
       m_pEncoder = nsnull;

       // Go ahead an initialize the charset converter to avoid any 
       // thread issues later.
       nsString      str;
       SystemStringToUnicode( "Dummy", str);
    
    nsImportStringBundle::GetStringBundle(); 
}

Here is the call graph for this function:

Definition at line 100 of file nsImportService.cpp.

{
       NS_IF_RELEASE(m_pDecoder);
       NS_IF_RELEASE(m_pEncoder);

       gImportService = nsnull;

    if (m_pModules != nsnull)
        delete m_pModules;

       IMPORT_LOG0( "* nsImport Service Deleted\n");
}

Member Function Documentation

Here is the caller graph for this function:

Here is the caller graph for this function:

Definition at line 490 of file nsImportService.cpp.

{      
       if (m_didDiscovery)
              return( NS_OK);
       
       if (m_pModules != nsnull)
              m_pModules->ClearList();
                  
    nsresult rv;
       
       nsCOMPtr<nsICategoryManager> catMan = do_GetService( NS_CATEGORYMANAGER_CONTRACTID, &rv);
       if (NS_FAILED( rv)) return( rv);
    
       nsCOMPtr<nsISimpleEnumerator> e;
       rv = catMan->EnumerateCategory( "mailnewsimport", getter_AddRefs( e));
       if (NS_FAILED( rv)) return( rv);
       nsCOMPtr<nsISupportsCString> contractid;
       rv = e->GetNext( getter_AddRefs( contractid));
       while (NS_SUCCEEDED( rv) && contractid) {
              nsXPIDLCString       contractIdStr;
              contractid->ToString( getter_Copies( contractIdStr));
              nsXPIDLCString       supportsStr;
              rv = catMan->GetCategoryEntry( "mailnewsimport", contractIdStr, getter_Copies( supportsStr));
              if (NS_SUCCEEDED( rv)) {
                     LoadModuleInfo( contractIdStr, supportsStr);
              }
              rv = e->GetNext( getter_AddRefs( contractid));
       }

       m_didDiscovery = PR_TRUE;
       
    return NS_OK;
}

Here is the call graph for this function:

nsIImportModule nsIImportService::GetModule ( in string  filter,
in long  index 
) [inherited]
wstring nsIImportService::GetModuleDescription ( in string  filter,
in long  index 
) [inherited]
void nsIImportService::GetModuleInfo ( in string  filter,
in long  index,
out wstring  name,
out wstring  description 
) [inherited]
wstring nsIImportService::GetModuleName ( in string  filter,
in long  index 
) [inherited]
nsIImportModule nsIImportService::GetModuleWithCID ( in nsCIDRef  cid) [inherited]
nsresult nsImportService::LoadModuleInfo ( const char *  pClsId,
const char *  pSupports 
) [private]

Definition at line 524 of file nsImportService.cpp.

{
       if (!pClsId || !pSupports)
              return( NS_OK);

       if (m_pModules == nsnull)
              m_pModules = new nsImportModuleList();
              
       // load the component and get all of the info we need from it....
       // then call AddModule
       nsresult      rv;

       nsCID                       clsId;
       clsId.Parse( pClsId);
       nsIImportModule *    module;
       rv = CallCreateInstance( clsId, &module);
       if (NS_FAILED(rv)) return rv;
       
       nsString      theTitle;     
       nsString      theDescription;
       PRUnichar *   pName;
       rv = module->GetName( &pName);
       if (NS_SUCCEEDED( rv)) {
              theTitle = pName;
                nsMemory::Free(pName);
       }
       else
              theTitle.AssignLiteral("Unknown");
              
       rv = module->GetDescription( &pName);
       if (NS_SUCCEEDED( rv)) {
              theDescription = pName;
                nsMemory::Free(pName);
       }
       else
              theDescription.AssignLiteral("Unknown description");
       
       // call the module to get the info we need
       m_pModules->AddModule( clsId, pSupports, theTitle.get(), theDescription.get());
       
       module->Release();
       
       return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIImportService::SystemStringFromUnicode ( in wstring  uniStr,
in nsCStringRef  sysStr 
) [inherited]
void nsIImportService::SystemStringToUnicode ( in string  sysStr,
in nsStringRef  uniStr 
) [inherited]

Here is the caller graph for this function:


Member Data Documentation

Definition at line 73 of file nsImportService.h.

Definition at line 75 of file nsImportService.h.

Definition at line 76 of file nsImportService.h.

Definition at line 72 of file nsImportService.h.

Definition at line 74 of file nsImportService.h.


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