Bug 96434 - open folder in xp filepicker attempts a save instead of an open. r=jag, sr=shaver, a=dbaron.

This commit is contained in:
bryner%netscape.com 2001-08-24 06:50:45 +00:00
Родитель 82c6bb2ae6
Коммит 31114d9591
1 изменённых файлов: 33 добавлений и 14 удалений

Просмотреть файл

@ -104,7 +104,7 @@ function filepickerLoad() {
} }
// setup the dialogOverlay.xul button handlers // setup the dialogOverlay.xul button handlers
doSetOKCancel(onOK, onCancel); doSetOKCancel(selectOnOK, onCancel);
retvals.buttonStatus = nsIFilePicker.returnCancel; retvals.buttonStatus = nsIFilePicker.returnCancel;
var outliner = document.getElementById("directoryOutliner"); var outliner = document.getElementById("directoryOutliner");
@ -155,7 +155,18 @@ function changeFilter(filterTypes)
window.setCursor("auto"); window.setCursor("auto");
} }
function onOK() function openOnOK()
{
var dir = outlinerView.getSelectedFile();
if (dir)
gotoDirectory(dir);
retvals.file = dir;
retvals.buttonStatus = nsIFilePicker.returnCancel;
doSetOKCancel(selectOnOK, onCancel);
return false;
}
function selectOnOK()
{ {
var errorTitle, errorMessage, promptService; var errorTitle, errorMessage, promptService;
var ret = nsIFilePicker.returnCancel; var ret = nsIFilePicker.returnCancel;
@ -403,20 +414,28 @@ function onOutlinerFocus(event) {
} }
function getOKAction(file) { function getOKAction(file) {
if (file && file.isDirectory() && filePickerMode != nsIFilePicker.modeGetFolder) var buttonLabel;
return gFilePickerBundle.getString("openButtonLabel");
switch(filePickerMode) { if (file && file.isDirectory() && filePickerMode != nsIFilePicker.modeGetFolder) {
case nsIFilePicker.modeGetFolder: doSetOKCancel(openOnOK, onCancel);
return gFilePickerBundle.getString("selectFolderButtonLabel"); buttonLabel = gFilePickerBundle.getString("openButtonLabel");
break;
case nsIFilePicker.modeOpen:
return gFilePickerBundle.getString("openButtonLabel");
break;
case nsIFilePicker.modeSave:
return gFilePickerBundle.getString("saveButtonLabel");
break;
} }
else {
doSetOKCancel(selectOnOK, onCancel);
switch(filePickerMode) {
case nsIFilePicker.modeGetFolder:
buttonLabel = gFilePickerBundle.getString("selectFolderButtonLabel");
break;
case nsIFilePicker.modeOpen:
buttonLabel = gFilePickerBundle.getString("openButtonLabel");
break;
case nsIFilePicker.modeSave:
buttonLabel = gFilePickerBundle.getString("saveButtonLabel");
break;
}
}
return buttonLabel;
} }
function onSelect(file) { function onSelect(file) {