[Kde-pim] Single file resources create new collection when re-reading backend file

Kevin Krammer kevin.krammer at gmx.at
Wed Aug 3 21:30:15 BST 2011


On Monday, 2011-08-01, David Jarvie wrote:
> On Monday 01 August 2011 13:22:04 Kevin Krammer wrote:

> > My guess is that whatever causes the original collection to be removed is
> > the culprit here.
> 
> The culprit is ResourceBase::clearCache(), called in
> SingleFileResourceBase::readLocalFile(), which AFAICS deletes the first
> collection for the resource (which is the only collection in the case of
> SingleFileResource). The actual deletion of the collection is done in
> ResourceBasePrivate::slotDeleteResourceCollectionDone(), which is reached
> indirectly via ResourceScheduler::scheduleResourceCollectionDeletion().

Hmm, sounds like clearCache() is doing a bit too much for this use case.

> The solution is not to simply remove the call to clearCache() - things
> don't work at all then. It's the Items in the Collection which need to
> change, so the processing needs to be done at an Item level. I suspect
> that the correct way to do it would be to for the derived resource to read
> the updated backend file, and compare the items in it with the existing
> items from the old file. It would then remove existing ones which have
> disappeared, modify changed items, and add new ones. A somewhat cumbersome
> process, which would have to be implemented separately by each derived
> resource class, but is there a better way?

The item sync in ResourceBase is supposed to deal at least with items that are 
new and deleted (it only needs to check the remote IDs for that).

The problem should only be items which had their payload changed.
Maybe if we call clearPayload() on all items and make sure retrieveItem() can 
deliver each item's payload on request?

Cheers,
Kevin

-- 
Kevin Krammer, KDE developer, xdg-utils developer
KDE user support, developer mentoring
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20110803/fc2bddf5/attachment.sig>
-------------- next part --------------
_______________________________________________
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