# class AgentBase

###

Module | akonadi
Namespace | Akonadi
Class | AgentBase
Inherits | QObject,QDBusContext

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>

### enums

- Status { Idle, Running, Broken }

enum details

### methods

- AgentBase (id)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  id | QString |

  Creates an agent base.

  id - The instance id of the agent.

- AgentBase ( )

  returns dtor

  Destroys the agent base.

- AgentBase (d, id)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  d | AgentBasePrivate |
  id | QString |

- aboutToQuit ( )

  returns Nothing

  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).

- changeProcessed ( )

  returns Nothing

  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.

- changeRecorder ( )

  returns Akonadi.ChangeRecorder

  Returns the Akonadi.ChangeRecorder object used for monitoring. Use this to configure which parts you want to monitor.

- cleanup ( )

  returns Nothing

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

- configure (windowId)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  windowId | WId |

  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.

  windowId - The parent window id.

- doSetOnline (online)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  online | bool |

  This method is called whenever the online status has changed. Reimplement this method to react on online status changes.

- error (message)

  returns Nothing
  SIGNAL ("error (const QString&)")

  Argument | Type | Default
  --- | --- | ---
  message | QString |

  This signal shall be used to report errors.

  message - The i18n'ed error message.

- identifier ( )

  returns QString

  Returns the instance identifier of this agent.

- isOnline ( )

  returns bool

  Returns whether the agent is currently online.

- percent (progress)

  returns Nothing
  SIGNAL ("percent (int)")

  Argument | Type | Default
  --- | --- | ---
  progress | int |

  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.

  progress - The progress of the action in percent.

- progress ( )

  returns int

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

- progressMessage ( )

  returns QString

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

- registerObserver (observer)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  observer | Akonadi.AgentBase.Observer |

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

  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

- setOnline (state)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  state | bool |

  Sets whether the agent shall be online or not.

- status ( )

  returns int

  This method returns the current status code of the agent.

  The following return values are possible:

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

- status (status, message)

  returns Nothing
  SIGNAL ("status (int, const QString&)")

  Argument | Type | Default
  --- | --- | ---
  status | int |
  message | QString | QString()

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

  status - The new Status code.

  message - A i18n'ed description of the new status.

- statusMessage ( )

  returns QString

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

- warning (message)

  returns Nothing
  SIGNAL ("warning (const QString&)")

  Argument | Type | Default
  --- | --- | ---
  message | QString |

  This signal shall be used to report warnings.

  message - The i18n'ed warning message.

- winIdForDialogs ( )

  returns WId

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

### enums - detail

- Status { Idle, Running, Broken }

  | Idle | - 0 | - |
  | Running | - | - |
  | Broken | - | - |