[Project_owners] Opening files

Michael Buckley michael.buckley at hotmail.com
Wed Jul 26 22:37:27 EDT 2006


Neil wrote:
>Michael Buckley wrote:
>
>>The first is how to select the path that the open file dialog opens with?  
>>What I am using looks like this.
>>
>>openFileNow: function(){
>>    var openPath = 
>>Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch)
>>
>>        .getCharPref('extension.editor.folder.openSave')
>>    var openX = gStrings.getString('openX');
>>    const nsIFilePicker = Components.interfaces.nsIFilePicker;
>>    var fp =
>>Components.classes['@mozilla.org/filepicker;1'].createInstance(nsIFilePicker);
>>
>>    fp.init(window, openX, nsIFilePicker.modeOpen);
>>    fp.appendFilters(nsIFilePicker.filterAll | nsIFilePicker.filterText);
>
>fp.displayDirectory = 
>Components.classes['@mozilla.org/preferences-service;1']
>    .getService(Components.interfaces.nsIPrefBranch)
>    .getComplexValue('extension.editor.folder.openSave', 
>Components.interfaces.nsILocalFile);
>
>Naturally you should ensure that an nsILocalFile pref exists or do some 
>error checking ;-)
>_______________________________________________
>Project_owners mailing list
>Project_owners at mozdev.org
>http://mozdev.org/mailman/listinfo/project_owners
>
Thanks so much for that, I will add the error checking in once I have
everything working.  I was aware that I would have to do that to avoid
lots of bugs.

_________________________________________________________________
Meet Sexy Singles today @ Lavalife - Click here 
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Flavalife9%2Eninemsn%2Ecom%2Eau%2Fclickthru%2Fclickthru%2Eact%3Fid%3Dninemsn%26context%3Dan99%26locale%3Den%5FAU%26a%3D22740&_t=751140432&_r=emailtagline_meetsexy_june&_m=EXT



More information about the Project_owners mailing list