Supports counting inbox, due_soon, or overdue tasks.

Fairly large code changes, including creating a new helper class.

I understand if you don't want to accept such a large pull request, but these are changes I wanted for my own use and I figured I should at least let you know about them.