mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-04 13:07:52 +00:00
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:
parent
6166fc36ea
commit
e643717fce
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user