How can I select a file using the filepicker with a defined directory
and a preseletion for certain extension?
Having the following code only opens the picker to let me select
1) a directory with predefined tree or
2) opens the picker to select a file, but will not respect the
'passed' directory.
Any help very much welcomed
Günter
var picker=Components.classes
["@
mozilla.org/filepicker;1"].createInstance(_nsIFilePicker);
picker.appendFilters(_nsIFilePicker.filterAll);
picker.appendFilter("FilterName","*.xyz");
picker.filterIndex=1
picker.defaultExtension="xyz";
picker.displayDirectory=cDir.parent; // cDir is nsILocalFile
picker.init(aWindow,g_Bundle.getString("rf.options.filelocation.filepicker.title"),
_nsIFilePicker.modeOpen); // ad 1)
or replace last line with
_nsIFilePicker.modeGetFolder); // ad 2)
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0a2