diff options
author | Matěj Cepl <mcepl@redhat.com> | 2010-07-19 15:48:47 +0200 |
---|---|---|
committer | Matěj Cepl <mcepl@redhat.com> | 2010-07-19 15:58:00 +0200 |
commit | fcfbd3f7f01df5c67182366dc25e41567addc3b8 (patch) | |
tree | 7c19d3d6aebc13b42a6984469ae00e987d7949b7 /lib/prompts.js | |
parent | f61df257aeac1b55bc6fb4b4cd67fc13201fa9ac (diff) | |
download | bugzilla-triage-fcfbd3f7f01df5c67182366dc25e41567addc3b8.tar.gz |
Add import JSON file to logs
Diffstat (limited to 'lib/prompts.js')
-rw-r--r-- | lib/prompts.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/prompts.js b/lib/prompts.js index ac21c49..8f7942e 100644 --- a/lib/prompts.js +++ b/lib/prompts.js @@ -80,3 +80,23 @@ exports.promptYesNoCancel = function promptOKNoCancel(prompt) { return null; } }; + +/** + * + * documentation is https://developer.mozilla.org/en/NsIFilePicker + */ +exports.promptFileOpenPicker = function promptFilePicker (win) { + var fp = Cc["@mozilla.org/filepicker;1"] + .createInstance(Ci.nsIFilePicker); + fp.init(win, "JSON File Open", Ci.nsIFilePicker.modeOpen); + fp.appendFilter("JSON files", "*.json"); + fp.appendFilters(Ci.nsIFilePicker.filterAll); + fp.filterIndex = 0; + var res = fp.show(); + + if (res === Ci.nsIFilePicker.returnOK || + res === Ci.nsIFilePicker.returnReplace ) { + return fp.file.path + } + return null; +};
\ No newline at end of file |