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
doSetOKCancel(onOK, onCancel);
doSetOKCancel(selectOnOK, onCancel);
retvals.buttonStatus = nsIFilePicker.returnCancel;
var outliner = document.getElementById("directoryOutliner");
@ -155,7 +155,18 @@ function changeFilter(filterTypes)
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 ret = nsIFilePicker.returnCancel;
@ -403,22 +414,30 @@ function onOutlinerFocus(event) {
}
function getOKAction(file) {
if (file && file.isDirectory() && filePickerMode != nsIFilePicker.modeGetFolder)
return gFilePickerBundle.getString("openButtonLabel");
var buttonLabel;
if (file && file.isDirectory() && filePickerMode != nsIFilePicker.modeGetFolder) {
doSetOKCancel(openOnOK, onCancel);
buttonLabel = gFilePickerBundle.getString("openButtonLabel");
}
else {
doSetOKCancel(selectOnOK, onCancel);
switch(filePickerMode) {
case nsIFilePicker.modeGetFolder:
return gFilePickerBundle.getString("selectFolderButtonLabel");
buttonLabel = gFilePickerBundle.getString("selectFolderButtonLabel");
break;
case nsIFilePicker.modeOpen:
return gFilePickerBundle.getString("openButtonLabel");
buttonLabel = gFilePickerBundle.getString("openButtonLabel");
break;
case nsIFilePicker.modeSave:
return gFilePickerBundle.getString("saveButtonLabel");
buttonLabel = gFilePickerBundle.getString("saveButtonLabel");
break;
}
}
return buttonLabel;
}
function onSelect(file) {
if (file) {
var path = file.unicodeLeafName;