mozilla-b2g/gaia-email-libs-and-more — pull request #57 by asutherland (2012-09-29 22:27:21+00:00)
Title: local search support (preliminary)

@mozsquib This is largely just the API/skeleton of the filtering logic (test a message), so now is a great time to make any feedback you might have. This is not remotely ready for review (although I'm hoping either late tonight or the earlier half of tomorrow.)

It's similar to the Thunderbird approach where you construct a predicate and then add that to the thing that drives the search, but it's also built so that the predicates also generate the snippet/context information.

In terms of how this is surfaced to the UI, I was figuring searches will generate a slice whose contents, rather than just being messages, are the message header and the match object. Then we can use a specialized display item for them that prefers the matched cases for display if they exist, but falls back if not. So if the subject or body matches, we use those snippets, but if they do not, we fall back to using the subject and body snippet like usual.

I'm not really sure as to whether to reuse the message list card directly or copy-and-paste a lot of it or try and do a mix-in/subclassing thing.