Bug 295683: File > Import dialog should not be blank if no migration source could be found, r=mconnor

This commit is contained in:
gavin%gavinsharp.com 2006-05-31 01:03:03 +00:00
Родитель f1c4773096
Коммит c322a60166
3 изменённых файлов: 32 добавлений и 25 удалений

Просмотреть файл

@ -49,7 +49,8 @@ var MigrationWizard = {
init: function ()
{
var os = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
var os = Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService);
os.addObserver(this, "Migration:Started", false);
os.addObserver(this, "Migration:ItemBeforeMigrate", false);
os.addObserver(this, "Migration:ItemAfterMigrate", false);
@ -75,7 +76,8 @@ var MigrationWizard = {
uninit: function ()
{
var os = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
var os = Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService);
os.removeObserver(this, "Migration:Started");
os.removeObserver(this, "Migration:ItemBeforeMigrate");
os.removeObserver(this, "Migration:ItemAfterMigrate");
@ -86,12 +88,9 @@ var MigrationWizard = {
onImportSourcePageShow: function ()
{
//XXXquark This function is called before init, so check for bookmarks here
if("arguments" in window && window.arguments[0] == "bookmarks")
{
if ("arguments" in window && window.arguments[0] == "bookmarks") {
this._bookmarks = true;
}
if(this._bookmarks) {
var fromfile = document.getElementById("fromfile");
fromfile.hidden = false;
@ -103,7 +102,10 @@ var MigrationWizard = {
}
this._wiz.canRewind = false;
// The migrator to select
var selectedMigrator = null;
// Figure out what source apps are are available to import from:
var group = document.getElementById("importSourceGroup");
for (var i = 0; i < group.childNodes.length; ++i) {
@ -117,29 +119,31 @@ var MigrationWizard = {
dump("*** invalid contractID =" + contractID + "\n");
return;
}
if (!migrator.sourceExists || (suffix == "phoenix" && !this._autoMigrate))
if (migrator.sourceExists &&
!(suffix == "phoenix" && !this._autoMigrate)) {
// Save this as the first selectable item, if we don't already have
// one, or if it is the migrator that was passed to us.
if (!selectedMigrator || this._source == suffix)
selectedMigrator = group.childNodes[i];
} else {
// Hide this option
group.childNodes[i].hidden = true;
}
}
var firstSelectable = null;
for (var i = 0; i < group.childNodes.length; ++i) {
if (!group.childNodes[i].disabled && !group.childNodes[i].hidden) {
firstSelectable = group.childNodes[i];
break;
}
}
}
if (this._source) {
// Somehow the Profile Migrator got confused, and gave us a migrate source
// that doesn't actually exist. This could be because of a bogus registry
// state. Set the _source property to null so the first visible item in
// the list is selected instead.
var source = document.getElementById(this._source);
if (source.hidden)
this._source = null;
if (selectedMigrator)
group.selectedItem = selectedMigrator;
else {
// We didn't find a migrator, notify the user
document.getElementById("noSources").hidden = false;
this._wiz.canAdvance = false;
document.getElementById("importBookmarks").hidden = true;
document.getElementById("importAll").hidden = true;
}
group.selectedItem = !this._source ? firstSelectable : document.getElementById(this._source);
},
onImportSourcePageAdvanced: function ()

Просмотреть файл

@ -107,6 +107,7 @@
<radio id="fromfile" label="&importFromFile.label;" accesskey="&importFromFile.accesskey;" hidden="true"/>
<radio id="nothing" label="&importFromNothing.label;" accesskey="&importFromNothing.accesskey;" hidden="true"/>
</radiogroup>
<label id="noSources" hidden="true">&noMigrationSources.label;</label>
</wizardpage>
<wizardpage id="selectProfile" pageid="selectProfile" label="&selectProfile.title;"

Просмотреть файл

@ -34,6 +34,8 @@
<!ENTITY importFromFile.label "From File">
<!ENTITY importFromFile.accesskey "F">
<!ENTITY noMigrationSources.label "No programs that contain bookmarks, history or password data could be found.">
<!ENTITY importSource.title "Import Settings and Data From">
<!ENTITY importItems.title "Items to Import">
<!ENTITY importItems.label "Select which items to import:">