Index: toolkit/components/filepicker/content/filepicker.js =================================================================== RCS file: /cvsroot/mozilla/toolkit/components/filepicker/content/filepicker.js,v retrieving revision 1.5.18.1.2.1 diff -u -r1.5.18.1.2.1 filepicker.js --- toolkit/components/filepicker/content/filepicker.js 10 Aug 2004 00:20:32 -0000 1.5.18.1.2.1 +++ toolkit/components/filepicker/content/filepicker.js 3 Nov 2004 13:21:22 -0000 @@ -67,6 +67,7 @@ if (o.displayDirectory) { const directory = o.displayDirectory.path; } + const initialText = o.defaultString; const filterTitles = o.filters.titles; const filterTypes = o.filters.types; @@ -121,13 +122,18 @@ treeView.showOnlyDirectories = true; } + // set up the right icon for GNOME stock icons + if (filePickerMode == nsIFilePicker.modeSave) + okButton.setAttribute("icon","save"); + else + okButton.setAttribute("icon","open"); + // start out with a filename sort handleColumnClick("FilenameColumn"); document.documentElement.setAttribute("ondialogcancel", "return onCancel();"); try { - var buttonLabel = getOKAction(); - okButton.setAttribute("label", buttonLabel); + setOKAction(); } catch (exception) { // keep it set to "OK" } @@ -496,8 +502,9 @@ onFileSelected(treeView.selectedFiles); } -function getOKAction(file) { +function setOKAction(file) { var buttonLabel; + var buttonIcon = "open"; // used in all but one case if (file && file.isDirectory() && filePickerMode != nsIFilePicker.modeGetFolder) { document.documentElement.setAttribute("ondialogaccept", "return openOnOK();"); @@ -515,11 +522,12 @@ break; case nsIFilePicker.modeSave: buttonLabel = gFilePickerBundle.getString("saveButtonLabel"); + buttonIcon = "save"; break; } } - - return buttonLabel; + okButton.setAttribute("label", buttonLabel); + okButton.setAttribute("icon", buttonIcon); } function onSelect(event) { @@ -558,8 +566,7 @@ } if (validFileSelected) { - var buttonLabel = getOKAction(file); - okButton.setAttribute("label", buttonLabel); + setOKAction(file); okButton.disabled = invalidSelection; } else okButton.disabled = (textInput.value == ""); @@ -586,8 +593,7 @@ } function onTextFieldFocus() { - var buttonLabel = getOKAction(null); - okButton.setAttribute("label", buttonLabel); + setOKAction(null); doEnabling(); } Index: toolkit/components/filepicker/content/filepicker.xul =================================================================== RCS file: /cvsroot/mozilla/toolkit/components/filepicker/content/filepicker.xul,v retrieving revision 1.4.8.1 diff -u -r1.4.8.1 filepicker.xul --- toolkit/components/filepicker/content/filepicker.xul 24 Jul 2004 23:36:19 -0000 1.4.8.1 +++ toolkit/components/filepicker/content/filepicker.xul 3 Nov 2004 13:21:24 -0000 @@ -95,7 +95,7 @@ -