[qtcontacts-sqlite] Improve filtering/sorting support

This commit improves the filtering and sorting code to match the
semantics for filtering and sorting which are enforced by the
QtMobility tst_qcontactmanagerfiltering unit test.