Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions
nsPrefConverter Class Reference

#include <nsDogbertProfileMigrator.h>

Inheritance diagram for nsPrefConverter:
Inheritance graph
Collaboration diagram for nsPrefConverter:
Collaboration graph

List of all members.

Public Member Functions

 nsPrefConverter ()
virtual ~nsPrefConverter ()
nsresult ConvertPrefsToUTF8 ()
nsresult GetPlatformCharset (nsCString &aCharset)
 nsPrefConverter ()
virtual ~nsPrefConverter ()
GetPlatformCharset (nsCString &aCharset)

Detailed Description

Definition at line 76 of file nsDogbertProfileMigrator.h.

Constructor & Destructor Documentation

Definition at line 2184 of file nsDogbertProfileMigrator.cpp.


Definition at line 2180 of file nsDogbertProfileMigrator.cpp.

virtual nsPrefConverter::~nsPrefConverter ( ) [virtual]

Member Function Documentation

Implements nsIPrefConverter.

Definition at line 2310 of file nsDogbertProfileMigrator.cpp.

  nsresult rv;

  nsCStringArray prefsToMigrate;
  nsCOMPtr<nsIPref> prefs(do_GetService(kPrefServiceCID, &rv));

  if(NS_FAILED(rv)) return rv;
  if (!prefs) return NS_ERROR_FAILURE;

  nsCAutoString charSet;
  rv = GetPlatformCharset(charSet);
  if (NS_FAILED(rv)) return rv;

  for (PRUint32 i = 0; prefsToConvert[i]; i++) {
    nsCString prefnameStr( prefsToConvert[i] );

  prefs->EnumerateChildren("intl.font",fontPrefEnumerationFunction,(void *)(&prefsToMigrate));
  prefs->EnumerateChildren("ldap_2.servers",ldapPrefEnumerationFunction,(void *)(&prefsToMigrate));
  prefs->EnumerateChildren("mail.identity.vcard",vCardPrefEnumerationFunction,(void *)(&prefsToMigrate));

  PrefEnumerationClosure closure;

  closure.prefs = prefs;
  closure.charSet = charSet.get();

  prefsToMigrate.EnumerateForwards((nsCStringArrayEnumFunc)convertPref, (void *)(&closure));

  rv = prefs->SetBoolPref("prefs.converted-to-utf8",PR_TRUE);
  return NS_OK;

Here is the call graph for this function:

Definition at line 2347 of file nsDogbertProfileMigrator.cpp.

  nsresult rv;

  // we may cache it since the platform charset will not change through application life
  nsCOMPtr <nsIPlatformCharset> platformCharset = do_GetService(NS_PLATFORMCHARSET_CONTRACTID, &rv);
  if (NS_SUCCEEDED(rv) && platformCharset)
   rv = platformCharset->GetCharset(kPlatformCharsetSel_4xPrefsJS, aCharset);
  if (NS_FAILED(rv))
   aCharset.Assign(NS_LITERAL_CSTRING("ISO-8859-1"));  // use ISO-8859-1 in case of any error
  return rv;

Here is the call graph for this function:

NS_DECL_ISUPPORTS NS_DECL_NSIPREFCONVERTER nsresult nsPrefConverter::GetPlatformCharset ( nsCString aCharset)

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