From 980c3e2f5fc2069f5344aa193aa36258ac4863e8 Mon Sep 17 00:00:00 2001 From: "ben%bengoodger.com" Date: Wed, 29 Sep 2004 19:08:36 +0000 Subject: [PATCH] 249302 - firefox offers to migrate a non-existent Phoenix Firebird Firefox profile, round 2: also, make sure the wizard's first page's onpageshow handler is not called before onload, guard against showing phoenix item in list in non-automigrate cases too. git-svn-id: svn://10.0.0.236/trunk@162964 18797224-902f-48f8-a5cc-f745e15eee43 --- .../components/migration/content/migration.js | 57 +++++++++++++------ .../migration/content/migration.xul | 9 +-- 2 files changed, 44 insertions(+), 22 deletions(-) diff --git a/mozilla/browser/components/migration/content/migration.js b/mozilla/browser/components/migration/content/migration.js index 2550848c968..4b62967fcae 100644 --- a/mozilla/browser/components/migration/content/migration.js +++ b/mozilla/browser/components/migration/content/migration.js @@ -9,6 +9,7 @@ var MigrationWizard = { _wiz: null, _migrator: null, _autoMigrate: null, + _bookmarks: false, init: function () { @@ -20,18 +21,18 @@ var MigrationWizard = { this._wiz = document.documentElement; - if ("arguments" in window) { + if ("arguments" in window && window.arguments.length > 1) { this._source = window.arguments[0]; - this._autoMigrate = window.arguments[1].QueryInterface(kIPStartup); + this._migrator = window.arguments[1].QueryInterface(kIMig); + this._autoMigrate = window.arguments[2].QueryInterface(kIPStartup); // Show the "nothing" option in the automigrate case to provide an // easily identifiable way to avoid migration and create a new profile. var nothing = document.getElementById("nothing"); nothing.hidden = false; - - var phoenix = document.getElementById("phoenix"); - phoenix.hidden = false; } + + this.onImportSourcePageShow(); }, uninit: function () @@ -46,6 +47,23 @@ var MigrationWizard = { // 1 - Import Source onImportSourcePageShow: function () { + //XXXquark This function is called before init, so check for bookmarks here + if("arguments" in window && window.arguments[0] == "bookmarks") + { + this._bookmarks = true; + } + + if(this._bookmarks) { + var fromfile = document.getElementById("fromfile"); + fromfile.hidden = false; + + var importBookmarks = document.getElementById("importBookmarks"); + importBookmarks.hidden = false; + + var importAll = document.getElementById("importAll"); + importAll.hidden = true; + } + document.documentElement.getButton("back").disabled = true; // Figure out what source apps are are available to import from: @@ -58,33 +76,32 @@ var MigrationWizard = { var migrator = Components.classes[contractID].createInstance(kIMig); } catch (e) { - dump("*** eeee!!! contractID =" + contractID + "\n"); + dump("*** invalid contractID =" + contractID + "\n"); return; } - - if (!migrator.sourceExists) { + if (!migrator.sourceExists || (suffix == "phoenix" && !this._autoMigrate)) group.childNodes[i].hidden = true; - if (this._source == suffix) this._source = null; - } } } - var firstNonDisabled = null; + var firstSelectable = null; for (var i = 0; i < group.childNodes.length; ++i) { - if (!group.childNodes[i].disabled) { - firstNonDisabled = group.childNodes[i]; + if (!group.childNodes[i].disabled && !group.childNodes[i].hidden) { + firstSelectable = group.childNodes[i]; break; } } - group.selectedItem = this._source == "" ? firstNonDisabled : document.getElementById(this._source); + group.selectedItem = !this._source ? firstSelectable : document.getElementById(this._source); }, onImportSourcePageAdvanced: function () { var newSource = document.getElementById("importSourceGroup").selectedItem.id; - if (newSource == "nothing") { + if (newSource == "nothing" || newSource == "fromfile") { + if(newSource == "fromfile") + window.opener.fromFile = true; document.documentElement.cancel(); return; } @@ -104,7 +121,7 @@ var MigrationWizard = { if (this._migrator.sourceHasMultipleProfiles) this._wiz.currentPage.next = "selectProfile"; else { - this._wiz.currentPage.next = this._autoMigrate ? "migrating" : "importItems"; + this._wiz.currentPage.next = (this._autoMigrate || this._bookmarks) ? "migrating" : "importItems"; var sourceProfiles = this._migrator.sourceProfiles; if (sourceProfiles && sourceProfiles.Count() == 1) { var profileName = sourceProfiles.QueryElementAt(0, Components.interfaces.nsISupportsString); @@ -151,8 +168,8 @@ var MigrationWizard = { var profiles = document.getElementById("profiles"); this._selectedProfile = profiles.selectedItem.id; - // If we're automigrating, don't show the item selection page, just grab everything. - if (this._autoMigrate) + // If we're automigrating or just doing bookmarks don't show the item selection page + if (this._autoMigrate || this._bookmarks) this._wiz.currentPage.next = "migrating"; }, @@ -217,6 +234,10 @@ var MigrationWizard = { if (this._autoMigrate) this._itemsFlags = this._migrator.getMigrateData(this._selectedProfile, this._autoMigrate); + // When importing bookmarks, show only bookmarks + if (this._bookmarks) + this._itemsFlags = 32; + this._listItems("migratingItems"); setTimeout(this.onMigratingMigrate, 0, this); }, diff --git a/mozilla/browser/components/migration/content/migration.xul b/mozilla/browser/components/migration/content/migration.xul index 4cf6be11cd9..4f0a89363e0 100644 --- a/mozilla/browser/components/migration/content/migration.xul +++ b/mozilla/browser/components/migration/content/migration.xul @@ -53,16 +53,16 @@ #ifdef XP_WIN - &importFrom.label; + &importFrom.label; #else - &importFromUnix.label; + &importFromUnix.label; #endif + -