Buteo::SyncSession Class Reference

Class representing a single sync session. More...

`#include <SyncSession.h>`

Inheritance diagram for Buteo::SyncSession:

## Signals

void | transferProgress (const QString &aProfileName, Sync::TransferDatabase aDatabase, Sync::TransferType aType, const QString &aMimeType, int aCommittedItems)
void | storageAccquired (const QString &aProfileName, const QString &aMimeType)
| Signal sent when a storage is accquired.
void | finished (const QString &aProfileName, Sync::SyncStatus aStatus, const QString &aMessage, SyncResults::MinorCode aErrorCode)
| Signal sent when the session has finished.
void | syncProgressDetail (const QString &aProfileName, int aProgressDetail)
| Signal sent when the sync is in progress to indicate the detail of the progress.

## Public Member Functions

| SyncSession (SyncProfile *aProfile, QObject *aParent=0)
| Constructor.
virtual | ~SyncSession ()
| Destructor.
void | setPluginRunner (PluginRunner *aPluginRunner, bool aTransferOwnership)
| Associates a plug-in runner with this session.
PluginRunner * | pluginRunner ()
| Gets the plug-in runner associated with this session.
bool | isFinished ()
| Returns if the sync session is finished or in process.
bool | isAborted ()
| Returns if the sync session was aborted.
bool | start ()
| Starts the session using the associated plug-in runner.
void | abort (Sync::SyncStatus aStatus=Sync::SYNC_ABORTED)
| Aborts the session. Returns when the abort request is sent.
void | stop ()
| Stops the session. Returns when the session is stopped.
SyncProfile * | profile () const
| Gets the sync profile used by this session.
QString | profileName () const
| Gets the name of the profile used by this session.
SyncResults | results () const
| Gets the results of the finished session.
void | setScheduled (bool aScheduled)
| Sets if the session was started by the scheduler.
bool | isScheduled () const
| Checks if the session was started by the scheduler.
void | updateResults (const SyncResults &aResults)
| Sets the results for this session.
void | setFailureResult (SyncResults::MajorCode aMajorCode, SyncResults::MinorCode aMinorCode)
| Sets the results for this session using the provided error code.
bool | reserveStorages (StorageBooker *aStorageBooker)
| Tries to reserve storages needed by the session.
void | releaseStorages ()
| Releases storages that were reserved earlier with reserveStorages.
QMap< QString, bool > | getStorageMap ()
| returns the StorageMap used for this session
void | setStorageMap (QMap< QString, bool > &aStorageMap)
| sets the storage map for this session
bool | isProfileCreated ()
| returns the returns the status of the profile creation for this session
void | setProfileCreated (bool aProfileCreated)
| sets Profile Created flag to true
Sync::SyncStatus | mapToSyncStatusError (int aErrorCode)
| Maps sync failure error code from stack to SyncStatus.

## Detailed Description

Class representing a single sync session.

The session can be initiated by a client or server plug-in

## Constructor & Destructor Documentation

## SyncSession()

SyncSession::SyncSession | ( | SyncProfile * | aProfile,
|  | QObject * | aParent = 0 )

explicit

Constructor.

Parameters

  aProfile | SyncProfile associated with the session. With server plug-in initiated sessions this can be null, if there is no profile with a matching destination address.
  aParent | Parent object

## Member Function Documentation

## abort()

void SyncSession::abort | ( | Sync::SyncStatus | aStatus = Sync::SYNC_ABORTED | ) |

Aborts the session. Returns when the abort request is sent.

Parameters

  - | Status.

## finished

void Buteo::SyncSession::finished | ( | const QString & | aProfileName,
|  | Sync::SyncStatus | aStatus,
|  | const QString & | aMessage,
|  | SyncResults::MinorCode | aErrorCode )

signal

Signal sent when the session has finished.

Parameters

  aProfileName | Name of the profile used by the session
  aStatus | Status of the finished session
  aMessage | Possible textual message
  aErrorCode | Error code, if the status is error

## isAborted()

bool SyncSession::isAborted | ( |  | ) |

Returns if the sync session was aborted.

