mozilla-b2g/gaia — pull request #7773 by sergi (2013-01-24 11:14:33+00:00)
Title: Bug 828732 - "Add to existing contacts" should not be available if no contacts exist

Fixes [828732](https://bugzilla.mozilla.org/show_bug.cgi?id=828732)

### Steps to reproduce

1. Go to your call history and click on a phone number without a contact associated.

Expect: Options to call or create a new contact
Actual: "Add to existing contacts" is also available despite 0 contacts in my address book

### Caveats

This patch will check for the existence of any number of contacts at the startup of the dialer app, and it will hide the `Add to existing contacts` accordingly.

Please note that if a contact is added or deleted from the communications app itself or while the communications app is loaded, that won't have any effect. In order to be able to implement a proper dynamic reaction to adding or deleting contacts, some kind of event that reacts to contact addition/deletion would be necessary. Some advice of what would be a standard solution would be very helpful.