Akonadi::Attribute
#include <attribute.h>
Public Types | |
using | List = QList<Attribute *> |
Public Member Functions | |
virtual | ~Attribute () |
virtual Attribute * | clone () const =0 |
virtual void | deserialize (const QByteArray &data)=0 |
virtual QByteArray | serialized () const =0 |
virtual QByteArray | type () const =0 |
Protected Member Functions | |
Attribute (const Attribute &)=default | |
Detailed Description
Provides interface for custom attributes for Entity.
This class is an interface for custom attributes, that can be stored in an entity. Attributes should be meta data, e.g. ACLs, quotas etc. that are not part of the entities' data itself.
Note that attributes are per user, i.e. when an attribute is added to an entity, it only applies to the current user.
To provide custom attributes, you have to subclass from this interface and reimplement the pure virtual methods.
Additionally, you need to register your attribute with Akonadi::AttributeFactory for automatic deserialization during retrieving of collections or items:
Third party attributes need to be registered once by each application that uses them. So the above snippet needs to be in the resource that adds the attribute, and each application that uses the resource. This may be simplified in the future.
The custom attributes can be used in the following way:
and
Definition at line 131 of file attribute.h.
Member Typedef Documentation
◆ List
using Akonadi::Attribute::List = QList<Attribute *> |
Describes a list of attributes.
Definition at line 137 of file attribute.h.
Constructor & Destructor Documentation
◆ ~Attribute()
|
virtualdefault |
Destroys this attribute.
Member Function Documentation
◆ clone()
|
pure virtual |
Creates a copy of this attribute.
Implemented in Akonadi::CollectionAnnotationsAttribute, Akonadi::CollectionColorAttribute, Akonadi::CollectionIdentificationAttribute, Akonadi::CollectionQuotaAttribute, Akonadi::EntityAnnotationsAttribute, Akonadi::EntityDeletedAttribute, Akonadi::EntityDisplayAttribute, Akonadi::EntityHiddenAttribute, Akonadi::MDNStateAttribute, Akonadi::SpecialCollectionAttribute, and Akonadi::TagAttribute.
◆ deserialize()
|
pure virtual |
Sets the data of this attribute, using the same encoding as returned by toByteArray().
- Parameters
-
data The encoded attribute data.
Implemented in Akonadi::CollectionAnnotationsAttribute, Akonadi::CollectionColorAttribute, Akonadi::CollectionIdentificationAttribute, Akonadi::CollectionQuotaAttribute, Akonadi::EntityAnnotationsAttribute, Akonadi::EntityDeletedAttribute, Akonadi::EntityDisplayAttribute, Akonadi::EntityHiddenAttribute, Akonadi::MDNStateAttribute, Akonadi::SpecialCollectionAttribute, and Akonadi::TagAttribute.
◆ serialized()
|
pure virtual |
Returns a QByteArray representation of the attribute which will be storaged.
This can be raw binary data, no encoding needs to be applied.
Implemented in Akonadi::CollectionAnnotationsAttribute, Akonadi::CollectionColorAttribute, Akonadi::CollectionIdentificationAttribute, Akonadi::CollectionQuotaAttribute, Akonadi::EntityAnnotationsAttribute, Akonadi::EntityDeletedAttribute, Akonadi::EntityDisplayAttribute, Akonadi::EntityHiddenAttribute, Akonadi::MDNStateAttribute, Akonadi::SpecialCollectionAttribute, and Akonadi::TagAttribute.
◆ type()
|
pure virtual |
Returns the type of the attribute.
Implemented in Akonadi::CollectionAnnotationsAttribute, Akonadi::CollectionColorAttribute, Akonadi::CollectionIdentificationAttribute, Akonadi::CollectionQuotaAttribute, Akonadi::EntityAnnotationsAttribute, Akonadi::EntityDeletedAttribute, Akonadi::EntityDisplayAttribute, Akonadi::EntityHiddenAttribute, Akonadi::MDNStateAttribute, Akonadi::SpecialCollectionAttribute, and Akonadi::TagAttribute.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 29 2024 11:49:12 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.