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

David Jarvie djarvie at kde.org
Fri Sep 10 22:11:22 BST 2010


On Friday 10 September 2010 08:07:17 Kevin Krammer wrote:
> On Friday, 2010-09-10, David Jarvie wrote:
> > On Friday 10 September 2010 07:23:27 Kevin Krammer wrote:
> > > On Friday, 2010-09-10, David Jarvie wrote:
> > > > Sometimes calling Collection::attribute<T>() does not return the
> > > > correct value of the attribute. I find that sometimes when an
> > > > attribute is updated, and a CollectionModifyJob is then used to update
> > > > the value in the Akonadi database, the database is updated
> > > > successfully (as shown in AkonadiConsole) and the correct, new, value
> > > > of the attribute is returned if it is accessed in the
> > > > CollectionModifyJob result slot. But the next time the attribute is
> > > > accessed in a different part of the program, the old value of the
> > > > attribute is returned.
> > > 
> > > Maybe that other part of the code is still working with an older copy of
> > > the collection and thus its attribute.
> > > E.g. stored as a member and neither updated after the collection modify
> > > nor through connection to a monitor signal.
> > > 
> > > > Is some special action needed to ensure that a specific Collection
> > > > instance returns the up to date value of one of its Attributes?
> > > 
> > > No. As long as the collection is up to date, its attributes should be as
> > > well.
> > 
> > So how can the collection be updated? Is it necessary to construct a new
> > instance with the same ID?
> 
> A collection, as in an instance of Akonadi::Collection, is just an object 
> holding data in its member variables.
> A long as no "setter" is called all members keep the values they have.
> 
> So if a collection instance is stored somewhere, e.g. as a member of another 
> class, this member will always return the data the collection instance was 
> carrying at the time of assignment.

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?

-- 
David Jarvie.
KDE developer.
KAlarm author -- http://www.astrojar.org.uk/kalarm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20100910/d36620df/attachment.sig>
-------------- next part --------------
_______________________________________________
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