[Kde-pim] Tomboy resource: Write access

Daniel Vrátil dvratil at kde.org
Fri Jun 24 14:29:42 BST 2016


On Friday, June 24, 2016 12:41:22 PM CEST Stefan Staeglich wrote:
> Hello,
> 
> I'm working now on the write access of my resource. The deletion of a note
> works successfully now :)
> 
> But there is a problem with adding and modifying. I thought I could do this
> analogue to the read access working with
> item.payload<KMime::Message::Ptr>(), but this seems to be NULL.

Hi,

it's not clear to me where you are trying to call item.payload<..>(), but if 
you are calling it on an Item you get as an argument in itemAdded()/
itemChanged() in your Resource, you must make sure you have the correct 
ItemFetchScope set, i.e. in your Resoure constructor you have to add

changeRecorder()->itemFetchScope().fetchFullPayload(true);

otherwise the Resource will only retrieve Items with the elementary metadata 
without the actual payload. Note that in itemRemoved() calling 
item.payload<...>() will always return a null pointer, because by the time 
itemRemoved() is called in your resource the Item no longer exists in Akonadi 
and so the payload cannot be provided.

If you are retrieving the Item manually via ItemFetchJob (be it in your 
resource or in an application), you have to do the same thing, i.e.

job->itemFetchScope().fetchFullPayload(true);

There are more options you can set in ItemFetchScope (there's also 
CollectionFetchScope btw). If you ever feel like the Items or Collections you 
are being given don't have all the information you would expect them to have, 
check if the fetch scope is correct.

Cheers,
Dan


> 
> Is this so correct, or is that a bug of KJots and KNote?
> 
> Thanks,
> Stefan
> _______________________________________________
> 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/


-- 
Daniel Vrátil
www.dvratil.cz | dvratil at kde.org
IRC: dvratil on Freenode (#kde, #kontact, #akonadi, #fedora-kde)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20160624/52027d69/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