зеркало из https://github.com/mozilla/pjs.git
fix 232984 r=mscott, sr=sspitzer migrate mailnews prefs after 4.x profile migration when mcd sets up an account
This commit is contained in:
Родитель
ae563c8b57
Коммит
fcafe94821
|
@ -138,8 +138,10 @@ function verifyAccounts(wizardcallback) {
|
||||||
try {
|
try {
|
||||||
var am = Components.classes[accountManagerContractID].getService(Components.interfaces.nsIMsgAccountManager);
|
var am = Components.classes[accountManagerContractID].getService(Components.interfaces.nsIMsgAccountManager);
|
||||||
|
|
||||||
// migrate quoting preferences from global to per account
|
// migrate quoting preferences from global to per account. This function returns
|
||||||
migrateGlobalQuotingPrefs(am.allIdentities);
|
// true if it had to migrate, which we will use to mean this is a just migrated
|
||||||
|
// or new profile
|
||||||
|
var newProfile = migrateGlobalQuotingPrefs(am.allIdentities);
|
||||||
|
|
||||||
var accounts = am.accounts;
|
var accounts = am.accounts;
|
||||||
|
|
||||||
|
@ -152,8 +154,22 @@ function verifyAccounts(wizardcallback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// if there are no accounts, or all accounts are "invalid"
|
// if there are no accounts, or all accounts are "invalid"
|
||||||
// then kick off the account migration
|
// then kick off the account migration. Or if this is a new (to Mozilla) profile.
|
||||||
if (accountCount == invalidAccounts.length) {
|
// MCD can set up accounts without the profile being used yet
|
||||||
|
if (newProfile) {
|
||||||
|
// check if MCD is configured. If not, say this is not a new profile
|
||||||
|
// so that we don't accidentally remigrate non MCD profiles.
|
||||||
|
var adminUrl;
|
||||||
|
var pref = Components.classes["@mozilla.org/preferences-service;1"]
|
||||||
|
.getService(Components.interfaces.nsIPrefBranch);
|
||||||
|
try {
|
||||||
|
adminUrl = pref.GetCharPref("autoadmin.global_config_url");
|
||||||
|
}
|
||||||
|
catch (ex) {}
|
||||||
|
if (!adminUrl)
|
||||||
|
newProfile = false;
|
||||||
|
}
|
||||||
|
if (newProfile || accountCount == invalidAccounts.length) {
|
||||||
try {
|
try {
|
||||||
var messengerMigrator = Components.classes[messengerMigratorContractID].getService(Components.interfaces.nsIMessengerMigrator);
|
var messengerMigrator = Components.classes[messengerMigratorContractID].getService(Components.interfaces.nsIMessengerMigrator);
|
||||||
messengerMigrator.UpgradePrefs();
|
messengerMigrator.UpgradePrefs();
|
||||||
|
@ -285,6 +301,9 @@ function loadInboxForNewAccount()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// returns true if we migrated - it knows this because 4.x did not have the
|
||||||
|
// pref mailnews.quotingPrefs.version, so if it's not set, we're either
|
||||||
|
// migrating from 4.x, or a much older version of Mozilla.
|
||||||
function migrateGlobalQuotingPrefs(allIdentities)
|
function migrateGlobalQuotingPrefs(allIdentities)
|
||||||
{
|
{
|
||||||
// if reply_on_top and auto_quote exist then, if non-default
|
// if reply_on_top and auto_quote exist then, if non-default
|
||||||
|
@ -292,6 +311,7 @@ function migrateGlobalQuotingPrefs(allIdentities)
|
||||||
var reply_on_top = 0;
|
var reply_on_top = 0;
|
||||||
var auto_quote = true;
|
var auto_quote = true;
|
||||||
var quotingPrefs = 0;
|
var quotingPrefs = 0;
|
||||||
|
var migrated = false;
|
||||||
try {
|
try {
|
||||||
var prefService = Components.classes["@mozilla.org/preferences-service;1"]
|
var prefService = Components.classes["@mozilla.org/preferences-service;1"]
|
||||||
.getService(Components.interfaces.nsIPrefService);
|
.getService(Components.interfaces.nsIPrefService);
|
||||||
|
@ -301,6 +321,7 @@ function migrateGlobalQuotingPrefs(allIdentities)
|
||||||
|
|
||||||
// If the quotingPrefs version is 0 then we need to migrate our preferences
|
// If the quotingPrefs version is 0 then we need to migrate our preferences
|
||||||
if (quotingPrefs == 0) {
|
if (quotingPrefs == 0) {
|
||||||
|
migrated = true;
|
||||||
try {
|
try {
|
||||||
reply_on_top = pref.getIntPref("mailnews.reply_on_top");
|
reply_on_top = pref.getIntPref("mailnews.reply_on_top");
|
||||||
auto_quote = pref.getBoolPref("mail.auto_quote");
|
auto_quote = pref.getBoolPref("mail.auto_quote");
|
||||||
|
@ -319,4 +340,5 @@ function migrateGlobalQuotingPrefs(allIdentities)
|
||||||
}
|
}
|
||||||
pref.setIntPref("mailnews.quotingPrefs.version", 1);
|
pref.setIntPref("mailnews.quotingPrefs.version", 1);
|
||||||
}
|
}
|
||||||
|
return migrated;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче