[Kde-pim] How to resolve Item/Collection from ID?

Christian Mollekopf chrigi_1 at fastmail.fm
Wed Apr 24 14:43:25 BST 2013


On Wednesday 24 April 2013 14.37:43 Jonathan Marten wrote:
> I'm working on the command line Akonadi copier/syncer which I mentioned
> a while ago, which is coming along well.  The means of specifying
> items or collections will be by numeric ID - a path may be more
> friendly, but for that to be possible Akonadi::CollectionPathResolver
> will have to become a public interface.
> 
> So my quick question: given a numeric Akonadi::Entity ID, what is the
> simplest/cheapest way to determine whether this is an Item, a
> Collection, or neither?  Preferably by a means that does not involve
> too many round trips to the Akonadi server.

Try a CollectionFetchJob, if that returns an invalid collection it's an Item.
If you don't know if the Item Id is valid, you have to use an ItemFetchJob as 
well. You can fetching actual data using the fetchscope.

One roundtrip per fetchjob AFAIK.

Cheers,
Christian
_______________________________________________
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