[Kde-pim] Akonadi collection attribute not being fetched correctly

Stephen Kelly steveire at gmail.com
Sat Sep 11 13:07:42 BST 2010


David Jarvie wrote:
> 
> The collection instance which contains the out of date attribute value is
> obtained at the time of usage by calling
> FavoriteCollectionsModel::collections(). Would I be right in thinking that
> FavoriteCollectionsModel needs to be fixed so that the collection list
> which it returns contains up to date values?
> 

FavoriteCollectionsModel::collections() almost certainly doesn't do what you 
think it does. If you want collections you get them through the data() 
method of the model and they will be up to date.

Depending on what it is you're trying to do, that might be this:

/*
* @code
*   FavoriteCollectionsModel* favs = getFavsModel();
*   Collection::List cols;
*   const int rowCount = favs->rowCount();
*   for (int row = 0; row < rowcount; ++row) {
*     static const int column = 0;
*     const QModelIndex index = favs->index(row, column);
*     const Collection col = 
index.data(EntityTreeModel::CollectionRole).value<Collection>();
*     cols << col;
*   }
* @endcode
*/

But if that's what you do then there is probably a better way of doing what 
you are trying to do.

All the best,

Steve.

_______________________________________________
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