Buteo Synchronization Framework
Signals | Public Member Functions | List of all members
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. More...
 
void finished (const QString &aProfileName, Sync::SyncStatus aStatus, const QString &aMessage, SyncResults::MinorCode aErrorCode)
 Signal sent when the session has finished. More...
 
void syncProgressDetail (const QString &aProfileName, int aProgressDetail)
 Signal sent when the sync is in progress to indicate the detail of the progress. More...
 

Public Member Functions

 SyncSession (SyncProfile *aProfile, QObject *aParent=0)
 Constructor. More...
 
virtual ~SyncSession ()
 Destructor.
 
void setPluginRunner (PluginRunner *aPluginRunner, bool aTransferOwnership)
 Associates a plug-in runner with this session. More...
 
PluginRunnerpluginRunner ()
 Gets the plug-in runner associated with this session. More...
 
bool isFinished ()
 Returns if the sync session is finished or in process. More...
 
bool isAborted ()
 Returns if the sync session was aborted. More...
 
bool start ()
 Starts the session using the associated plug-in runner. More...
 
void abort (Sync::SyncStatus aStatus=Sync::SYNC_ABORTED)
 Aborts the session. Returns when the abort request is sent. More...
 
void stop ()
 Stops the session. Returns when the session is stopped.
 
SyncProfileprofile () const
 Gets the sync profile used by this session. More...
 
QString profileName () const
 Gets the name of the profile used by this session. More...
 
SyncResults results () const
 Gets the results of the finished session. More...
 
void setScheduled (bool aScheduled)
 Sets if the session was started by the scheduler. More...
 
bool isScheduled () const
 Checks if the session was started by the scheduler. More...
 
void updateResults (const SyncResults &aResults)
 Sets the results for this session. More...
 
void setFailureResult (SyncResults::MajorCode aMajorCode, SyncResults::MinorCode aMinorCode)
 Sets the results for this session using the provided error code. More...
 
bool reserveStorages (StorageBooker *aStorageBooker)
 Tries to reserve storages needed by the session. More...
 
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 More...
 
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
aProfileSyncProfile associated with the session. With server plug-in initiated sessions this can be null, if there is no profile with a matching destination address.
aParentParent 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
aProfileNameName of the profile used by the session
aStatusStatus of the finished session
aMessagePossible textual message
aErrorCodeError 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
aStorageBookerStorake 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
aMajorCodeError code
aMinorCodefailed reason

◆ setPluginRunner()

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

Associates a plug-in runner with this session.

Parameters
aPluginRunnerThe plug-in runner to use for this session
aTransferOwnershipDoes 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
aScheduledTrue 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
aProfileNameName of the profile used by the session
aMimeTypeMimetype 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
aProfileNameName of the profile used by the session
aProgressDetailDetail of the progress.

◆ transferProgress

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

◆ 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
aResultsThe results to set

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