• Skip to content
  • Skip to link menu
KDE 4.6 API Reference
  • KDE API Reference
  • KDE-PIM Libraries
  • KDE Home
  • Contact Us
 

akonadi

  • Akonadi
  • ItemFetchScope
Public Types | Public Member Functions
Akonadi::ItemFetchScope Class Reference

Specifies which parts of an item should be fetched from the Akonadi storage. More...

#include <itemfetchscope.h>

List of all members.

Public Types

enum  AncestorRetrieval { None, Parent, All }

Public Member Functions

 ItemFetchScope ()
 ItemFetchScope (const ItemFetchScope &other)
 ~ItemFetchScope ()
bool allAttributes () const
AncestorRetrieval ancestorRetrieval () const
QSet< QByteArray > attributes () const
bool cacheOnly () const
void fetchAllAttributes (bool fetch=true)
void fetchAttribute (const QByteArray &type, bool fetch=true)
template<typename T >
void fetchAttribute (bool fetch=true)
void fetchFullPayload (bool fetch=true)
bool fetchModificationTime () const
void fetchPayloadPart (const QByteArray &part, bool fetch=true)
bool fullPayload () const
bool isEmpty () const
ItemFetchScope & operator= (const ItemFetchScope &other)
QSet< QByteArray > payloadParts () const
void setAncestorRetrieval (AncestorRetrieval ancestorDepth)
void setCacheOnly (bool cacheOnly)
void setFetchModificationTime (bool retrieveMtime)

Detailed Description

Specifies which parts of an item should be fetched from the Akonadi storage.

When items are fetched from server either by using ItemFetchJob explicitly or when it is being used internally by other classes, e.g. ItemModel, the scope of the fetch operation can be tailored to the application's current needs.

There are two supported ways of changing the currently active ItemFetchScope of classes:

  • in-place: modify the ItemFetchScope object the other class holds as a member
  • replace: replace the other class' member with a new scope object

Example: modifying an ItemFetchJob's scope in-place

 Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob( collection );
 job->fetchScope().fetchFullPayload();
 job->fetchScope().fetchAttribute<MyAttribute>();

Example: replacing an ItemFetchJob's scope

 Akonadi::ItemFetchScope scope;
 scope.fetchFullPayload();
 scope.fetchAttribute<MyAttribute>();

 Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob( collection );
 job->setFetchScope( scope );

This class is implicitly shared.

Author:
Kevin Krammer <kevin.krammer@gmx.at>

Definition at line 67 of file itemfetchscope.h.


Member Enumeration Documentation

enum Akonadi::ItemFetchScope::AncestorRetrieval

Describes the ancestor retrieval depth.

Since:
4.4
Enumerator:
None 

No ancestor retrieval at all (the default)

Parent 

Only retrieve the immediate parent collection.

All 

Retrieve all ancestors, up to Collection::root()

Definition at line 74 of file itemfetchscope.h.


Constructor & Destructor Documentation

ItemFetchScope::ItemFetchScope ( )

Creates an empty item fetch scope.

Using an empty scope will only fetch the very basic meta data of items, e.g. local id, remote id and mime type

Definition at line 28 of file itemfetchscope.cpp.

ItemFetchScope::ItemFetchScope ( const ItemFetchScope &  other)

Creates a new item fetch scope from an other.

Definition at line 33 of file itemfetchscope.cpp.

ItemFetchScope::~ItemFetchScope ( )

Destroys the item fetch scope.

Definition at line 38 of file itemfetchscope.cpp.


Member Function Documentation

bool ItemFetchScope::allAttributes ( ) const

Returns whether all available attributes should be fetched.

See also:
fetchAllAttributes()

Definition at line 86 of file itemfetchscope.cpp.

ItemFetchScope::AncestorRetrieval ItemFetchScope::ancestorRetrieval ( ) const

Returns the ancestor retrieval depth.

See also:
setAncestorRetrieval()
Since:
4.4

Definition at line 111 of file itemfetchscope.cpp.

QSet< QByteArray > ItemFetchScope::attributes ( ) const

