From 662b773a7078d523672dd03b46309f04a86d928d Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Wed, 11 Sep 2002 07:38:14 +0000 Subject: [PATCH] modeGetFolder should have some different wording from modeOpen. Bug 160672, r=caillon,timeless, sr=bryner --- .../filepicker/res/content/filepicker.js | 19 +++++++++++++++++-- .../filepicker/res/content/filepicker.xul | 2 +- .../res/locale/en-US/filepicker.properties | 4 ++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/xpfe/components/filepicker/res/content/filepicker.js b/xpfe/components/filepicker/res/content/filepicker.js index 139abb6a4eae..1ecae896331d 100644 --- a/xpfe/components/filepicker/res/content/filepicker.js +++ b/xpfe/components/filepicker/res/content/filepicker.js @@ -83,6 +83,11 @@ function filepickerLoad() { newDirButton.removeAttribute("hidden"); } + if (filePickerMode == nsIFilePicker.modeGetFolder) { + var textInputLabel = document.getElementById("textInputLabel"); + textInputLabel.value = gFilePickerBundle.getString("dirTextInputLabel"); + } + if ((filePickerMode == nsIFilePicker.modeOpen) || (filePickerMode == nsIFilePicker.modeOpenMultiple) || (filePickerMode == nsIFilePicker.modeSave)) { @@ -237,14 +242,24 @@ function selectOnOK() //promptService.alert(window, "Problem", "normalize failed, continuing"); } - if (!file.exists() && (filePickerMode != nsIFilePicker.modeSave)) { + var fileExists = file.exists(); + + if (!fileExists && (filePickerMode == nsIFilePicker.modeOpen || + filePickerMode == nsIFilePicker.modeOpenMultiple)) { showErrorDialog("errorOpenFileDoesntExistTitle", "errorOpenFileDoesntExistMessage", file); return false; } - if (file.exists()) { + if (!fileExists && filePickerMode == nsIFilePicker.modeGetFolder) { + showErrorDialog("errorDirDoesntExistTitle", + "errorDirDoesntExistMessage", + file); + return false; + } + + if (fileExists) { isDir = file.isDirectory(); isFile = file.isFile(); } diff --git a/xpfe/components/filepicker/res/content/filepicker.xul b/xpfe/components/filepicker/res/content/filepicker.xul index 0edf91c7103d..ee90f5a9733a 100644 --- a/xpfe/components/filepicker/res/content/filepicker.xul +++ b/xpfe/components/filepicker/res/content/filepicker.xul @@ -85,7 +85,7 @@ - diff --git a/xpfe/components/filepicker/res/locale/en-US/filepicker.properties b/xpfe/components/filepicker/res/locale/en-US/filepicker.properties index f6d550777784..10a38a66c1b9 100644 --- a/xpfe/components/filepicker/res/locale/en-US/filepicker.properties +++ b/xpfe/components/filepicker/res/locale/en-US/filepicker.properties @@ -14,6 +14,8 @@ xulTitle=XUL Files xulFilter=*.xul appsTitle=Applications +dirTextInputLabel=Directory name: + confirmFileReplacing=%S already exists.\nDo you want to replace it? openButtonLabel=Open saveButtonLabel=Save @@ -22,6 +24,8 @@ noButtonLabel=No errorOpenFileDoesntExistTitle=Error opening %S errorOpenFileDoesntExistMessage=File %S doesn't exist +errorDirDoesntExistTitle=Error accessing %S +errorDirDoesntExistMessage=Directory %S doesn't exist errorDirNotReadableMessage=Directory %S is not readable or does not exist. errorOpeningFileTitle=Error opening %S