зеркало из https://github.com/mozilla/pjs.git
fix for b28186, rename to existing profile does not re-prompt for correct profile name
This commit is contained in:
Родитель
4ee95726ba
Коммит
6fe6fc6ad0
|
@ -68,37 +68,39 @@ function RenameProfile()
|
||||||
var result = { };
|
var result = { };
|
||||||
var dialogTitle = bundle.GetStringFromName("renameprofiletitle");
|
var dialogTitle = bundle.GetStringFromName("renameprofiletitle");
|
||||||
var msg = bundle.GetStringFromName("renameprofilepromptA") + oldName + bundle.GetStringFromName("renameprofilepromptB");
|
var msg = bundle.GetStringFromName("renameprofilepromptA") + oldName + bundle.GetStringFromName("renameprofilepromptB");
|
||||||
if (commonDialogService.Prompt(window, dialogTitle, msg, oldName, result)) {
|
while (1) {
|
||||||
var newName = result.value;
|
var rv = commonDialogService.Prompt(window, dialogTitle, msg, oldName, result);
|
||||||
dump("*** newName = |" + newName + "|\n");
|
if (rv) {
|
||||||
if (!newName)
|
var newName = result.value;
|
||||||
return false;
|
if (!newName) return false;
|
||||||
var invalidChars = ["/", "\\", "*", ":"];
|
var invalidChars = ["/", "\\", "*", ":"];
|
||||||
for( var i = 0; i < invalidChars.length; i++ )
|
for( var i = 0; i < invalidChars.length; i++ )
|
||||||
{
|
{
|
||||||
if( newName.indexOf( invalidChars[i] ) != -1 ) {
|
if( newName.indexOf( invalidChars[i] ) != -1 ) {
|
||||||
var aString = bundle.GetStringFromName("invalidCharA");
|
var aString = bundle.GetStringFromName("invalidCharA");
|
||||||
var bString = bundle.GetStringFromName("invalidCharB");
|
var bString = bundle.GetStringFromName("invalidCharB");
|
||||||
bString = bString.replace(/\s*<html:br\/>/g,"\n");
|
bString = bString.replace(/\s*<html:br\/>/g,"\n");
|
||||||
var lString = aString + invalidChars[i] + bString;
|
var lString = aString + invalidChars[i] + bString;
|
||||||
alert( lString );
|
alert( lString );
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var migrate = selected.firstChild.firstChild.getAttribute("rowMigrate");
|
||||||
|
try {
|
||||||
|
profile.renameProfile(oldName, newName);
|
||||||
|
selected.firstChild.firstChild.setAttribute( "value", newName );
|
||||||
|
selected.setAttribute( "rowName", newName );
|
||||||
|
selected.setAttribute( "profile_name", newName );
|
||||||
|
}
|
||||||
|
catch(e) {
|
||||||
|
var lString = bundle.GetStringFromName("profileExists");
|
||||||
|
var profileExistsTitle = bundle.GetStringFromName("profileExistsTitle");
|
||||||
|
commonDialogService.Alert(window, profileExistsTitle, lString);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
var migrate = selected.firstChild.firstChild.getAttribute("rowMigrate");
|
|
||||||
dump("*** oldName = "+ oldName+ ", newName = "+ newName+ ", migrate = "+ migrate+ "\n");
|
|
||||||
try {
|
|
||||||
profile.renameProfile(oldName, newName);
|
|
||||||
selected.firstChild.firstChild.setAttribute( "value", newName );
|
|
||||||
selected.setAttribute( "rowName", newName );
|
|
||||||
selected.setAttribute( "profile_name", newName );
|
|
||||||
}
|
|
||||||
catch(e) {
|
|
||||||
var lString = bundle.GetStringFromName("profileExists");
|
|
||||||
var profileExistsTitle = bundle.GetStringFromName("profileExistsTitle");
|
|
||||||
commonDialogService.Alert(window, profileExistsTitle, lString);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// set the button state
|
// set the button state
|
||||||
|
|
Загрузка…
Ссылка в новой задаче