![]() |
![]() |
![]() |
![]() |
Contacts Browser ExampleContacts Browser Example — Explanation of how to create a scrolling window listing contacts in alphabetical order. |
This is a fully functional reference application for implementing scrolling contact browsers using the EBookClientCursor. With the cursor, the following features are possible.
Display contacts in a configurable sort order
Sort by any EContactField which conforms to G_TYPE_STRING, this can be checked
with e_contact_field_type()
Minimal memory constraints
Only load into memory the contacts which are currently visible in the list
Filter search results on the fly
Set new search expressions generated with EBookQuery on the fly. Refresh the contact list at the current position without losing the current cursor position.
Display the the user's alphabet
Using interesting features from ICU libraries allow us to display the user's alphabet, and implement features such as jumping to a given letter in the user's alphabet.
The actual example code is built into the 'example' subdirectory of the Evolution Data Server sources. In order to run the example, just launch the program and give it a path to a directory full of vcards, bearing the .vcf filename extention.
Below is an example of the contact browser code itself, the example program is broken down into a couple of object classes which are also listed below.
1 |
This is a simple class which implements a vertical scroller and displays various letters according to the currently active alphabet. The actual interaction with EBookClientCursor is done in the main contact browser and this class is simply configured with the active alphabet.
1 |
The search entry is placed at the top of the contacts browser, this class simply implements a drop down box choosing the appropriate search expression which should be used to filter the contacts in the browser display window.
1 |