Bug 68374, "xp filepicker should return an error if file doesn't exist". It will now popup a warning dialog. r=bryner, r=Pavlov, sr=blizzard.

This commit is contained in:
disttsc%bart.nl 2001-04-17 01:58:01 +00:00
parent 6166fc36ea
commit e643717fce
2 changed files with 15 additions and 4 deletions

View File

@ -209,6 +209,7 @@ function applyFilter()
function onOK()
{
var errorTitle, errorMessage, promptService;
var ret = nsIFilePicker.returnCancel;
var isDir = false;
@ -235,6 +236,13 @@ function onOK()
}
if (!file.exists() && (filePickerMode != nsIFilePicker.modeSave)) {
errorTitle = gFilePickerBundle.getFormattedString("errorOpenFileDoesntExistTitle",
[file.unicodePath]);
errorMessage = gFilePickerBundle.getFormattedString("errorOpenFileDoesntExistMessage",
[file.unicodePath]);
promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Components.interfaces.nsIPromptService);
promptService.alert(window, errorTitle, errorMessage);
return false;
}
@ -287,9 +295,8 @@ function onOK()
oldParent = parent;
parent = parent.parent;
}
var errorTitle = gFilePickerBundle.getFormattedString("errorSavingFileTitle",
[file.unicodePath]);
var errorMessage;
errorTitle = gFilePickerBundle.getFormattedString("errorSavingFileTitle",
[file.unicodePath]);
if (parent.isFile()) {
errorMessage = gFilePickerBundle.getFormattedString("saveParentIsFileMessage",
[parent.unicodePath, file.unicodePath]);
@ -297,7 +304,8 @@ function onOK()
errorMessage = gFilePickerBundle.getFormattedString("saveParentDoesntExistMessage",
[oldParent.unicodePath, file.unicodePath]);
}
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService);
promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Components.interfaces.nsIPromptService);
promptService.alert(window, errorTitle, errorMessage);
ret = nsIFilePicker.returnCancel;
}

View File

@ -18,6 +18,9 @@ openButtonLabel=Open
saveButtonLabel=Save
selectFolderButtonLabel=Select
errorOpenFileDoesntExistTitle=Error opening %S
errorOpenFileDoesntExistMessage=File %S doesn't exist
errorSavingFileTitle=Error saving %S
saveParentIsFileMessage=%S is a file, can't save %S
saveParentDoesntExistMessage=Path %S doesn't exist, can't save %S