[Kde-pim] Akonadi resource: How to update item if backend data changed

rgruber at users.sourceforge.net rgruber at users.sourceforge.net
Sun Jun 5 15:12:54 BST 2011


Hello!

I've started to write an Akonadi resource that provides me access to the MS Exchange calendar that I'm forced to use at work. Using libmapi as backend everything worked out very well so far. I'm already able to create a collection for the Exchange calendar and fill the collection with all the events from the Exchange calendar. I can even do incremental addition of new items when new events get added to the Exchange calendar. And I also prepared some code for handling events that got deleted.

But I'm stuck right now when an event on the Exchange calendar changed. I can easily find the changed items by checking the Akonadi items's modification time with the modification time reported by the exchange server. But I don't know how to get Akonadi to update the item's payload just like it does for new items.

I choose the way where I create almost empty items in retrieveItems() and fetch the payload when Akonadi calls retrieveItem() of my resource. This works like a charm for new items. I pass them to itemsRetrievedIncremental() and Akonadi will call retrieveItem() where I fetch the payload from the Exchange server. But when I pass an Item to itemsRetrievedIncremental() that is already in the Akonadi store the retrieveItem() method never gets called. I tried to trick Akonadi by clearing the payload or changing the modification time of the item. But I did not manage to get retrieveItem() called for an already existing item.


I checked the Akonadi tutorials and API doc but could not really find any info on how to react if backend data changes.
So I hope that somebody can push for me in the right direction. I've uploaded the relevant parts of my resource to pastbin. So you can have a look what I've got so far: http://paste.kde.org/78673/  The problem arises at line 60 where I found a changed item and don't know what do do with it...

Is there a proposed way of handling backend data changes?
If I change an item (e.g. the modification time) and pass it to itemsRetrievedIncremental() why are the changes not written to the Akonadi store? or am I missing something here?

And finally: I'm running a unchanged Kubuntu 11.04 system with the KDE 4.6.2.

I hope somebody can help me out with this!
Thanks, Robert

_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/



More information about the kde-pim mailing list