{"id":519,"date":"2010-05-02T10:09:11","date_gmt":"2010-05-02T18:09:11","guid":{"rendered":"http:\/\/www.visophyte.org\/blog\/?p=519"},"modified":"2010-05-02T10:09:11","modified_gmt":"2010-05-02T18:09:11","slug":"thunderbird-quick-filter-bar-extensions-theyre-a-thing","status":"publish","type":"post","link":"https:\/\/www.visophyte.org\/blog\/2010\/05\/02\/thunderbird-quick-filter-bar-extensions-theyre-a-thing\/","title":{"rendered":"Thunderbird Quick Filter Bar extensions, they&#8217;re a thing!"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-516\" title=\"pivot-popup\" src=\"http:\/\/www.visophyte.org\/blog\/wp-content\/uploads\/2010\/05\/pivot-popup.png\" alt=\"\" width=\"392\" height=\"198\" srcset=\"https:\/\/www.visophyte.org\/blog\/wp-content\/uploads\/2010\/05\/pivot-popup.png 392w, https:\/\/www.visophyte.org\/blog\/wp-content\/uploads\/2010\/05\/pivot-popup-300x151.png 300w\" sizes=\"auto, (max-width: 392px) 100vw, 392px\" \/><\/p>\n<p>The <a href=\"http:\/\/www.visophyte.org\/blog\/2010\/02\/14\/thunderbird-message-filter-bar-prototype-extension-check-it\/\">previously<\/a> <a href=\"http:\/\/clarkbw.net\/blog\/2010\/04\/02\/quick-filtering-in-thunderbird\/\">discussed<\/a> Quick Filter Bar interface landed in time for Thunderbird (Lanikai) 3.1 beta 2 (whose release is real-soon-now).\u00a0 Although the Quick Filter Bar already contains dangerously high levels of awesome, we made sure to make it extensible so you can cram even more awesome in.<\/p>\n<p><a href=\"http:\/\/www.visophyte.org\/blog\/wp-content\/uploads\/2010\/05\/pivot-results-from.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-thumbnail wp-image-517\" title=\"pivot-results-from\" src=\"http:\/\/www.visophyte.org\/blog\/wp-content\/uploads\/2010\/05\/pivot-results-from-600x193.png\" alt=\"\" width=\"600\" height=\"193\" srcset=\"https:\/\/www.visophyte.org\/blog\/wp-content\/uploads\/2010\/05\/pivot-results-from-600x193.png 600w, https:\/\/www.visophyte.org\/blog\/wp-content\/uploads\/2010\/05\/pivot-results-from-300x96.png 300w, https:\/\/www.visophyte.org\/blog\/wp-content\/uploads\/2010\/05\/pivot-results-from.png 738w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>As an example, I have created an extension that enables you to &#8216;pivot&#8217; based on the currently selected message(s).<\/p>\n<p>In its most straightforward manner of operation, you can click on an e-mail address in the message reader header and pivot by that e-mail address.\u00a0 Out of the box, this will show you all the messages in the current folder sent by that user.\u00a0 You can also (or only) show messages where that user is on the to\/cc lines by toggling the buttons on the expando bar appropriately.<\/p>\n<p><a href=\"http:\/\/www.visophyte.org\/blog\/wp-content\/uploads\/2010\/05\/pivot-email-to.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-thumbnail wp-image-518\" title=\"pivot-email-to\" src=\"http:\/\/www.visophyte.org\/blog\/wp-content\/uploads\/2010\/05\/pivot-email-to-600x137.png\" alt=\"\" width=\"600\" height=\"137\" srcset=\"https:\/\/www.visophyte.org\/blog\/wp-content\/uploads\/2010\/05\/pivot-email-to-600x137.png 600w, https:\/\/www.visophyte.org\/blog\/wp-content\/uploads\/2010\/05\/pivot-email-to-300x68.png 300w, https:\/\/www.visophyte.org\/blog\/wp-content\/uploads\/2010\/05\/pivot-email-to.png 740w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>You can also constrain the display to only show messages within some time interval of the message(s) in question.<\/p>\n<p><a href=\"http:\/\/www.visophyte.org\/blog\/wp-content\/uploads\/2010\/05\/pivot-email-from-week.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-thumbnail wp-image-522\" title=\"pivot-email-from-week\" src=\"http:\/\/www.visophyte.org\/blog\/wp-content\/uploads\/2010\/05\/pivot-email-from-week-600x123.png\" alt=\"\" width=\"600\" height=\"123\" srcset=\"https:\/\/www.visophyte.org\/blog\/wp-content\/uploads\/2010\/05\/pivot-email-from-week-600x123.png 600w, https:\/\/www.visophyte.org\/blog\/wp-content\/uploads\/2010\/05\/pivot-email-from-week-300x61.png 300w, https:\/\/www.visophyte.org\/blog\/wp-content\/uploads\/2010\/05\/pivot-email-from-week.png 737w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>The more confusing way to access the pivot functionality is to simply toggle the facet on the quick filter bar.\u00a0 When you toggle the filter on, we walk all of the selected messages and build up a list of the observed e-mail addresses for all of the senders and all of the recipients.\u00a0 One trick is that we filter out any e-mail addresses associated with your own account in order to avoid the filter becoming too inclusive.\u00a0 We save those e-mail addresses into our state.\u00a0 We also walk all the messages and find the time range that the messages cover and save that.\u00a0 These are used as the basis for the specific constraints you can enable from the expando bar.\u00a0 Because the values are saved, the filter does not change when you change your selected messages.\u00a0 You need to toggle the pivot filter off and on again (or use the &#8216;pivot&#8217; option on the email address popup) to change the data we are pivoting on.<\/p>\n<p>The extension can be <a href=\"https:\/\/addons.mozilla.org\/en-US\/thunderbird\/addon\/159026\">found on AMO<\/a> and in <a href=\"http:\/\/hg.mozilla.org\/users\/bugmail_asutherland.org\/qfb-pivot\/\">source form<\/a>.\u00a0 In a forward-looking move that is probably complicating things for now, I used the Jetpack SDK and its XUL extension support to implement the extension.\u00a0 In practice, all the example uses Jetpack for is its CommonJS module system and the standard mozilla-style JS modules would have been sufficient.\u00a0 All the UI stuff is done purely in XUL overlays bound to the backing code using addEventListener.<\/p>\n<p>The broad strokes for implementing a Quick Filter Bar extension are:<\/p>\n<ol>\n<li>Overlay your toolbarbutton into the quick filter bar, preferably the <a href=\"http:\/\/mxr.mozilla.org\/comm-central\/source\/mail\/base\/content\/quickFilterBar.xul#113\">#quick-filter-bar-collapsible-buttons box<\/a>.\u00a0 If you have an expando bar you want to contribute, you probably want to put that into the <a href=\"http:\/\/mxr.mozilla.org\/comm-central\/source\/mail\/base\/content\/quickFilterBar.xul#160\">#quick-filter-bar-expando<\/a>.\u00a0 As things currently stand, multiple expando bars being uncollapsed at the same time will probably turn out poorly, so you may need to be pragmatic and put your bar outside that box or do something clever.<\/li>\n<li>Import <a href=\"http:\/\/mxr.mozilla.org\/comm-central\/source\/mail\/base\/modules\/quickFilterManager.js\">resource:\/\/\/modules\/quickFilterManager.js<\/a>, implement your filter, and register it with <a href=\"http:\/\/mxr.mozilla.org\/comm-central\/source\/mail\/base\/modules\/quickFilterManager.js\">QuickFilterManager.defineFilter()<\/a> (whose documentation explains the interface you need to conform to).<\/li>\n<\/ol>\n<p>We will likely not be doing up full documentation for this extension point beyond the in-code documentation and in-tree\/extension examples.\u00a0 This is an advanced extension point by virtue of it touching nsIMsgDBHdrs, nsIMsgDBViews, nsIMsgSearchSessions, and friends, all of which have sharp edges.\u00a0 The way forward with soft, human-friendly documented abstractions is gloda and that&#8217;s where (my) effort will be concentrated.\u00a0 The awesome in this extension point is making it practical for people who already have the scars to utilize the full power of the message view\/traditional search subsystem without losing a limb and do so in a previously impossibly short period of time.<\/p>\n<p>PS: I made the icon!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The previously discussed Quick Filter Bar interface landed in time for Thunderbird (Lanikai) 3.1 beta 2 (whose release is real-soon-now).\u00a0 Although the Quick Filter Bar already contains dangerously high levels of awesome, we made sure to make it extensible so &hellip; <a href=\"https:\/\/www.visophyte.org\/blog\/2010\/05\/02\/thunderbird-quick-filter-bar-extensions-theyre-a-thing\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[3,6],"tags":[68,67,86],"class_list":["post-519","post","type-post","status-publish","format-standard","hentry","category-mozilla","category-thunderbird","tag-extensions","tag-jetpack","tag-quick-filter-bar"],"_links":{"self":[{"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/posts\/519","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/comments?post=519"}],"version-history":[{"count":6,"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/posts\/519\/revisions"}],"predecessor-version":[{"id":528,"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/posts\/519\/revisions\/528"}],"wp:attachment":[{"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/media?parent=519"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/categories?post=519"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/tags?post=519"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}