[Kde-pim] Can't access attributes in serializer

David Jarvie djarvie at kde.org
Mon Nov 18 14:08:52 GMT 2013


On Fri, November 15, 2013 10:34 pm, Volker Krause wrote:
> On Monday 28 October 2013 12:46:53 David Jarvie wrote:
>> Is it possible to reliably access Item attributes in
>> ItemSerializerPlugin
>> classes? I've found that calling AttributeFactory::registerAttribute() in
>> the deserialize() method, to register the Attribute class, doesn't have
>> any effect - it seems to depend on whether the *application* has called
>> registerAttribute() as to whether deserialize() can access the relevant
>> Attribute class.
>
> attributes need to be registered before the item is retrieved from the
> server,
> deserialization happens afterwards. What should work is static
initialization
> in the library they are defined in, an example can be found here:
> kdepimlibs/akonadi/kmime/attributeregistrar.cpp (you can probably ignore
> the static lib part). This will automatically register your attributes when
> the corresponding library is loaded.

Thanks Volker - it was really puzzling until now! I'll update the
documentation too, to explain this.

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