Returns
  Aborted indicator

## isFinished()

bool SyncSession::isFinished | ( |  | ) |

Returns if the sync session is finished or in process.

Returns
  Finished indicator

## isScheduled()

bool SyncSession::isScheduled | ( |  | ) | const

Checks if the session was started by the scheduler.

Returns
  True if scheduled, false otherwise

## pluginRunner()

PluginRunner * SyncSession::pluginRunner | ( |  | ) |

Gets the plug-in runner associated with this session.

Returns
  Plug-in runner

## profile()

SyncProfile * SyncSession::profile | ( |  | ) | const

Gets the sync profile used by this session.

Returns
  Sync profile

## profileName()

QString SyncSession::profileName | ( |  | ) | const

Gets the name of the profile used by this session.

Returns
  Profile name

## reserveStorages()

bool SyncSession::reserveStorages | ( | StorageBooker * | aStorageBooker | ) |

Tries to reserve storages needed by the session.

Successfully reserved storages are automatically released when the session is deleted.

Parameters

  aStorageBooker | Storake booker to use for reserving the storages. If reserving is successfull, this booker is saved internally and used later to release the storages when the session is deleted.

Returns
  Success indicator. True if all storages were successfully reserved. When false, no storages were reserved, meaning one or more of the needed storages were already in use.

## results()

SyncResults SyncSession::results | ( |  | ) | const

Gets the results of the finished session.

This function should be called only after the finished signal is received from the session.

Returns
  Sync results

## setFailureResult()

void SyncSession::setFailureResult | ( | SyncResults::MajorCode | aMajorCode,
|  | SyncResults::MinorCode | aMinorCode )

Sets the results for this session using the provided error code.

This function can be used in error situations to set the results to this session, even if the session has failed to run. Time stamp for the results is set to current time.

Parameters

  aMajorCode | Error code
  aMinorCode | failed reason

## setPluginRunner()

void SyncSession::setPluginRunner | ( | PluginRunner * | aPluginRunner,
|  | bool | aTransferOwnership )

Associates a plug-in runner with this session.

Parameters

  aPluginRunner | The plug-in runner to use for this session
  aTransferOwnership | Does this session become the owner of the plug-in runner instance. If so, the plug-in runner is deleted when the session is deleted.

## setScheduled()

void SyncSession::setScheduled | ( | bool | aScheduled | ) |

Sets if the session was started by the scheduler.

Parameters

  aScheduled | True if scheduled, false otherwise

## setStorageMap()

void SyncSession::setStorageMap | ( | QMap< QString, bool > & | aStorageMap | ) |

sets the storage map for this session

Parameters

  aStorageMap | - storage map to set

## start()

bool SyncSession::start | ( |  | ) |

Starts the session using the associated plug-in runner.

Returns
  Success indicator

## storageAccquired

void Buteo::SyncSession::storageAccquired | ( | const QString & | aProfileName,
|  | const QString & | aMimeType )

signal

Signal sent when a storage is accquired.

Parameters

  aProfileName | Name of the profile used by the session
  aMimeType | Mimetype of the storage accquired.

## syncProgressDetail

void Buteo::SyncSession::syncProgressDetail | ( | const QString & | aProfileName,
|  | int | aProgressDetail )

signal

Signal sent when the sync is in progress to indicate the detail of the progress.

Parameters

  aProfileName | Name of the profile used by the session
  aProgressDetail | Detail of the progress.

## transferProgress

void Buteo::SyncSession::transferProgress | ( | const QString & | aProfileName,
|  | Sync::TransferDatabase | aDatabase,
|  | Sync::TransferType | aType,
|  | const QString & | aMimeType,
|  | int | aCommittedItems )

signal

See also
  SyncPluginBase::transferProgress

## updateResults()

void SyncSession::updateResults | ( | const SyncResults & | aResults | ) |

Sets the results for this session.

This function can be used in error situations to set the results to this session, even if the session has failed to run.

Parameters

  aResults | The results to set

The documentation for this class was generated from the following files:

- SyncSession.h
- SyncSession.cpp