Samedi, le 30 juillet 2011, à 01:24, Friedrich W. H. Kossebau a écrit:
> Mardi, le 26 juillet 2011, à 17:26, Eric Lapuyade a écrit:
<snip>
> > // save the contact back into the store
> > bool result = contactMgr.saveContact (contactP);
> > --> this returns true, which means success
> >
> > // now, reload all contacts from the manager
> > QList<QContact> list2 = contactMgr.contacts();
> >
> > // At this point, if I fetch the same contact again that I just saved, I
> > see it was not modified.
> > QContact *contact2 = list2[0];
Ah, missed that yesterday, this might be the actual problem:
You cannot expect QContactManager::contacts() to return the contacts in the
order you might have passed them to the QContactManager::saveContacts(...).
So identifying the contact just by the index in the list is prone to fail.
That is what you use the QContact::id() property for.
So to fetch a copy of the same contact you stored before you would write
QContact contact2 = contactMgr.contact(contactP->localId());
Or if you want the whole lists of contacts in the order you have them
already, create a matching QStringList of their localIds with some own
function and call
const QList<QContactLocalId> localIds = yourCreateLocalIdList(list);
QList<QContact> list2 = contactMgr.contacts(localIds);
Does that help you to solve you problem?
Cheers
Friedrich
--
Desktop Summit 2011 in Berlin - Registered already? - www.desktopsummit.org
_______________________________________________
MeeGo-dev mailing list
[email protected]
http://lists.meego.com/listinfo/meego-dev
http://wiki.meego.com/Mailing_list_guidelines