Bug 781973 - Use filepicker's open() instead of the obsolete show() in /browser. r=bbondy

This commit is contained in:
Andres Hernandez
2012-09-19 17:21:38 -06:00
parent 5686375b7c
commit 2b51a67583
13 changed files with 502 additions and 410 deletions

View File

@@ -112,15 +112,22 @@ const nsIFilePicker = Components.interfaces.nsIFilePicker;
function onChooseFile()
{
try {
var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
fp.init(window, dialog.bundle.getString("chooseFileDialogTitle"), nsIFilePicker.modeOpen);
fp.appendFilters(nsIFilePicker.filterHTML | nsIFilePicker.filterText |
nsIFilePicker.filterAll | nsIFilePicker.filterImages | nsIFilePicker.filterXML);
let fp = Components.classes["@mozilla.org/filepicker;1"].
createInstance(nsIFilePicker);
let fpCallback = function fpCallback_done(aResult) {
if (aResult == nsIFilePicker.returnOK && fp.fileURL.spec &&
fp.fileURL.spec.length > 0) {
dialog.input.value = fp.fileURL.spec;
}
doEnabling();
};
if (fp.show() == nsIFilePicker.returnOK && fp.fileURL.spec && fp.fileURL.spec.length > 0)
dialog.input.value = fp.fileURL.spec;
fp.init(window, dialog.bundle.getString("chooseFileDialogTitle"),
nsIFilePicker.modeOpen);
fp.appendFilters(nsIFilePicker.filterAll | nsIFilePicker.filterText |
nsIFilePicker.filterImages | nsIFilePicker.filterXML |
nsIFilePicker.filterHTML);
fp.open(fpCallback);
} catch (ex) {
}
catch(ex) {
}
doEnabling();
}