MailCommon::ItemContext Class

class MailCommon::ItemContext

A helper class for the filtering process. More...

Header: #include <MailCommon/ItemContext>
CMake: find_package(KPim6MailCommon REQUIRED)
target_link_libraries(mytarget PRIVATE KPim6::MailCommon)

Public Functions

ItemContext(const Akonadi::Item &item, bool needsFullPayload)
bool deleteItem() const
Akonadi::Item &item()
Akonadi::Collection moveTargetCollection() const
bool needsFlagStore() const
bool needsFullPayload() const
bool needsPayloadStore() const
void setDeleteItem()
void setMoveTargetCollection(const Akonadi::Collection &collection)
void setNeedsFlagStore()
void setNeedsPayloadStore()

Detailed Description

The item context is used to pass the item together with meta data through the filter chain. This allows to 'record' all actions that shall be taken and execute them at the end of the filter chain.

Member Function Documentation

ItemContext::ItemContext(const Akonadi::Item &item, bool needsFullPayload)

Creates an item context for the given item. needsFullPayload is true if the full payload was requested for the item.

bool ItemContext::deleteItem() const

Returns whether the item shall be deleted.

See also setDeleteItem().

Akonadi::Item &ItemContext::item()

Returns the item of the context.

Akonadi::Collection ItemContext::moveTargetCollection() const

Returns the target collection the item should be moved to, or an invalid collection if the item should not be moved at all.

See also setMoveTargetCollection().

bool ItemContext::needsFlagStore() const

Returns whether the item's flags needs to be written back.

See also setNeedsFlagStore().

bool ItemContext::needsFullPayload() const

Returns true if the full payload was requested for the item or not. Full payload is needed to change the headers or the body

bool ItemContext::needsPayloadStore() const

Returns whether the item's payload needs to be written back.

See also setNeedsPayloadStore().

void ItemContext::setDeleteItem()

Marks that the item shall be deleted.

See also deleteItem().

void ItemContext::setMoveTargetCollection(const Akonadi::Collection &collection)

Sets the target collection the item should be moved to.

See also moveTargetCollection().

void ItemContext::setNeedsFlagStore()

Marks that the item's flags has been changed and needs to be written back.

See also needsFlagStore().

void ItemContext::setNeedsPayloadStore()

Marks that the item's payload has been changed and needs to be written back.

See also needsPayloadStore().