• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • KDE-PIM Libraries
  • Sitemap
  • Contact Us
 

akonadi

Akonadi::AgentBase

Akonadi::AgentBase Class Reference

The base class for all Akonadi agents and resources. More...

#include <agentbase.h>

Inheritance diagram for Akonadi::AgentBase:

Inheritance graph
[legend]

List of all members.


Classes

class  Observer
 The interface for reacting on monitored or replayed changes. More...

Public Types

enum  Status { Idle = 0, Running, Broken }

Signals

void error (const QString &message)
void onlineChanged (bool b)
void percent (int progress)
void reloadConfiguration ()
void status (int status, const QString &message=QString())
void warning (const QString &message)

Public Member Functions

virtual void cleanup ()
virtual void configure (WId windowId)
QString identifier () const
virtual int progress () const
virtual QString progressMessage () const
void registerObserver (Observer *observer)
virtual int status () const
virtual QString statusMessage () const
WId winIdForDialogs () const

Static Public Member Functions

template<typename T >
static int init (int argc, char **argv)

Protected Member Functions

virtual void aboutToQuit ()
 AgentBase (const QString &id)
void changeProcessed ()
ChangeRecorder * changeRecorder () const
virtual void doSetOnline (bool online)
bool isOnline () const
void setNeedsNetwork (bool needsNetwork)
void setOnline (bool state)
 ~AgentBase ()

Detailed Description

The base class for all Akonadi agents and resources.

This class is a base class for all Akonadi agents, which covers the real agent processes and all resources.

It provides:

  • lifetime management
  • change monitoring and recording
  • configuration interface
  • problem reporting

Author:
Till Adam <adam@kde.org>, Volker Krause <vkrause@kde.org>

Definition at line 58 of file agentbase.h.


Member Enumeration Documentation

enum Akonadi::AgentBase::Status

This enum describes the different states the agent can be in.

Enumerator:
Idle  The agent does currently nothing.
Running  The agent is working on something.
Broken  The agent encountered an error state.

Definition at line 214 of file agentbase.h.


Constructor & Destructor Documentation

Akonadi::AgentBase::AgentBase ( const QString &  id  )  [protected]

Creates an agent base.

Parameters:
id The instance id of the agent.

Akonadi::AgentBase::~AgentBase (  )  [protected]

Destroys the agent base.


Member Function Documentation

void AgentBase::aboutToQuit (  )  [protected, virtual]

This method is called whenever the agent application is about to quit.

Reimplement this method to do session cleanup (e.g. disconnecting from groupware server).

Definition at line 465 of file agentbase.cpp.

void AgentBase::changeProcessed (  )  [protected]

Marks the current change as processes and replays the next change if change recording is enabled (noop otherwise).

This method is called from the default implementation of the change notification slots. While not required when not using change recording, it is nevertheless recommended to call this method when done with processing a change notification.

Definition at line 506 of file agentbase.cpp.

ChangeRecorder * AgentBase::changeRecorder (  )  const [protected]

Returns the Akonadi::ChangeRecorder object used for monitoring.

Use this to configure which parts you want to monitor.

Definition at line 512 of file agentbase.cpp.

void AgentBase::cleanup (  )  [virtual]

This method is called when the agent is removed from the system, so it can do some cleanup stuff.

Definition at line 469 of file agentbase.cpp.

void AgentBase::configure ( WId  windowId  )  [virtual]

This method is called whenever the agent shall show its configuration dialog to the user.

It will be automatically called when the agent is started for the first time.

Parameters:
windowId The parent window id.

Definition at line 423 of file agentbase.cpp.

void AgentBase::doSetOnline ( bool  online  )  [protected, virtual]

This method is called whenever the online status has changed.

Reimplement this method to react on online status changes.

Reimplemented in Akonadi::ResourceBase.

Definition at line 418 of file agentbase.cpp.

void Akonadi::AgentBase::error ( const QString &  message  )  [signal]

