[Kde-pim] Akonadi attribute oddities

David Jarvie djarvie at kde.org
Tue Dec 22 13:12:02 GMT 2009


I'm puzzled by some code in EntityTreeModel which manipulates Attributes.
In setData(), it fetches the collection's Attribute, sets a value in it,
and then calls collection.addAttribute() to update it in the collection.

Why is the addAttribute() call needed? AFAICS, Entity::attribute() returns
a pointer to the actual Attribute, not a pointer to a copy, so that
changing the Attribute returned by it will change the value attached to
the Entity. The addAttribute() call seems to be superfluous.

In addition to that, AFAICS, addAttribute() called with the existing
Attribute as a parameter will first delete any existing Attribute (which
happens to be the same one as in the parameter), and then add the (now
deleted) Attribute back into the Entity. So addAttribute() should first
check whether the supplied Attribute is the same as the one it already
holds, and if so, do nothing. Or am I missing something?

-- 
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