Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes
nsEudoraProfileMigrator Class Reference

#include <nsEudoraProfileMigrator.h>

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

List of all members.

Public Member Functions

NS_DECL_NSIMAILPROFILEMIGRATOR
NS_DECL_ISUPPORTS
NS_DECL_NSITIMERCALLBACK 
nsEudoraProfileMigrator ()
virtual ~nsEudoraProfileMigrator ()
virtual nsresult ContinueImport ()
void migrate (in unsigned short aItems, in nsIProfileStartup aStartup, in wstring aProfile)
 Copy user profile information to the current active profile.
unsigned short getMigrateData (in wstring aProfile, in boolean aDoingStartup)
 A bit field containing profile items that this migrator offers for import.
void notify (in nsITimer timer)

Public Attributes

const unsigned short ALL = 0x0000
 profile items to migrate.
const unsigned short SETTINGS = 0x0001
const unsigned short ACCOUNT_SETTINGS = 0x0002
const unsigned short ADDRESSBOOK_DATA = 0x0004
const unsigned short JUNKTRAINING = 0x0008
const unsigned short PASSWORDS = 0x0010
const unsigned short OTHERDATA = 0x0020
const unsigned short NEWSDATA = 0x0040
const unsigned short MAILDATA = 0x0080
readonly attribute boolean sourceExists
 Whether or not there is any data that can be imported from this browser (i.e.
readonly attribute boolean sourceHasMultipleProfiles
 Whether or not the import source implementing this interface has multiple user profiles configured.
readonly attribute nsISupportsArray sourceProfiles
 An enumeration of available profiles.

Protected Member Functions

nsresult ImportSettings (nsIImportModule *aImportModule)
nsresult ImportAddressBook (nsIImportModule *aImportModule)
nsresult ImportMailData (nsIImportModule *aImportModule)
nsresult FinishCopyingAddressBookData ()
nsresult FinishCopyingMailFolders ()

Protected Attributes

nsCOMPtr< nsIObserverServicemObserverService
nsCOMPtr< nsITimermFileIOTimer
nsCOMPtr< nsIImportGenericmGenericImporter
nsCOMPtr< nsIImportModulemImportModule
nsCOMPtr< nsIMsgAccountmLocalFolderAccount
PRBool mProcessingMailFolders

Detailed Description

Definition at line 57 of file nsEudoraProfileMigrator.h.


Constructor & Destructor Documentation

Definition at line 60 of file nsEudoraProfileMigrator.cpp.

{
  mProcessingMailFolders = PR_FALSE;
  // get the import service
  mImportModule = do_CreateInstance("@mozilla.org/import/import-eudora;1");
}

Here is the call graph for this function:

Definition at line 67 of file nsEudoraProfileMigrator.cpp.

{           
}

Member Function Documentation

Implements nsProfileMigratorBase.

Definition at line 71 of file nsEudoraProfileMigrator.cpp.

{
  return Notify(nsnull);
}

Definition at line 123 of file nsProfileMigratorBase.cpp.

{
  nsAutoString index;
  index.AppendInt(nsIMailProfileMigrator::ADDRESSBOOK_DATA); 
  NOTIFY_OBSERVERS(MIGRATION_ITEMAFTERMIGRATE, index.get());

  // now kick off the mail migration code
  ImportMailData(mImportModule);

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 169 of file nsProfileMigratorBase.cpp.

{
  nsAutoString index;
  index.AppendInt(nsIMailProfileMigrator::MAILDATA); 
  NOTIFY_OBSERVERS(MIGRATION_ITEMAFTERMIGRATE, index.get());

  // migration is now done...notify the UI.
  NOTIFY_OBSERVERS(MIGRATION_ENDED, nsnull);
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned short nsIMailProfileMigrator::getMigrateData ( in wstring  aProfile,
in boolean  aDoingStartup 
) [inherited]

A bit field containing profile items that this migrator offers for import.

Parameters:
aProfilethe profile that we are looking for available data to import
aStarting"true" if the profile is not currently being used.
Returns:
bit field containing profile items (see above)
nsresult nsProfileMigratorBase::ImportAddressBook ( nsIImportModule aImportModule) [protected, inherited]

Definition at line 92 of file nsProfileMigratorBase.cpp.

{  
  nsresult rv; 
  
  nsAutoString index;
  index.AppendInt(nsIMailProfileMigrator::ADDRESSBOOK_DATA); 
  NOTIFY_OBSERVERS(MIGRATION_ITEMBEFOREMIGRATE, index.get());

  rv = aImportModule->GetImportInterface(NS_IMPORT_ADDRESS_STR, getter_AddRefs(mGenericImporter));
  NS_ENSURE_SUCCESS(rv, rv);

  nsCOMPtr<nsISupportsCString> pabString = do_CreateInstance(NS_SUPPORTS_CSTRING_CONTRACTID, &rv);
  NS_ENSURE_SUCCESS(rv, rv);

  // we want to migrate the outlook express addressbook into our personal address book
  pabString->SetData(nsDependentCString(kPersonalAddressbookUri));
  mGenericImporter->SetData("addressDestination", pabString);

  PRBool importResult;
  PRBool wantsProgress;
  mGenericImporter->WantsProgress(&wantsProgress);
  rv = mGenericImporter->BeginImport(nsnull, nsnull, PR_TRUE, &importResult);

  if (wantsProgress)
    ContinueImport();
  else
    FinishCopyingAddressBookData();

  return rv;
}

Here is the call graph for this function:

nsresult nsProfileMigratorBase::ImportMailData ( nsIImportModule aImportModule) [protected, inherited]

Definition at line 135 of file nsProfileMigratorBase.cpp.

{
  nsresult rv; 
  
  nsAutoString index;
  index.AppendInt(nsIMailProfileMigrator::MAILDATA); 
  NOTIFY_OBSERVERS(MIGRATION_ITEMBEFOREMIGRATE, index.get());

  rv = aImportModule->GetImportInterface(NS_IMPORT_MAIL_STR, getter_AddRefs(mGenericImporter));
  NS_ENSURE_SUCCESS(rv, rv);

  nsCOMPtr<nsISupportsPRBool> migrating = do_CreateInstance(NS_SUPPORTS_PRBOOL_CONTRACTID, &rv);
  NS_ENSURE_SUCCESS(rv, rv);

  // by setting the migration flag, we force the import utility to install local folders from OE
  // directly into Local Folders and not as a subfolder
  migrating->SetData(PR_TRUE);
  mGenericImporter->SetData("migration", migrating);

  PRBool importResult;
  PRBool wantsProgress;
  mGenericImporter->WantsProgress(&wantsProgress);
  rv = mGenericImporter->BeginImport(nsnull, nsnull, PR_TRUE, &importResult);

  mProcessingMailFolders = PR_TRUE;

  if (wantsProgress)
    ContinueImport();
  else
    FinishCopyingMailFolders();

  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsProfileMigratorBase::ImportSettings ( nsIImportModule aImportModule) [protected, inherited]

Definition at line 71 of file nsProfileMigratorBase.cpp.

{  
  nsresult rv; 
  
  nsAutoString index;
  index.AppendInt(nsIMailProfileMigrator::ACCOUNT_SETTINGS); 
  NOTIFY_OBSERVERS(MIGRATION_ITEMBEFOREMIGRATE, index.get());

  nsCOMPtr<nsIImportSettings> importSettings;
  rv = aImportModule->GetImportInterface(NS_IMPORT_SETTINGS_STR, getter_AddRefs(importSettings));
  NS_ENSURE_SUCCESS(rv, rv);

  PRBool importedSettings = PR_FALSE;

  rv = importSettings->Import(getter_AddRefs(mLocalFolderAccount), &importedSettings);

  NOTIFY_OBSERVERS(MIGRATION_ITEMAFTERMIGRATE, index.get());

  return rv;
}

Here is the call graph for this function:

void nsIMailProfileMigrator::migrate ( in unsigned short  aItems,
in nsIProfileStartup  aStartup,
in wstring  aProfile 
) [inherited]

Copy user profile information to the current active profile.

Parameters:
aItemslist of data items to migrate. see above for values.
aReplacereplace or append current data where applicable.
aProfileprofile to migrate from, if there is more than one.
void nsITimerCallback::notify ( in nsITimer  timer) [inherited]
Parameters:
aTimerthe timer which has expired

Member Data Documentation

const unsigned short nsIMailProfileMigrator::ACCOUNT_SETTINGS = 0x0002 [inherited]

Definition at line 50 of file nsIMailProfileMigrator.idl.

const unsigned short nsIMailProfileMigrator::ADDRESSBOOK_DATA = 0x0004 [inherited]

Definition at line 51 of file nsIMailProfileMigrator.idl.

const unsigned short nsIMailProfileMigrator::ALL = 0x0000 [inherited]

profile items to migrate.

use with migrate().

Definition at line 48 of file nsIMailProfileMigrator.idl.

const unsigned short nsIMailProfileMigrator::JUNKTRAINING = 0x0008 [inherited]

Definition at line 52 of file nsIMailProfileMigrator.idl.

const unsigned short nsIMailProfileMigrator::MAILDATA = 0x0080 [inherited]

Definition at line 56 of file nsIMailProfileMigrator.idl.

Definition at line 65 of file nsProfileMigratorBase.h.

Definition at line 66 of file nsProfileMigratorBase.h.

Definition at line 67 of file nsProfileMigratorBase.h.

Definition at line 68 of file nsProfileMigratorBase.h.

Definition at line 64 of file nsProfileMigratorBase.h.

Definition at line 69 of file nsProfileMigratorBase.h.

const unsigned short nsIMailProfileMigrator::NEWSDATA = 0x0040 [inherited]

Definition at line 55 of file nsIMailProfileMigrator.idl.

const unsigned short nsIMailProfileMigrator::OTHERDATA = 0x0020 [inherited]

Definition at line 54 of file nsIMailProfileMigrator.idl.

const unsigned short nsIMailProfileMigrator::PASSWORDS = 0x0010 [inherited]

Definition at line 53 of file nsIMailProfileMigrator.idl.

const unsigned short nsIMailProfileMigrator::SETTINGS = 0x0001 [inherited]

Definition at line 49 of file nsIMailProfileMigrator.idl.

Whether or not there is any data that can be imported from this browser (i.e.

whether or not it is installed, and there exists a user profile)

Definition at line 81 of file nsIMailProfileMigrator.idl.

Whether or not the import source implementing this interface has multiple user profiles configured.

Definition at line 87 of file nsIMailProfileMigrator.idl.

An enumeration of available profiles.

If the import source does not support profiles, this attribute is null.

Definition at line 93 of file nsIMailProfileMigrator.idl.


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