[Kde-pim] Re: How can a resource identify its Collection?

Volker Krause vkrause at kde.org
Mon Mar 21 13:02:19 GMT 2011


On Wednesday 02 March 2011 18:48:08 Kevin Krammer wrote:
> On Wednesday, 2011-03-02, David Jarvie wrote:
> > In a resource which only has a single Collection, how can the resource
> > identify its Collection so that it can call ItemCreateJob, ItemModifyJob
> > etc on the collection? The remote id of the collection is known, but not
> > the Akonadi id.
> > 
> > Following Kevin's suggestion, I tried the following code to create a new
> > item within the resource, but the the job returns with the error
> > 
> >     "Unknown error. (Unknown collection.)"
> > 
> > Collection c;
> > c.setParentCollection(Collection::root());
> > c.setRemoteId(directoryName());
> > Item item;
> > // ... set item mime type and payload
> > item.setParentCollection(c);
> > ItemCreateJob* job = new ItemCreateJob(item, c);
> > 
> > I checked with debug output that the remote ID for the collection is the
> > same as in the Akonadi database. I wonder if something else has to be
> > done to enable collections to be found by their remote IDs?
> 
> I assumed this would work, i.e. a resource being allowed to address its
> entities by remoteId :(

This is how it is supposed to work indeed.

> But it seems that at least the ItemCreateJob always uses the collection.id()
> when sending the APPEND command.

That's just a bug, looks like ItemCreateJob (and APPEND) were never extended 
to also support [H]RIDs. Shouldn't be too hard to add, there is generic code 
on the server side to get the collection based on the various different ids 
used in all the other commands already.

> Seems you have to fetch your root collection once, but maybe Volker has
> another idea?

That's the only workaround I can think of as well.

regards
Volker
-------------- 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/20110321/89f90f9c/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