Akonadi::AttributeFactory Class

class Akonadi::AttributeFactory

Provides the functionality of registering and creating arbitrary entity attributes. More...

Header: #include <Akonadi/AttributeFactory>
CMake: find_package(KPim6 REQUIRED COMPONENTS AkonadiCore)
target_link_libraries(mytarget PRIVATE KPim6::AkonadiCore)

Static Public Members

Akonadi::Attribute *createAttribute(const QByteArray &type)
void registerAttribute()

Detailed Description

This class provides the functionality of registering and creating arbitrary Attributes for Entity and its subclasses (e.g. Item and Collection).

 // register the type first
 Akonadi::AttributeFactory::registerAttribute<SecrecyAttribute>();

 ...

 // use it anywhere else in the application
 SecrecyAttribute *attr = Akonadi::AttributeFactory::createAttribute( "secrecy" );

Author: Volker Krause <vkrause@kde.org>

Member Function Documentation

[static] Akonadi::Attribute *AttributeFactory::createAttribute(const QByteArray &type)

Creates an entity attribute object of the given type. If the type has not been registered, creates a DefaultAttribute.

type The attribute type.

[static] template <typename T> void AttributeFactory::registerAttribute()

Registers a custom attribute of type T. The same attribute cannot be registered more than once.