[Kde-pim] Akonadi EntityTreeModel Fetch Strategies and Invariants

Christian Mollekopf chrigi_1 at fastmail.fm
Thu Oct 20 01:46:02 BST 2011


On Friday, October 14, 2011 03:09:46 PM David Narvaez wrote:
> Hi,
> 
> First of all, happy b'day to KDE! :)
> 
> I have a question about Fetching Strategies in the Akonadi
> EntityTreeModel. According to the documentation, the
> InvisibleCollectionFetch "Fetches collections, but does not put them
> in the model. This can be used to create a list of items in all
> collections. The ParentCollectionRole can still be used to retrieve
> the parent collection of an Item."[0]
> 
> Now, on the code, we disconnect collection change notifications if the
> InvisibleCollectionFetch flag is set[1] which means no collection
> addition or removal is notified. Later, in the code, we assume that
> all Items that are to be removed from the model have a collection in
> the model[2] but, since you can set the InvisibleCollectionFetch
> strategy independent from the Item fetch strategy, you might as well
> receive notifications of items added and removed from collections not
> in the model. This causes crashes in the assertions and makes me
> wonder if it's the right way to do stuff or if I should be looking at
> fixing this behavior.
> 
> Am I understanding it right? Any comments or suggestions? Thanks.

Hey David,

For me InvisibleCollectionFetch is generally broken, thats why I prepared some 
patches some time ago which you can find here

http://quickgit.kde.org/?p=clones%2Fkdepimlibs%2Fcmollekopf%2FpimlibsClone.git&a=shortlog&h=refs/heads/invisibleCollectionFetch

Steven Kelly has yet to include them, but afaik he is in the progress of some 
larger changes, which is why it is taking a bit.
Therefore I wouldn't spend much time fixing the ETM right now, unless Steven 
says it's ok.

If you need an InvisibleCollectionFetch I suggest working around the issue 
using a KDesendandsProxy to flatten the tree and then a MimeTypeFilterProxy to 
filter the collections. That works for me without problems.

Regarding the specific issue; I didn't go through it thoroughly, but if the 
item is not in the model it also shouldn't be in m_items and therefore you 
should never get to the assert.

Cheers,
Christian

> 
> David E. Narvaez
> 
> [0]
> http://api.kde.org/4.7-api/kdepimlibs-apidocs/akonadi/html/classAkonadi_1_1
> EntityTreeModel.html#aaf514b1eeffd1c08e01555cc14edb072a0797046b326fb5117173a
> 71c51662798 [1]
> https://projects.kde.org/projects/kde/kdepimlibs/repository/revisions/maste
> r/entry/akonadi/entitytreemodel.cpp#L1054 [2]
> https://projects.kde.org/projects/kde/kdepimlibs/repository/revisions/maste
> r/entry/akonadi/entitytreemodel_p.cpp#L1033
> _______________________________________________
> 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/
_______________________________________________
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