Akonadi::AbstractContactFormatter Class

The interface for all contact formatters. More...

Header: #include <Akonadi/AbstractContactFormatter>
CMake: find_package(KPim6AkonadiContactCore REQUIRED)
target_link_libraries(mytarget PRIVATE KPim6::AkonadiContactCore)
Inherited By:

Akonadi::StandardContactFormatter and KAddressBookGrantlee::GrantleeContactFormatter

Public Types

enum HtmlForm { SelfcontainedForm, EmbeddableForm, UserForm }

Public Functions

AbstractContactFormatter()
virtual ~AbstractContactFormatter()
KContacts::Addressee contact() const
QList<QVariantMap> customFieldDescriptions() const
Akonadi::Item item() const
void setContact(const KContacts::Addressee &contact)
void setCustomFieldDescriptions(const QList<QVariantMap> &descriptions)
void setItem(const Akonadi::Item &item)
virtual QString toHtml(Akonadi::AbstractContactFormatter::HtmlForm form = SelfcontainedForm) const = 0

Detailed Description

This is the interface that can be used to format an Akonadi item with a contact payload or a contact itself as HTML.

Author: Tobias Koenig <tokoe@kde.org>

See also StandardContactFormatter.

Member Type Documentation

enum AbstractContactFormatter::HtmlForm

Describes the form of the HTML that is created.

Member Function Documentation

AbstractContactFormatter::AbstractContactFormatter()

Creates a new abstract contact formatter.

[virtual noexcept] AbstractContactFormatter::~AbstractContactFormatter()

Destroys the abstract contact formatter.

KContacts::Addressee AbstractContactFormatter::contact() const

Returns the contact that will be formatted.

See also setContact().

QList<QVariantMap> AbstractContactFormatter::customFieldDescriptions() const

Returns the custom field descriptions that will be used.

See also setCustomFieldDescriptions().

Akonadi::Item AbstractContactFormatter::item() const

Returns the item who's payload will be formatted.

See also setItem().

void AbstractContactFormatter::setContact(const KContacts::Addressee &contact)

Sets the contact that will be formatted. contact contact to be formatted

See also contact().

void AbstractContactFormatter::setCustomFieldDescriptions(const QList<QVariantMap> &descriptions)

Sets the custom field descriptions that will be used.

The description list contains a QVariantMap for each custom field with the following keys: - key (string) The identifier of the field - title (string) The i18n'ed title of the field - type (string) The type description of the field Possible values for type description are - text - numeric - boolean - date - time - datetime

descriptions list with field descriptions

See also customFieldDescriptions().

void AbstractContactFormatter::setItem(const Akonadi::Item &item)

Sets the item who's payload will be formatted.

Note: The payload must be a valid KContacts::Addressee object. item item, who's payload will be formatted.

See also item().

[pure virtual] QString AbstractContactFormatter::toHtml(Akonadi::AbstractContactFormatter::HtmlForm form = SelfcontainedForm) const

This method must be reimplemented to return the contact formatted as HTML according to the requested form.

form The form in which the HTML should be rendered (SelfcontainedForm or EmbeddableForm). \returns The contact formatted as HTML.