I've had another poke at Quick File, managing now to implement an nsIAutoCompleteSession [1] as a component registered at @mozilla.org/autocompleteSession;1?type=mailnewsfolders, which allows me to create an autocomplete textbox for the mail/news folders with something like this in XUL
<textbox type="autocomplete" searchSessions="mailnewsfolders" /> Now that's all well and good, and I like the fact I finally managed to do it, but it creates a problem in setting options for the component, since it's only interfaces are nsISupports [2] and nsIAutoCompleteSession. Neither of which have any suitable methods for setting options, like 'search root' or 'ignoreCase'. The only way I can think of at the moment to add this functionality would be to implement an additional interface in the component which has suitable methods. I think I'd like to avoid creating a new interface [eg IConfiguration], since that involves building an XPT, which I think is platform specific. I've had a quick look at the other XPCOM interfaces and come up with nsIProperties [3]. I'm thinking that I could implement this within the component, and use the values within that as an instance specific configuration set. That would at least allow the component to have the options exposed, the next question is how to set them. I think this could be done in two ways. Firstly, via textbox.getSession and then querying the nsIProperties interface. Secondly by adding some attributes/properties to the textbox via a binding. Am I going round in circles here when there's a direct route? Is this a valid use of nsIProperties? Can anyone think of another way? i've pondered aggregation, but it's not clear how that'd help. Cheers [1] http://www.xulplanet.com/references/xpcomref/ifaces/nsIAutoCompleteSession.html [2] http://www.xulplanet.com/references/xpcomref/ifaces/nsISupports.html [3] http://www.xulplanet.com/references/xpcomref/ifaces/nsIProperties.html _______________________________________________ Project_owners mailing list [email protected] http://mozdev.org/mailman/listinfo/project_owners
