[Kde-pim] RR: Add additional parameter to EntityTreeModel::entityData()

David Jarvie djarvie at kde.org
Sun Dec 20 19:22:03 GMT 2009


On Sunday 20 Dec 2009 13:34:32 Stephen Kelly wrote:
> David Jarvie wrote:
> >> the entityData methods are just for convenience. As you have a special
> >> use case, I recommend that you override ::data instead.
> > 
> > Looking at the entitytreemodel.cpp code, I think you're right - in fact, I
> > need to return a value for Qt::BackgroundRole also, which currently is
> > handled by data() and not passed through to entityData() to handle.
> > 
> > I think this points to a lack of API documentation for EntityTreeModel -
> > there's nothing to describe the difference between data() and
> > entityData().
> > 
> > Something else missing from the apidox class description is how the model
> > is organised - I presume that it's in a tree structure which mirrors the
> > Collection/Item tree structure, but it's not actually stated.
> > 
> 
> I added some more explicit information to the dox about this. 

Thanks - the general description is improved. But I still think it would be useful if in the apidox it was possible to explain when you can use entityData() rather than data() - currently, the only way to know is to look at the source code to find out which roles are handled by data() without being passed on to entityData(). At the very least, there should be a warning that some roles are not passed to entityData() for handling.

> Can you tell me how you change the background colour of items if not by 
> using the EntityDisplayAttribute? Is the background colour built into the 
> alarm payload itself?

I'm initially basing the Akonadi-based code on how I did it in pre-Akonadi code, and then I'll see how it goes. The background colour in KAlarm's alarm list for each alarm is user-defined per Collection - it allows the user to differentiate different calendars by colour. I haven't introduced any Attributes for this since it is a per-user setting, so I'm intending storing it in KAlarm's config file on the assumption that Attributes apply to all users.

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