Fixing bug 40316. Error message will be thrown to the user when migration of old profile with missing source directory is attempted. r=ccarlen, sr=sspitzer.

This commit is contained in:
racham%netscape.com 2001-05-07 07:55:03 +00:00
Родитель 55a1c4c2d0
Коммит 646504901e
3 изменённых файлов: 32 добавлений и 2 удалений

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

@ -56,14 +56,28 @@ function RenameProfile()
return;
var profileTree = document.getElementById( "profiles" );
var selected = profileTree.selectedItems[0];
var profilename = selected.getAttribute("profile_name");
if( selected.firstChild.firstChild.getAttribute("rowMigrate") == "no" ) {
// migrate if the user wants to
var lString = gProfileManagerBundle.getString("migratebeforerename");
lString = lString.replace(/\s*<html:br\/>/g,"\n");
lString = lString.replace(/%brandShortName%/, gBrandBundle.getString("brandShortName"));
var title = gProfileManagerBundle.getString("migratetitle");
if (promptService.confirm(window, title, lString))
if (promptService.confirm(window, title, lString)) {
var profileDir = profile.getProfileDir(profilename);
if (profileDir) {
profileDir = profileDir.QueryInterface( Components.interfaces.nsIFile );
if (profileDir) {
if (!profileDir.exists()) {
var errorMessage = gProfileManagerBundle.getString("sourceProfileDirMissing");
var profileDirMissingTitle = gProfileManagerBundle.getString("sourceProfileDirMissingTitle");
promptService.alert(window, profileDirMissingTitle, errorMessage);
return false;
}
}
}
profile.migrateProfile( profilename, true );
}
else
return false;
}

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

@ -174,8 +174,21 @@ function onStart()
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService();
promptService = promptService.QueryInterface(Components.interfaces.nsIPromptService);
if (promptService.confirm(window, title, lString))
if (promptService.confirm(window, title, lString)) {
var profileDir = profile.getProfileDir(profilename);
if (profileDir) {
profileDir = profileDir.QueryInterface( Components.interfaces.nsIFile );
if (profileDir) {
if (!profileDir.exists()) {
var errorMessage = gProfileManagerBundle.getString("sourceProfileDirMissing");
var profileDirMissingTitle = gProfileManagerBundle.getString("sourceProfileDirMissingTitle");
promptService.alert(window, profileDirMissingTitle, errorMessage);
return false;
}
}
}
profile.migrateProfile( profilename, true );
}
else
return false;
}

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

@ -28,3 +28,6 @@ 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
profDirMissing=%S cannot use the profile "%S" because the directory containing the profile cannot be found.<html:br/><html:br/> Please choose another profile or create a new one.
sourceProfileDirMissing=This profile cannot be migrated because the directory containing the profile information could not be found. Choose another profile or create a new one.
sourceProfileDirMissingTitle=Profile Directory Missing