зеркало из https://github.com/mozilla/pjs.git
Bug 87904 - Show the profile dir path when confirming profile deletion. r=racham/sr=blake
This commit is contained in:
Родитель
0965e834dc
Коммит
49e3ea9ec6
|
@ -65,8 +65,18 @@ interface nsIProfileInternal : nsIProfile {
|
||||||
void migrateProfile(in wstring profileName, in boolean showProgressAsModalWindow);
|
void migrateProfile(in wstring profileName, in boolean showProgressAsModalWindow);
|
||||||
void forgetCurrentProfile();
|
void forgetCurrentProfile();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the actual profile directory
|
||||||
|
*/
|
||||||
nsIFile getProfileDir(in wstring profileName);
|
nsIFile getProfileDir(in wstring profileName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the path to a profile which can be shown to the user.
|
||||||
|
* If the actual profile directory is salted, returns the unsalted parent.
|
||||||
|
* This is the directory which will be deleted by deleteProfile(name, true).
|
||||||
|
*/
|
||||||
|
wstring getProfilePath(in wstring profileName);
|
||||||
|
|
||||||
attribute boolean automigrate;
|
attribute boolean automigrate;
|
||||||
readonly attribute nsIFile defaultProfileParentDir;
|
readonly attribute nsIFile defaultProfileParentDir;
|
||||||
readonly attribute wstring firstProfile;
|
readonly attribute wstring firstProfile;
|
||||||
|
|
|
@ -136,23 +136,37 @@ function ConfirmDelete()
|
||||||
|
|
||||||
var selected = profileTree.selectedItems[0];
|
var selected = profileTree.selectedItems[0];
|
||||||
var name = selected.getAttribute("rowName");
|
var name = selected.getAttribute("rowName");
|
||||||
|
|
||||||
|
var dialogTitle = gProfileManagerBundle.getString("deletetitle");
|
||||||
|
var dialogText;
|
||||||
|
|
||||||
if( selected.firstChild.firstChild.getAttribute("rowMigrate") == "no" ) {
|
if( selected.firstChild.firstChild.getAttribute("rowMigrate") == "no" ) {
|
||||||
// auto migrate if the user wants to. THIS IS REALLY REALLY DUMB PLEASE FIX THE BACK END.
|
var brandName = gBrandBundle.getString("brandShortName");
|
||||||
var lString = gProfileManagerBundle.getString("migratebeforedelete");
|
dialogText = gProfileManagerBundle.getFormattedString("delete4xprofile", [brandName]);
|
||||||
lString = lString.replace(/\s*<html:br\/>/g,"\n");
|
dialogText = dialogText.replace(/\s*<html:br\/>/g,"\n");
|
||||||
lString = lString.replace(/%brandShortName%/, gBrandBundle.getString("brandShortName"));
|
|
||||||
var title = gProfileManagerBundle.getString("deletetitle");
|
if (promptService.confirm(window, dialogTitle, dialogText)) {
|
||||||
if (promptService.confirm(window, title, lString)) {
|
|
||||||
profile.deleteProfile( name, false );
|
profile.deleteProfile( name, false );
|
||||||
var profileKids = document.getElementById( "profilekids" )
|
var profileKids = document.getElementById( "profilekids" )
|
||||||
profileKids.removeChild( selected );
|
profileKids.removeChild( selected );
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
var win = window.openDialog('chrome://communicator/content/profile/deleteProfile.xul', 'Deleter', 'chrome,centerscreen,modal=yes,titlebar=yes');
|
var path = profile.getProfilePath(name);
|
||||||
return win;
|
dialogText = gProfileManagerBundle.getFormattedString("deleteprofile", [path]);
|
||||||
|
dialogText = dialogText.replace(/\s*<html:br\/>/g,"\n");
|
||||||
|
var buttonPressed = {value:0}
|
||||||
|
promptService.confirmEx(window, dialogTitle, dialogText,
|
||||||
|
(promptService.BUTTON_TITLE_IS_STRING * promptService.BUTTON_POS_0) +
|
||||||
|
(promptService.BUTTON_TITLE_IS_STRING * promptService.BUTTON_POS_1) +
|
||||||
|
(promptService.BUTTON_TITLE_CANCEL * promptService.BUTTON_POS_2),
|
||||||
|
gProfileManagerBundle.getString("dontDeleteFiles"),
|
||||||
|
gProfileManagerBundle.getString("deleteFiles"),
|
||||||
|
null, null, {value:0}, buttonPressed);
|
||||||
|
if (buttonPressed.value != 2)
|
||||||
|
DeleteProfile(buttonPressed.value == 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete the profile, with the delete flag set as per instruction above.
|
// Delete the profile, with the delete flag set as per instruction above.
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
# LOCALIZATION NOTE: Do not translate <html:br/>
|
# LOCALIZATION NOTE: Do not translate <html:br/>
|
||||||
migratebeforerename=The profile you selected was created with a previous version of Netscape and must be copied and converted to a %brandShortName% profile before it can be renamed.<html:br/><html:br/> Do you want to convert this profile?<html:br/><html:br/>
|
migratebeforerename=The profile you selected was created with a previous version of Netscape and must be copied and converted to a %brandShortName% profile before it can be renamed.<html:br/><html:br/> Do you want to convert this profile?<html:br/><html:br/>
|
||||||
migratebeforedelete=The profile you selected was created with a previous version of Netscape. %brandShortName% can remove this profile from the list of profiles that it maintains but you must remove it from your system using the version of Netscape that created it, or by hand.<html:br/><html:br/> Do you want to remove this profile from the list of profiles?<html:br/><html:br/>
|
|
||||||
migratebeforestart=The profile you selected was created with a previous version of Netscape and must be copied and converted before you can use it with %brandShortName%.<html:br/><html:br/> Your original 4.x profile will not be altered. <html:br/><html:br/> Do you want to copy and convert this profile?
|
migratebeforestart=The profile you selected was created with a previous version of Netscape and must be copied and converted before you can use it with %brandShortName%.<html:br/><html:br/> Your original 4.x profile will not be altered. <html:br/><html:br/> Do you want to copy and convert this profile?
|
||||||
migratetitle=Migrate Profile
|
migratetitle=Migrate Profile
|
||||||
migrateallprofilestitle=Migrate All Profiles
|
migrateallprofilestitle=Migrate All Profiles
|
||||||
|
@ -8,6 +7,10 @@ renameProfilePrompt=Rename the profile "%oldProfileName%" to:
|
||||||
renameprofiletitle=Rename Profile
|
renameprofiletitle=Rename Profile
|
||||||
|
|
||||||
deletetitle=Delete Profile
|
deletetitle=Delete Profile
|
||||||
|
delete4xprofile=The profile you selected was created with a previous version of Netscape. %S can remove this profile from the list of profiles that it maintains but you must remove it from your system using the version of Netscape that created it, or by hand.<html:br/><html:br/> Do you want to remove this profile from the list of profiles?<html:br/><html:br/>
|
||||||
|
deleteprofile=Deleting a profile will remove the profile from the list of available profiles and cannot be undone.<html:br/>You may also choose to delete the profile data files, including your saved mail, settings, and certificates. This option will delete the folder "%S" and cannot be undone.<html:br/><html:br/>Would you like to delete the profile data files?
|
||||||
|
deleteFiles=Delete Files
|
||||||
|
dontDeleteFiles=Don't Delete Files
|
||||||
|
|
||||||
pm_title=Manage User Profiles
|
pm_title=Manage User Profiles
|
||||||
ps_title=Select User Profile
|
ps_title=Select User Profile
|
||||||
|
@ -18,8 +21,6 @@ ps_button=Manage Profiles...
|
||||||
startButton=Start %brandShortName%
|
startButton=Start %brandShortName%
|
||||||
exitButton=Exit
|
exitButton=Exit
|
||||||
|
|
||||||
deleteFiles=Delete Files
|
|
||||||
dontDeleteFiles=Don't Delete Files
|
|
||||||
cancel=Cancel
|
cancel=Cancel
|
||||||
|
|
||||||
invalidCharA=You cannot create or rename a profile to a name containing the character: "
|
invalidCharA=You cannot create or rename a profile to a name containing the character: "
|
||||||
|
|
|
@ -917,6 +917,28 @@ NS_IMETHODIMP nsProfile::GetProfileDir(const PRUnichar *profileName, nsIFile **p
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP nsProfile::GetProfilePath(const PRUnichar *profileName, PRUnichar **_retval)
|
||||||
|
{
|
||||||
|
NS_ENSURE_ARG(profileName);
|
||||||
|
NS_ENSURE_ARG_POINTER(_retval);
|
||||||
|
*_retval = nsnull;
|
||||||
|
|
||||||
|
nsCOMPtr<nsIFile> profileDir;
|
||||||
|
nsresult rv = GetProfileDir(profileName, getter_AddRefs(profileDir));
|
||||||
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
|
PRBool isSalted;
|
||||||
|
nsCOMPtr<nsIFile> prettyDir(profileDir);
|
||||||
|
rv = IsProfileDirSalted(profileDir, &isSalted);
|
||||||
|
if (NS_SUCCEEDED(rv) && isSalted) {
|
||||||
|
nsCOMPtr<nsIFile> parentDir;
|
||||||
|
rv = profileDir->GetParent(getter_AddRefs(parentDir));
|
||||||
|
if (NS_SUCCEEDED(rv))
|
||||||
|
prettyDir = parentDir;
|
||||||
|
}
|
||||||
|
return prettyDir->GetUnicodePath(_retval);
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsProfile::GetDefaultProfileParentDir(nsIFile **aDefaultProfileParentDir)
|
NS_IMETHODIMP nsProfile::GetDefaultProfileParentDir(nsIFile **aDefaultProfileParentDir)
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aDefaultProfileParentDir);
|
NS_ENSURE_ARG_POINTER(aDefaultProfileParentDir);
|
||||||
|
@ -1222,7 +1244,7 @@ nsProfile::AddLevelOfIndirection(nsIFile *aDir)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsProfile::ShouldDeleteProfileParentDir(nsIFile *profileDir, PRBool *isSalted)
|
nsresult nsProfile::IsProfileDirSalted(nsIFile *profileDir, PRBool *isSalted)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
NS_ENSURE_ARG_POINTER(isSalted);
|
NS_ENSURE_ARG_POINTER(isSalted);
|
||||||
|
@ -1660,12 +1682,12 @@ NS_IMETHODIMP nsProfile::DeleteProfile(const PRUnichar* profileName, PRBool canD
|
||||||
if (exists) {
|
if (exists) {
|
||||||
|
|
||||||
// The profile dir may be located inside a salted dir.
|
// The profile dir may be located inside a salted dir.
|
||||||
// If so, according to ShouldDeleteProfileParentDir,
|
// If so, according to IsProfileDirSalted,
|
||||||
// delete the parent dir as well.
|
// delete the parent dir as well.
|
||||||
|
|
||||||
nsCOMPtr<nsIFile> dirToDelete(profileDir);
|
nsCOMPtr<nsIFile> dirToDelete(profileDir);
|
||||||
PRBool isSalted;
|
PRBool isSalted;
|
||||||
rv = ShouldDeleteProfileParentDir(profileDir, &isSalted);
|
rv = IsProfileDirSalted(profileDir, &isSalted);
|
||||||
if (NS_SUCCEEDED(rv) && isSalted) {
|
if (NS_SUCCEEDED(rv) && isSalted) {
|
||||||
nsCOMPtr<nsIFile> parentDir;
|
nsCOMPtr<nsIFile> parentDir;
|
||||||
rv = profileDir->GetParent(getter_AddRefs(parentDir));
|
rv = profileDir->GetParent(getter_AddRefs(parentDir));
|
||||||
|
|
|
@ -64,7 +64,7 @@ private:
|
||||||
|
|
||||||
nsresult CloneProfileDirectorySpec(nsILocalFile **aLocalFile);
|
nsresult CloneProfileDirectorySpec(nsILocalFile **aLocalFile);
|
||||||
nsresult AddLevelOfIndirection(nsIFile *aDir);
|
nsresult AddLevelOfIndirection(nsIFile *aDir);
|
||||||
nsresult ShouldDeleteProfileParentDir(nsIFile *profileDir, PRBool *isSalted);
|
nsresult IsProfileDirSalted(nsIFile *profileDir, PRBool *isSalted);
|
||||||
nsresult DefineLocaleDefaultsDir();
|
nsresult DefineLocaleDefaultsDir();
|
||||||
nsresult UndefineFileLocations();
|
nsresult UndefineFileLocations();
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче