Sunday, October 18, 2009

Week 6 - UpdateSpringSearchSplitter()

For these two previous weeks, I can finally say that I have made progress with my project. Basically, my project involves incorporating a feature from one place (Firefox) into another (Thunderbird). This feature, which I am speaking of, is to make the search bar to expandable or shrinkable at any time by the user. So looking at Firefox, using DOMi, I pinpointed the toolbar XUL elements that were related to this feature: two textboxes (for the urlbar and the searchbar) and, the key to my project, the splitter. 

Presently, in Thunderbird, the toolbar only has buttons, toolbarspacers, toolbarsprings and a searchbar. Just like Firefox, I decided to add a splitter to the toolbar, but nothing happened. So, I looked back at Firefox, and realized that the urlbar and the splitter had certain attributes (resizebefore, resizeafter, and flex). I add these attributes to my splitter and its sibling element before, a toolbarspring (so my toolbarspring is used instead of the urlbar, which is a textbox) and it successfully works.

Having accomplished that, I do not know what to do after, so I speak with  Bryan and he points me onto another obstable: creating a function that will update my splitter. Basically, this is to ensure that the splitter is always there (so that the user can always play with the width of his search bar). Luckily, in Firefox, there is a function, UpdateUrlbarSearchSplitterState(), which I simply modified and used. One thing that I learned, though, is that Thunderbird has many files from Firefox that, I guess, do not get used. So, when I modified the Thunderbird's UpdateUrlbarSearchSplitterState(), it did not do anything. I was stuck for awhile... but then I thought back at what Bryan said, and made my own function, UpdateSpringSearchSplitter(), in two other files. I guess, these two files in Thunderbird perform functions similar to the one file in Firefox. For now, this function gets called when the user finishes customizing his toolbar (by clicking the "Done" button on the Customize window).

My function, UpdateSpringSearchSplitter(), checks if the toolbar has a toolbarspring, a splitter, and a textbox (for the searchbar). If there is toolbarspring and a textbox, it will create a splitter, but if either, the toolbarspring or the textbox, is missing, then it will remove a splitter. This might be confusing, because it is for me, and also it is part of my problem which I am having right now.



By default, when my Thunderbird initializes, the toolbar is missing a toolbarspring and a splitter. I reset the toolbar in order to add my toolbarspring and splitter onto the toolbar. Once, I click "Done", this is where my problem is, the splitter vanishes (which makes my searchbar unable to be expanded/shrunk).



Hopefully, I can solve this by tomorrow, since the first release is due this week...

No comments:

Post a Comment