diff --git a/xpfe/components/filepicker/res/content/filepicker.js b/xpfe/components/filepicker/res/content/filepicker.js index 750d9f9b0205..7a49417f3183 100644 --- a/xpfe/components/filepicker/res/content/filepicker.js +++ b/xpfe/components/filepicker/res/content/filepicker.js @@ -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; } diff --git a/xpfe/components/filepicker/res/locale/en-US/filepicker.properties b/xpfe/components/filepicker/res/locale/en-US/filepicker.properties index a5bf8873bf95..4ba18b14689b 100644 --- a/xpfe/components/filepicker/res/locale/en-US/filepicker.properties +++ b/xpfe/components/filepicker/res/locale/en-US/filepicker.properties @@ -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