diff --git a/mailnews/base/src/nsMessengerMigrator.cpp b/mailnews/base/src/nsMessengerMigrator.cpp index 8f83d2ac19d9..291ead7a8235 100644 --- a/mailnews/base/src/nsMessengerMigrator.cpp +++ b/mailnews/base/src/nsMessengerMigrator.cpp @@ -351,10 +351,7 @@ static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID); NS_IMPL_ISUPPORTS2(nsMessengerMigrator, nsIMessengerMigrator, nsIObserver) nsMessengerMigrator::nsMessengerMigrator() : - m_haveShutdown(PR_FALSE), - m_oldMailType(-1), - m_alreadySetNntpDefaultLocalPath(PR_FALSE), - m_alreadySetImapDefaultLocalPath(PR_FALSE) + m_haveShutdown(PR_FALSE) { NS_INIT_REFCNT(); @@ -394,7 +391,7 @@ nsresult nsMessengerMigrator::Init() rv = getPrefService(); if (NS_FAILED(rv)) return rv; - rv = m_prefs->GetIntPref(PREF_4X_MAIL_SERVER_TYPE, &m_oldMailType); + rv = ResetState(); return rv; } @@ -612,6 +609,20 @@ nsMessengerMigrator::CreateLocalMailAccount(PRBool migrating) return NS_OK; } +nsresult +nsMessengerMigrator::ResetState() +{ + m_alreadySetNntpDefaultLocalPath = PR_FALSE; + m_alreadySetImapDefaultLocalPath = PR_FALSE; + + // Reset 'm_oldMailType' in case the prefs file has changed. This is possible in quick launch + // mode where the profile to be migrated is IMAP type but the current working profile is POP. + nsresult rv = m_prefs->GetIntPref(PREF_4X_MAIL_SERVER_TYPE, &m_oldMailType); + if (NS_FAILED(rv)) + m_oldMailType = -1; + return rv; +} + NS_IMETHODIMP nsMessengerMigrator::UpgradePrefs() { @@ -620,6 +631,9 @@ nsMessengerMigrator::UpgradePrefs() rv = getPrefService(); if (NS_FAILED(rv)) return rv; + // Reset some control vars, necessary in turbo mode. + ResetState(); + // because mail.server_type defaults to 0 (pop) it will look the user // has something to migrate, even with an empty prefs.js file // ProceedWithMigration will check if there is something to migrate diff --git a/mailnews/base/src/nsMessengerMigrator.h b/mailnews/base/src/nsMessengerMigrator.h index 010b6395be26..a46dcc468f7e 100644 --- a/mailnews/base/src/nsMessengerMigrator.h +++ b/mailnews/base/src/nsMessengerMigrator.h @@ -140,6 +140,8 @@ private: nsresult getPrefService(); nsresult initializeStrings(); + + nsresult ResetState(); nsCOMPtr m_prefs; PRBool m_haveShutdown;