Returns all explicitly fetched attributes.

Undefined if fetchAllAttributes() returns true.

See also:
fetchAttribute()

Definition at line 149 of file entity.cpp.

bool ItemFetchScope::cacheOnly ( ) const

Returns whether payload data should be requested from remote sources or just from the local cache.

See also:
setCacheOnly()

Definition at line 101 of file itemfetchscope.cpp.

void ItemFetchScope::fetchAllAttributes ( bool  fetch = true)

Sets whether all available attributes should be fetched.

The default is false.

Parameters:
fetchtrue if all available attributes should be fetched, false otherwise.

Definition at line 91 of file itemfetchscope.cpp.

template<typename T >
void Akonadi::ItemFetchScope::fetchAttribute ( bool  fetch = true) [inline]

Sets whether the attribute of the requested type should be fetched.

Parameters:
fetchtrue if the attribute should be fetched, false otherwise.

Definition at line 156 of file itemfetchscope.h.

void Akonadi::ItemFetchScope::fetchAttribute ( const QByteArray &  type,
bool  fetch = true 
)

Sets whether the attribute of the given type should be fetched.

Parameters:
typeThe attribute type to fetch.
fetchtrue if the attribute should be fetched, false otherwise.
void ItemFetchScope::fetchFullPayload ( bool  fetch = true)

Sets whether the full payload shall be fetched.

The default is false.

Parameters:
fetchtrue if the full payload should be fetched, false otherwise.

Definition at line 68 of file itemfetchscope.cpp.

bool ItemFetchScope::fetchModificationTime ( ) const

Returns whether item modification time should be retrieved.

See also:
setFetchModificationTime()
Since:
4.6

Definition at line 126 of file itemfetchscope.cpp.

void ItemFetchScope::fetchPayloadPart ( const QByteArray &  part,
bool  fetch = true 
)

Sets which payload parts shall be fetched.

Parameters:
partThe payload part identifier. Valid values depend on the item type.
fetchtrue to fetch this part, false otherwise.

Definition at line 55 of file itemfetchscope.cpp.

bool ItemFetchScope::fullPayload ( ) const

Returns whether the full payload should be fetched.

See also:
fetchFullPayload()

Definition at line 63 of file itemfetchscope.cpp.

bool Akonadi::ItemFetchScope::isEmpty ( ) const

Returns true if there is nothing to fetch.

ItemFetchScope& Akonadi::ItemFetchScope::operator= ( const ItemFetchScope &  other)

Assigns the other to this scope and returns a reference to this scope.

QSet< QByteArray > ItemFetchScope::payloadParts ( ) const

Returns the payload parts that should be fetched.

See also:
fetchPayloadPart()

Definition at line 50 of file itemfetchscope.cpp.

void ItemFetchScope::setAncestorRetrieval ( AncestorRetrieval  ancestorDepth)

Sets how many levels of ancestor collections should be included in the retrieval.

The default is AncestorRetrieval::None.

Parameters:
ancestorDepthThe desired ancestor retrieval depth.
Since:
4.4

Definition at line 116 of file itemfetchscope.cpp.

void ItemFetchScope::setCacheOnly ( bool  cacheOnly)

Sets whether payload data should be requested from remote sources or just from the local cache.

Parameters:
cacheOnlytrue if no remote data should be requested, false otherwise (the default).

Definition at line 106 of file itemfetchscope.cpp.

void ItemFetchScope::setFetchModificationTime ( bool  retrieveMtime)

Enables retrieval of the item modification time.

This is enabled by default for backward compatibility reasons.

Parameters:
retrieveMtimetrue to retrieve the modification time, false otherwise
Since:
4.6

Definition at line 121 of file itemfetchscope.cpp.


The documentation for this class was generated from the following files:
  • itemfetchscope.h
  • entity.cpp
  • itemfetchscope.cpp

akonadi

Skip menu "akonadi"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

KDE-PIM Libraries

Skip menu "KDE-PIM Libraries"
  • akonadi
  •   contact
  •   kmime
  • kabc
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  •   richtextbuilders
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.7.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal