05-02-2013 09:11 PM - edited 05-02-2013 09:12 PM
I'm trying to get the details of an existing contact after it's been edited using the card sys.pim.contacts.card.composer with the action bb.action.EDIT. When I try to retrieve the card details using ContactService().contactDetails(contactId) immediately after the card return, the details are missing. If I put in a QTimer to insert an arbitrary 2 second delay, then the edited contact details are in the object as they should be.
As a fallback, I tried connecting to the contactsChanged() signal emitted from the ContactService, I properly receive the ids of changed contacts, but when I retrieve them, I have the same problem where the contact details are empty unless i insert a delay.
Inserting a 2 second delay works, but it slows my app more than necessary, seems arbitrary and like it's going to get me into trouble when the device gets busy. Is there a different signal i should be connecting to, or some more deterministic way to get the data after it's been properly committed?
Any ideas? Is there something I can do to make sure the contact change is committed before I retrieve it?
05-03-2013 02:20 PM
Relying on the card finished is not a good idea but contactsChanged() should be reliable. Can you log a bug against the contactsChanged() being fired early and share the link here? Please include a sample app to reproduce if possible. I will escalate it from there.
05-03-2013 02:46 PM
thanks, shadid! I'll do that. Yeah, I wasn't entirely surprised that closing the card wasn't sufficient (tho I was hoping the details might be returned in the card done message), I was more surprised about the contactsChanged() situation. Thanks for confirming I wasn't missing anything. I'll copy it into a sample app, and if that still fails log a bug with it attached.