Akonadi::Session Class

class Akonadi::Session

A communication session with the Akonadi storage. More...

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

Public Functions

Session(const QByteArray &sessionId = QByteArray(), QObject *parent = nullptr)
virtual ~Session() override
void clear()
QByteArray sessionId() const

Signals

void reconnected()

Static Public Members

Akonadi::Session *defaultSession()

Protected Functions

Session(Akonadi::SessionPrivate *d, const QByteArray &sessionId = QByteArray(), QObject *parent = nullptr)

Detailed Description

Every Job object has to be associated with a Session. The session is responsible of scheduling its jobs. For now only a simple serial execution is implemented (the IMAP-like protocol to communicate with the storage backend is capable of parallel execution on a single session though).

 using namespace Akonadi;

 Session *session = new Session( "mySession" );

 CollectionFetchJob *job = new CollectionFetchJob( Collection::root(),
                                                   CollectionFetchJob::Recursive,
                                                   session );

 connect(job, &KJob::result, this, &MyClass::slotResult);

Author: Volker Krause <vkrause@kde.org>

Member Function Documentation

[explicit] Session::Session(const QByteArray &sessionId = QByteArray(), QObject *parent = nullptr)

Creates a new session.

sessionId The identifier for this session, will be a random value if empty. parent The parent object.

See also defaultSession().

[explicit protected] Session::Session(Akonadi::SessionPrivate *d, const QByteArray &sessionId = QByteArray(), QObject *parent = nullptr)

Creates a new session with shared private object.

d The private object. sessionId The identifier for this session, will be a random value if empty. parent The parent object.

Note: This constructor is needed for unit testing only.

[override virtual noexcept] Session::~Session()

Destroys the session.

void Session::clear()

Stops all jobs queued for execution.

[static] Akonadi::Session *Session::defaultSession()

Returns the default session for this thread.

[signal] void Session::reconnected()

This signal is emitted whenever the session has been reconnected to the server (e.g. after a server crash).

QByteArray Session::sessionId() const

Returns the session identifier.