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

David Jarvie djarvie at kde.org
Wed Mar 2 16:57:49 GMT 2011


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?

The resource's collection is only created in retrieveCollections() when
first run - not on subsequent restarts, so the ID could be saved in the
resource's settings on creation in retrieveCollections() - would that be a
sensible thing to do?

-- 
David Jarvie.
KDE developer.
KAlarm author - http://www.astrojar.org.uk/kalarm

_______________________________________________
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