fix for 39423, rename profile (and other profile manager common dialogs) do not work.

This commit is contained in:
ben%netscape.com 2000-06-06 07:26:36 +00:00
Родитель 75da35e2a6
Коммит 33e0d1eb26
4 изменённых файлов: 38 добавлений и 41 удалений

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

@ -22,6 +22,8 @@
* Ben Goodger <ben@netscape.com>
*/
var commonDialogService = nsJSComponentManager.getService("component://netscape/appshell/commonDialogs",
"nsICommonDialogs");
var bundle = srGetStrBundle("chrome://communicator/locale/profile/profileManager.properties");
var profileManagerMode = "selection";
var set = null;
@ -50,30 +52,26 @@ function RenameProfile()
if( renameButton.getAttribute("disabled") == "true" )
return;
var profileTree = document.getElementById( "profiles" );
if( !profileTree.selectedItems.length ) {
alert( bundle.GetStringFromName("noneselectedrename") );
return;
}
else if( profileTree.selectedItems.length != 1 ) {
alert( bundle.GetStringFromName("wrongnumberselectedrename") );
return;
}
else {
var selected = profileTree.selectedItems[0];
if( selected.firstChild.firstChild.getAttribute("rowMigrate") == "no" ) {
// migrate if the user wants to
var lString = bundle.GetStringFromName("migratebeforerename");
lString = lString.replace(/\s*<html:br\/>/g,"\n");
if( confirm( lString ) )
var title = bundle.GetStringFromName("migratetitle");
if (commonDialogService.Confirm(window, title, lString))
profile.migrateProfile( profilename, true );
else
return false;
}
else {
var oldName = selected.getAttribute("rowName");
var newName = prompt( bundle.GetStringFromName("renameprofilepromptA") + oldName + bundle.GetStringFromName("renameprofilepromptB"), oldName );
var result = { };
var dialogTitle = bundle.GetStringFromName("renameprofiletitle");
var msg = bundle.GetStringFromName("renameprofilepromptA") + oldName + bundle.GetStringFromName("renameprofilepromptB");
if (commonDialogService.Prompt(window, dialogTitle, msg, oldName, result)) {
var newName = result.value;
dump("*** newName = |" + newName + "|\n");
if( newName == "" || !newName )
if (!newName)
return false;
var invalidChars = ["/", "\\", "*", ":"];
for( var i = 0; i < invalidChars.length; i++ )
@ -98,7 +96,8 @@ function RenameProfile()
}
catch(e) {
var lString = bundle.GetStringFromName("profileExists");
alert( lString );
var profileExistsTitle = bundle.GetStringFromName("profileExistsTitle");
commonDialogService.Alert(window, profileExistsTitle, lString);
}
}
}
@ -113,14 +112,6 @@ function ConfirmDelete()
if( deleteButton.getAttribute("disabled") == "true" )
return;
var profileTree = document.getElementById( "profiles" );
if( !profileTree.selectedItems.length ) {
alert( bundle.GetStringFromName( "noneselecteddelete" ) );
return;
}
else if( profileTree.selectedItems.length != 1 ) {
alert( bundle.GetStringFromName("wrongnumberselectedrename") );
return;
}
var selected = profileTree.selectedItems[0];
var name = selected.getAttribute("rowName");
@ -129,7 +120,8 @@ function ConfirmDelete()
// auto migrate if the user wants to. THIS IS REALLY REALLY DUMB PLEASE FIX THE BACK END.
var lString = bundle.GetStringFromName("migratebeforedelete");
lString = lString.replace(/\s*<html:br\/>/g,"\n");
if( confirm( lString ) )
var title = bundle.GetStringFromName("deletetitle");
if (commonDialogService.Confirm(window, title, lString))
profile.migrateProfile( profilename, true );
else
return false;
@ -164,7 +156,9 @@ function DeleteProfile( deleteFiles )
function ConfirmMigrateAll()
{
if( confirm( bundle.GetStringFromName("migrateallprofiles") ) )
var string = bundle.GetStringFromName("migrateallprofiles");
var title = bundle.GetStringFromName("migrateallprofilestitle");
if (commonDialogService.Confirm(window, title, string))
return true;
else
return false;

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

@ -155,7 +155,8 @@ function onStart()
if( selected.firstChild.firstChild.getAttribute("rowMigrate") == "no" ) {
var lString = bundle.GetStringFromName("migratebeforestart");
lString = lString.replace(/\s*<html:br\/>/g,"\n");
if( confirm( lString ) )
var title = bundle.GetStringFromName("migratetitle");
if (commonDialogService.Confirm(window, title, lString))
profile.migrateProfile( profilename, true );
else
return false;
@ -174,9 +175,9 @@ function onStart()
ExitApp();
}
catch (ex) {
var stringA = bundle.GetStringFromName(failProfileStartA);
var stringB = bundle.GetStringFromName(failProfileStartB);
alert(stringA + " " + profilename + " " + stringB);
//var stringA = bundle.GetStringFromName(failProfileStartA);
//var stringB = bundle.GetStringFromName(failProfileStartB);
//alert(stringA + " " + profilename + " " + stringB);
}
}

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

@ -1,15 +1,16 @@
noneselectedrename=You must select a profile to rename.
wrongnumberselectedrename=You can only rename one profile at a time. Please select only one profile and try again.
migratebeforerename=The profile you selected was created with a previous version of Communicator and must be copied and converted to a Mozilla profile before it can be renamed. <html:br/><html:br/> Do you want to convert this profile now?<html:br/><html:br/>
migratebeforedelete=The profile you selected was created with a previous version of Communicator and must be copied and converted to a Mozilla profile before it can be deleted. <html:br/><html:br/> Do you want to convert this profile now?<html:br/><html:br/>Its really really stupid to enforce this. Please let us not require someone to migrate a profile before deleting it! --Ben.<html:br/><html:br/>
migratebeforestart=The profile you selected was created with a previous version of Communicator and must be copied and converted before you can use it with Mozilla.<html:br/><html:br/>Your original 4.x profile will not be altered.<html:br/><html:br/>Choose OK to copy and convert the profile.
migratetitle=Migrate Profile
migrateallprofilestitle=Migrate All Profiles
renamefailed=Sorry, Mozilla has failed to rename the profile you have selected.<html:br/><html:br/>Resolution:<html:br/>1) Restart Mozilla and try again. <html:br/>2) Close other applications or restart your computer.<html:br/>3) Check to ensure the profile files are not damaged.<html:br/><html:br/>
renameprofilepromptA=Rename the profile "
renameprofilepromptB=" to:
renameprofiletitle=Rename Profile
noneselecteddelete=You must select a profile to delete.
deletefailed=Sorry, Mozilla has failed to delete the profile you have selected.<html:br/><html:br/>Resolution:<html:br/>1) Restart Mozilla and try again. <html:br/>2) Close other applications or restart your computer.<html:br/>3) Check to ensure the profile files are not damaged.<html:br/><html:br/>
deletetitle=Delete Profile
pm_title=Manage User Profiles
ps_title=Select User Profile
@ -28,3 +29,4 @@ invalidCharA=You cannot create or rename a profile to a name containing the char
invalidCharB="<html:br/><html:br/>Please choose a different name for the profile.
profileExists=A profile with this name already exists. Please choose another name.
profileExistsTitle=Profile Exists