From 49b3b5e66e4af7dcaebba21b6f65d45281ca2da7 Mon Sep 17 00:00:00 2001 From: "ben%bengoodger.com" Date: Thu, 11 Mar 2004 01:26:41 +0000 Subject: [PATCH] 203077 - Rename Firefox profile data folder from Phoenix to Firefox. This includes some changes to better support the Phoenix Profile Migrator. Also, make migration wizard show for 5 seconds (with a Finish button to dismiss) when automigrating, so the user can see what's happening. for full details see http://bugzilla.mozilla.org/show_bug.cgi?id=203077#c35 r=jst --- browser/app/nsBrowserApp.cpp | 2 +- .../components/migration/content/migration.js | 24 ++++++++++++++----- .../migration/content/migration.xul | 1 + .../components/migration/locale/migration.dtd | 2 ++ .../migration/locale/migration.properties | 8 ++++++- .../public/nsIBrowserProfileMigrator.idl | 20 ++++++++-------- .../migration/src/nsCaminoProfileMigrator.cpp | 4 ++-- .../src/nsDogbertProfileMigrator.cpp | 4 ++-- .../migration/src/nsICabProfileMigrator.cpp | 4 ++-- .../migration/src/nsIEProfileMigrator.cpp | 4 ++-- .../migration/src/nsMacIEProfileMigrator.cpp | 4 ++-- .../src/nsOmniWebProfileMigrator.cpp | 4 ++-- .../migration/src/nsOperaProfileMigrator.cpp | 4 ++-- .../src/nsPhoenixProfileMigrator.cpp | 4 ++-- .../migration/src/nsProfileMigrator.cpp | 20 ++++++++++++---- .../migration/src/nsSafariProfileMigrator.cpp | 4 ++-- .../src/nsSeamonkeyProfileMigrator.cpp | 4 ++-- 17 files changed, 74 insertions(+), 43 deletions(-) diff --git a/browser/app/nsBrowserApp.cpp b/browser/app/nsBrowserApp.cpp index 383d12d19a56..1ca00f090126 100644 --- a/browser/app/nsBrowserApp.cpp +++ b/browser/app/nsBrowserApp.cpp @@ -45,7 +45,7 @@ int main(int argc, char* argv[]) { nsXREAppData appData; appData.SetSplashEnabled(PR_FALSE); - appData.SetProductName(NS_LITERAL_CSTRING("Phoenix")); + appData.SetProductName(NS_LITERAL_CSTRING("Firefox")); appData.SetUseStartupPrefs(PR_FALSE); return xre_main(argc, argv, appData); diff --git a/browser/components/migration/content/migration.js b/browser/components/migration/content/migration.js index 894f64233521..5f5b7f59cff5 100644 --- a/browser/components/migration/content/migration.js +++ b/browser/components/migration/content/migration.js @@ -3,7 +3,7 @@ const kProfileMigratorContractIDPrefix = "@mozilla.org/profile/migrator;1?app=br var MigrationWizard = { _source: "", // Source Profile Migrator ContractID suffix - _itemsFlags: kIMig.ALL, // Selected Import Data Sources (32-bit bitfield) + _itemsFlags: kIMig.ALL, // Selected Import Data Sources (16-bit bitfield) _selectedProfile: null, // Selected Profile name to import from _wiz: null, _migrator: null, @@ -143,7 +143,7 @@ var MigrationWizard = { var bundle = document.getElementById("bundle"); var items = this._migrator.getMigrateData(this._selectedProfile, this._autoMigrate); - for (var i = 0; i < 32; ++i) { + for (var i = 0; i < 16; ++i) { var itemID = (items >> i) & 0x1 ? Math.pow(2, i) : 0; if (itemID > 0) { var checkbox = document.createElement("checkbox"); @@ -185,6 +185,10 @@ var MigrationWizard = { this._wiz.getButton("cancel").disabled = true; this._wiz.getButton("back").disabled = true; this._wiz.getButton("next").disabled = true; + + // When automigrating, show all of the data that can be received from this source. + if (this._autoMigrate) + this._itemsFlags = this._migrator.getMigrateData(this._selectedProfile, this._autoMigrate); this._listItems("migratingItems"); setTimeout(this.onMigratingMigrate, 0, this); @@ -203,13 +207,20 @@ var MigrationWizard = { var bundle = document.getElementById("bundle"); var itemID; - for (var i = 0; i < 32; ++i) { + for (var i = 0; i < 16; ++i) { var itemID = (this._itemsFlags >> i) & 0x1 ? Math.pow(2, i) : 0; if (itemID > 0) { var label = document.createElement("label"); label.id = itemID + "_migrated"; - label.setAttribute("value", bundle.getString(itemID + "_" + this._source)); - items.appendChild(label); + try { + label.setAttribute("value", bundle.getString(itemID + "_" + this._source)); + items.appendChild(label); + } + catch (e) { + // if the block above throws, we've enumerated all the import data types we + // currently support and are now just wasting time, break. + break; + } } } }, @@ -236,7 +247,8 @@ var MigrationWizard = { dump("*** done\n"); if (this._autoMigrate) { // We're done now. - window.close(); + this._wiz.advance(); + setTimeout("close()", 5000); } else { var nextButton = this._wiz.getButton("next"); diff --git a/browser/components/migration/content/migration.xul b/browser/components/migration/content/migration.xul index 079af025c282..1dd0bb3c9ac6 100644 --- a/browser/components/migration/content/migration.xul +++ b/browser/components/migration/content/migration.xul @@ -71,6 +71,7 @@ #else + diff --git a/browser/components/migration/locale/migration.dtd b/browser/components/migration/locale/migration.dtd index cd06374d5fd1..f8d3ceda8527 100644 --- a/browser/components/migration/locale/migration.dtd +++ b/browser/components/migration/locale/migration.dtd @@ -5,6 +5,8 @@ + + diff --git a/browser/components/migration/locale/migration.properties b/browser/components/migration/locale/migration.properties index c130d7aa7b49..4cbb4205933f 100644 --- a/browser/components/migration/locale/migration.properties +++ b/browser/components/migration/locale/migration.properties @@ -30,35 +30,41 @@ importedOperaSearchUrls=Keyword Searches (From Opera) 1_opera=Preferences 1_dogbert=Preferences 1_seamonkey=Preferences +1_phoenix=Preferences 2_ie=Cookies 2_opera=Cookies 2_dogbert=Cookies 2_seamonkey=Cookies +2_phoenix=Cookies 4_ie=Browsing History 4_opera=Browsing History 4_dogbert=Browsing History 4_seamonkey=Browsing History +4_phoenix=Browsing History 8_ie=Saved Form History 8_opera=Saved Form History 8_dogbert=Saved Form History 8_seamonkey=Saved Form History +8_phoenix=Saved Form History 16_ie=Saved Passwords 16_opera=Saved Passwords 16_dogbert=Saved Passwords 16_seamonkey=Saved Passwords +16_phoenix=Saved Passwords 32_ie=Favorites 32_opera=Bookmarks 32_dogbert=Bookmarks 32_seamonkey=Bookmarks +32_phoenix=Bookmarks 64_ie=Other Data 64_opera=Other Data 64_dogbert=Other Data 64_seamonkey=Other Data - +64_phoenix=Other Data diff --git a/browser/components/migration/public/nsIBrowserProfileMigrator.idl b/browser/components/migration/public/nsIBrowserProfileMigrator.idl index 53faf5265d6f..c00c46fcd5de 100644 --- a/browser/components/migration/public/nsIBrowserProfileMigrator.idl +++ b/browser/components/migration/public/nsIBrowserProfileMigrator.idl @@ -44,14 +44,14 @@ interface nsIBrowserProfileMigrator : nsISupports /** * profile items to migrate. use with migrate(). */ - const unsigned long ALL = 0x0000; - const unsigned long SETTINGS = 0x0001; - const unsigned long COOKIES = 0x0002; - const unsigned long HISTORY = 0x0004; - const unsigned long FORMDATA = 0x0008; - const unsigned long PASSWORDS = 0x0010; - const unsigned long BOOKMARKS = 0x0020; - const unsigned long OTHERDATA = 0x0040; + const unsigned short ALL = 0x0000; + const unsigned short SETTINGS = 0x0001; + const unsigned short COOKIES = 0x0002; + const unsigned short HISTORY = 0x0004; + const unsigned short FORMDATA = 0x0008; + const unsigned short PASSWORDS = 0x0010; + const unsigned short BOOKMARKS = 0x0020; + const unsigned short OTHERDATA = 0x0040; /** * Copy user profile information to the current active profile. @@ -59,7 +59,7 @@ interface nsIBrowserProfileMigrator : nsISupports * @param aReplace replace or append current data where applicable. * @param aProfile profile to migrate from, if there is more than one. */ - void migrate(in unsigned long aItems, in boolean aReplace, in wstring aProfile); + void migrate(in unsigned short aItems, in boolean aReplace, in wstring aProfile); /** * A bit field containing profile items that this migrator @@ -70,7 +70,7 @@ interface nsIBrowserProfileMigrator : nsISupports * data mode (automigration, before profile has started) * @returns bit field containing profile items (see above) */ - unsigned long getMigrateData(in wstring aProfile, in boolean aReplace); + unsigned short getMigrateData(in wstring aProfile, in boolean aReplace); /** * Whether or not there is any data that can be imported from this diff --git a/browser/components/migration/src/nsCaminoProfileMigrator.cpp b/browser/components/migration/src/nsCaminoProfileMigrator.cpp index 331f164db55d..711f43cf337c 100644 --- a/browser/components/migration/src/nsCaminoProfileMigrator.cpp +++ b/browser/components/migration/src/nsCaminoProfileMigrator.cpp @@ -62,7 +62,7 @@ nsCaminoProfileMigrator::~nsCaminoProfileMigrator() // nsIBrowserProfileMigrator NS_IMETHODIMP -nsCaminoProfileMigrator::Migrate(PRUint32 aItems, PRBool aReplace, const PRUnichar* aProfile) +nsCaminoProfileMigrator::Migrate(PRUint16 aItems, PRBool aReplace, const PRUnichar* aProfile) { nsresult rv = NS_OK; @@ -76,7 +76,7 @@ nsCaminoProfileMigrator::Migrate(PRUint32 aItems, PRBool aReplace, const PRUnich NS_IMETHODIMP nsCaminoProfileMigrator::GetMigrateData(const PRUnichar* aProfile, PRBool aReplace, - PRUint32* aResult) + PRUint16* aResult) { *aResult = 0; // XXXben implement me return NS_OK; diff --git a/browser/components/migration/src/nsDogbertProfileMigrator.cpp b/browser/components/migration/src/nsDogbertProfileMigrator.cpp index d78866fdb9d5..cdc0910af755 100644 --- a/browser/components/migration/src/nsDogbertProfileMigrator.cpp +++ b/browser/components/migration/src/nsDogbertProfileMigrator.cpp @@ -106,7 +106,7 @@ nsDogbertProfileMigrator::~nsDogbertProfileMigrator() // nsIBrowserProfileMigrator NS_IMETHODIMP -nsDogbertProfileMigrator::Migrate(PRUint32 aItems, PRBool aReplace, const PRUnichar* aProfile) +nsDogbertProfileMigrator::Migrate(PRUint16 aItems, PRBool aReplace, const PRUnichar* aProfile) { nsresult rv = NS_OK; @@ -139,7 +139,7 @@ nsDogbertProfileMigrator::GetSourceProfile(const PRUnichar* aProfile) NS_IMETHODIMP nsDogbertProfileMigrator::GetMigrateData(const PRUnichar* aProfile, PRBool aReplace, - PRUint32* aResult) + PRUint16* aResult) { if (!mSourceProfile) GetSourceProfile(aProfile); diff --git a/browser/components/migration/src/nsICabProfileMigrator.cpp b/browser/components/migration/src/nsICabProfileMigrator.cpp index d9cb05c379c5..ba3695bae16a 100644 --- a/browser/components/migration/src/nsICabProfileMigrator.cpp +++ b/browser/components/migration/src/nsICabProfileMigrator.cpp @@ -62,7 +62,7 @@ nsICabProfileMigrator::~nsICabProfileMigrator() // nsIBrowserProfileMigrator NS_IMETHODIMP -nsICabProfileMigrator::Migrate(PRUint32 aItems, PRBool aReplace, const PRUnichar* aProfile) +nsICabProfileMigrator::Migrate(PRUint16 aItems, PRBool aReplace, const PRUnichar* aProfile) { nsresult rv = NS_OK; @@ -76,7 +76,7 @@ nsICabProfileMigrator::Migrate(PRUint32 aItems, PRBool aReplace, const PRUnichar NS_IMETHODIMP nsICabProfileMigrator::GetMigrateData(const PRUnichar* aProfile, PRBool aReplace, - PRUint32* aResult) + PRUint16* aResult) { *aResult = 0; // XXXben implement me return NS_OK; diff --git a/browser/components/migration/src/nsIEProfileMigrator.cpp b/browser/components/migration/src/nsIEProfileMigrator.cpp index e21adaca711e..e2e39e50d8bc 100644 --- a/browser/components/migration/src/nsIEProfileMigrator.cpp +++ b/browser/components/migration/src/nsIEProfileMigrator.cpp @@ -427,7 +427,7 @@ user_pref("font.size.variable.x-western", 15); /////////////////////////////////////////////////////////////////////////////// // nsIBrowserProfileMigrator NS_IMETHODIMP -nsIEProfileMigrator::Migrate(PRUint32 aItems, PRBool aReplace, const PRUnichar* aProfile) +nsIEProfileMigrator::Migrate(PRUint16 aItems, PRBool aReplace, const PRUnichar* aProfile) { nsresult rv = NS_OK; @@ -448,7 +448,7 @@ nsIEProfileMigrator::Migrate(PRUint32 aItems, PRBool aReplace, const PRUnichar* NS_IMETHODIMP nsIEProfileMigrator::GetMigrateData(const PRUnichar* aProfile, PRBool aReplace, - PRUint32* aResult) + PRUint16* aResult) { // There's no harm in assuming everything is available. *aResult = nsIBrowserProfileMigrator::SETTINGS | nsIBrowserProfileMigrator::COOKIES | diff --git a/browser/components/migration/src/nsMacIEProfileMigrator.cpp b/browser/components/migration/src/nsMacIEProfileMigrator.cpp index 7beceb350ac9..fc8c16ec70a9 100644 --- a/browser/components/migration/src/nsMacIEProfileMigrator.cpp +++ b/browser/components/migration/src/nsMacIEProfileMigrator.cpp @@ -62,7 +62,7 @@ nsMacIEProfileMigrator::~nsMacIEProfileMigrator() // nsIBrowserProfileMigrator NS_IMETHODIMP -nsMacIEProfileMigrator::Migrate(PRUint32 aItems, PRBool aReplace, const PRUnichar* aProfile) +nsMacIEProfileMigrator::Migrate(PRUint16 aItems, PRBool aReplace, const PRUnichar* aProfile) { nsresult rv = NS_OK; @@ -76,7 +76,7 @@ nsMacIEProfileMigrator::Migrate(PRUint32 aItems, PRBool aReplace, const PRUnicha NS_IMETHODIMP nsMacIEProfileMigrator::GetMigrateData(const PRUnichar* aProfile, PRBool aReplace, - PRUint32* aResult) + PRUint16* aResult) { *aResult = 0; // XXXben implement me return NS_OK; diff --git a/browser/components/migration/src/nsOmniWebProfileMigrator.cpp b/browser/components/migration/src/nsOmniWebProfileMigrator.cpp index 6bd1ae40a0d3..04e9bc1cd472 100644 --- a/browser/components/migration/src/nsOmniWebProfileMigrator.cpp +++ b/browser/components/migration/src/nsOmniWebProfileMigrator.cpp @@ -62,7 +62,7 @@ nsOmniWebProfileMigrator::~nsOmniWebProfileMigrator() // nsIBrowserProfileMigrator NS_IMETHODIMP -nsOmniWebProfileMigrator::Migrate(PRUint32 aItems, PRBool aReplace, const PRUnichar* aProfile) +nsOmniWebProfileMigrator::Migrate(PRUint16 aItems, PRBool aReplace, const PRUnichar* aProfile) { nsresult rv = NS_OK; @@ -76,7 +76,7 @@ nsOmniWebProfileMigrator::Migrate(PRUint32 aItems, PRBool aReplace, const PRUnic NS_IMETHODIMP nsOmniWebProfileMigrator::GetMigrateData(const PRUnichar* aProfile, PRBool aReplace, - PRUint32* aResult) + PRUint16* aResult) { *aResult = 0; // XXXben implement me return NS_OK; diff --git a/browser/components/migration/src/nsOperaProfileMigrator.cpp b/browser/components/migration/src/nsOperaProfileMigrator.cpp index 91b9512ae933..f58c3923f29b 100644 --- a/browser/components/migration/src/nsOperaProfileMigrator.cpp +++ b/browser/components/migration/src/nsOperaProfileMigrator.cpp @@ -104,7 +104,7 @@ nsOperaProfileMigrator::~nsOperaProfileMigrator() } NS_IMETHODIMP -nsOperaProfileMigrator::Migrate(PRUint32 aItems, PRBool aReplace, const PRUnichar* aProfile) +nsOperaProfileMigrator::Migrate(PRUint16 aItems, PRBool aReplace, const PRUnichar* aProfile) { nsresult rv = NS_OK; @@ -126,7 +126,7 @@ nsOperaProfileMigrator::Migrate(PRUint32 aItems, PRBool aReplace, const PRUnicha NS_IMETHODIMP nsOperaProfileMigrator::GetMigrateData(const PRUnichar* aProfile, PRBool aReplace, - PRUint32* aResult) + PRUint16* aResult) { if (!mOperaProfile) GetOperaProfile(aProfile, getter_AddRefs(mOperaProfile)); diff --git a/browser/components/migration/src/nsPhoenixProfileMigrator.cpp b/browser/components/migration/src/nsPhoenixProfileMigrator.cpp index 6afc25a0de46..06d49de87495 100644 --- a/browser/components/migration/src/nsPhoenixProfileMigrator.cpp +++ b/browser/components/migration/src/nsPhoenixProfileMigrator.cpp @@ -83,7 +83,7 @@ nsPhoenixProfileMigrator::~nsPhoenixProfileMigrator() // nsIBrowserProfileMigrator NS_IMETHODIMP -nsPhoenixProfileMigrator::Migrate(PRUint32 aItems, PRBool aReplace, const PRUnichar* aProfile) +nsPhoenixProfileMigrator::Migrate(PRUint16 aItems, PRBool aReplace, const PRUnichar* aProfile) { nsresult rv = NS_OK; @@ -125,7 +125,7 @@ nsPhoenixProfileMigrator::Migrate(PRUint32 aItems, PRBool aReplace, const PRUnic NS_IMETHODIMP nsPhoenixProfileMigrator::GetMigrateData(const PRUnichar* aProfile, PRBool aReplace, - PRUint32* aResult) + PRUint16* aResult) { if (!mSourceProfile) GetSourceProfile(aProfile); diff --git a/browser/components/migration/src/nsProfileMigrator.cpp b/browser/components/migration/src/nsProfileMigrator.cpp index 7129b291eb20..f9224643f928 100644 --- a/browser/components/migration/src/nsProfileMigrator.cpp +++ b/browser/components/migration/src/nsProfileMigrator.cpp @@ -69,13 +69,23 @@ nsProfileMigrator::Migrate() nsresult rv = NS_OK; if (mMigrator && mSourceKey) { - if (!needsActiveProfile) - rv = OpenMigrationWizard(); - else { - nsCOMPtr obs(do_GetService("@mozilla.org/observer-service;1")); - rv = obs->AddObserver(this, "browser-window-before-show", PR_FALSE); + PRBool sourceExists; + mMigrator->GetSourceExists(&sourceExists); + + if (sourceExists) { + if (!needsActiveProfile) + rv = OpenMigrationWizard(); + else { + nsCOMPtr obs(do_GetService("@mozilla.org/observer-service;1")); + rv = obs->AddObserver(this, "browser-window-before-show", PR_FALSE); + } } + else + rv = NS_ERROR_FILE_NOT_FOUND; // No data was found to import. } + else + rv = NS_ERROR_FILE_NOT_FOUND; // No migrator could be found. + return rv; } diff --git a/browser/components/migration/src/nsSafariProfileMigrator.cpp b/browser/components/migration/src/nsSafariProfileMigrator.cpp index d72e29bdec48..ac0d16bbbebb 100644 --- a/browser/components/migration/src/nsSafariProfileMigrator.cpp +++ b/browser/components/migration/src/nsSafariProfileMigrator.cpp @@ -77,7 +77,7 @@ nsSafariProfileMigrator::~nsSafariProfileMigrator() // nsIBrowserProfileMigrator NS_IMETHODIMP -nsSafariProfileMigrator::Migrate(PRUint32 aItems, PRBool aReplace, const PRUnichar* aProfile) +nsSafariProfileMigrator::Migrate(PRUint16 aItems, PRBool aReplace, const PRUnichar* aProfile) { nsresult rv = NS_OK; @@ -96,7 +96,7 @@ nsSafariProfileMigrator::Migrate(PRUint32 aItems, PRBool aReplace, const PRUnich NS_IMETHODIMP nsSafariProfileMigrator::GetMigrateData(const PRUnichar* aProfile, PRBool aReplace, - PRUint32* aResult) + PRUint16* aResult) { *aResult = 0; // XXXben implement me return NS_OK; diff --git a/browser/components/migration/src/nsSeamonkeyProfileMigrator.cpp b/browser/components/migration/src/nsSeamonkeyProfileMigrator.cpp index 65b0fc56e5db..faa05c82092a 100644 --- a/browser/components/migration/src/nsSeamonkeyProfileMigrator.cpp +++ b/browser/components/migration/src/nsSeamonkeyProfileMigrator.cpp @@ -84,7 +84,7 @@ nsSeamonkeyProfileMigrator::~nsSeamonkeyProfileMigrator() // nsIBrowserProfileMigrator NS_IMETHODIMP -nsSeamonkeyProfileMigrator::Migrate(PRUint32 aItems, PRBool aReplace, const PRUnichar* aProfile) +nsSeamonkeyProfileMigrator::Migrate(PRUint16 aItems, PRBool aReplace, const PRUnichar* aProfile) { nsresult rv = NS_OK; @@ -120,7 +120,7 @@ nsSeamonkeyProfileMigrator::Migrate(PRUint32 aItems, PRBool aReplace, const PRUn NS_IMETHODIMP nsSeamonkeyProfileMigrator::GetMigrateData(const PRUnichar* aProfile, PRBool aReplace, - PRUint32* aResult) + PRUint16* aResult) { if (!mSourceProfile) GetSourceProfile(aProfile);