This signal shall be used to report errors.

Parameters:
message The i18n'ed error message.

QString AgentBase::identifier (  )  const

Returns the instance identifier of this agent.

Definition at line 501 of file agentbase.cpp.

template<typename T >
static int Akonadi::AgentBase::init ( int  argc,
char **  argv 
) [inline, static]

Use this method in the main function of your agent application to initialize your agent subclass.

This method also takes care of creating a KApplication object and parsing command line arguments.

Note:
In case the given class is also derived from AgentBase::Observer it gets registered as its own observer (see AgentBase::Observer), e.g. agentInstance->registerObserver( agentInstance );
   class MyAgent : public AgentBase
   {
     ...
   };

   AKONADI_AGENT_MAIN( MyAgent )

Reimplemented in Akonadi::ResourceBase.

Definition at line 243 of file agentbase.h.

bool AgentBase::isOnline (  )  const [protected]

Returns whether the agent is currently online.

Definition at line 387 of file agentbase.cpp.

void Akonadi::AgentBase::onlineChanged ( bool  b  )  [signal]

Emitted when the online state changed.

Parameters:
state The online state.
Since:
4.2

void Akonadi::AgentBase::percent ( int  progress  )  [signal]

This signal should be emitted whenever the progress of an action in the agent (e.g.

data transfer, connection establishment to remote server etc.) has changed.

Parameters:
progress The progress of the action in percent.

int AgentBase::progress (  )  const [virtual]

This method returns the current progress of the agent in percentage.

Definition at line 373 of file agentbase.cpp.

QString AgentBase::progressMessage (  )  const [virtual]

This method returns an i18n'ed description of the current progress.

Definition at line 380 of file agentbase.cpp.

void AgentBase::registerObserver ( Observer *  observer  ) 

Registers the given observer for reacting on monitored or recorded changes.

Parameters:
observer The change handler to register. No ownership transfer, i.e. the caller stays owner of the pointer and can reset the registration by calling this method with 0

Definition at line 495 of file agentbase.cpp.

void Akonadi::AgentBase::reloadConfiguration (  )  [signal]

Emitted if another application has changed the agents configuration remotely and called AgentInstance::reconfigure().

Since:
4.2

void AgentBase::setNeedsNetwork ( bool  needsNetwork  )  [protected]

Sets whether the agent needs network or not.

Since:
4.2
Todo:
use this in combination with Solid::Networking::Notifier to change the onLine status of the agent.

Definition at line 394 of file agentbase.cpp.

void AgentBase::setOnline ( bool  state  )  [protected]

Sets whether the agent shall be online or not.

Definition at line 409 of file agentbase.cpp.

void Akonadi::AgentBase::status ( int  status,
const QString &  message = QString() 
) [signal]

This signal should be emitted whenever the status of the agent has been changed.

Parameters:
status The new Status code.
message A i18n'ed description of the new status.

int AgentBase::status (  )  const [virtual]

This method returns the current status code of the agent.

The following return values are possible:

  • 0 - Idle
  • 1 - Running
  • 2 - Broken

Definition at line 359 of file agentbase.cpp.

QString AgentBase::statusMessage (  )  const [virtual]

This method returns an i18n'ed description of the current status code.

Definition at line 366 of file agentbase.cpp.

void Akonadi::AgentBase::warning ( const QString &  message  )  [signal]

This signal shall be used to report warnings.

Parameters:
message The i18n'ed warning message.

WId AgentBase::winIdForDialogs (  )  const

This method returns the windows id, which should be used for dialogs.

Definition at line 435 of file agentbase.cpp.


The documentation for this class was generated from the following files:
  • agentbase.h
  • agentbase.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
  • kabc
  • kblog
  • kcal
  • kimap
  • kioslave
  •   imap4
  •   mbox
  • kldap
  • kmime
  • kpimidentities
  •   richtextbuilders
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.5.7.1
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