Buteo Synchronization Framework: Buteo::Synchronizer Class Reference

Buteo Synchronization Framework

Public Slots | Signals | Public Member Functions | List of all members
Buteo::Synchronizer Class Reference

The main entry point to the synchronization framework. More...

`#include <synchronizer.h>`

Inheritance diagram for Buteo::Synchronizer:

## Public Slots
virtual bool | startSync (QString aProfileName)
virtual void | abortSync (QString aProfileName)
virtual bool | removeProfile (QString aProfileAsXml)
virtual bool | updateProfile (QString aProfileAsXml)
virtual bool | requestStorages (QStringList aStorageNames)
virtual void | releaseStorages (QStringList aStorageNames)
virtual QStringList | runningSyncs ()
virtual bool | setSyncSchedule (QString aProfileId, QString aScheduleAsXml)
virtual bool | saveSyncResults (QString aProfileId, QString aSyncResults)
virtual QString | createSyncProfileForAccount (uint aAccountId)
virtual QString | getLastSyncResult (const QString &aProfileId)
| To get lastSyncResult. More...
virtual QStringList | allVisibleSyncProfiles ()
| Gets all visible sync profiles. More...
virtual QString | syncProfile (const QString &aProfileId)
| Gets a sync profile. More...
virtual QStringList | syncProfilesByKey (const QString &aKey, const QString &aValue)
virtual QStringList | syncProfilesByType (const QString &aType)
bool | startScheduledSync (QString aProfileName)
| Called starts a schedule sync.
void | backupStarts ()
| Called when backup starts.
void | backupFinished ()
| Called when backup is completed.
void | restoreStarts ()
| Called when starting to restore a backup.
void | restoreFinished ()
| Called when backup is restored.
virtual bool | getBackUpRestoreState ()
| Called to get the current backup/restore state.
void | start (unsigned int aAccountId)
void | stop (unsigned int aAccountId)
| Stops sync for all profiles matching the given account ID. More...
QList< unsigned int > | syncingAccounts ()
| Returns the list of account IDs for which sync is ongoing. More...
int | status (unsigned int aAccountId, int &aFailedReason, qlonglong &aPrevSyncTime, qlonglong &aNextSyncTime)
| Returns the status of the sync for the given account Id. More...
void | isSyncedExternally (unsigned int aAccountId, const QString aClientProfileName)
| Queries the sync externally status of a given account, 'syncedExternallyStatus' signal is emitted with the reply is ready, clients should listen to the later. More...
Public Slots inherited from Buteo::SyncDBusInterface
virtual bool | startSync (QString aProfileId)=0
| Requests to starts synchronizing using a profile with the given name. More...
virtual Q_NOREPLY void | abortSync (QString aProfileId)=0
| Stops synchronizing the profile with the given name. More...
virtual bool | removeProfile (QString aProfileId)=0
| This function should be called when sync profile has to be deleted. More...
virtual bool | updateProfile (QString aProfileAsXml)=0
| This function should be called when sync profile information has been changed by someone else than the sync daemon. More...
virtual bool | requestStorages (QStringList aStorageNames)=0
| Requests sync daemon to reserve storages for the caller. More...
virtual Q_NOREPLY void | releaseStorages (QStringList aStorageNames)=0
| Releases the given storages so that sync daemon can again use them freely. More...
virtual QStringList | runningSyncs ()=0
| Gets the list of profile names of currently running syncs. More...
virtual bool | getBackUpRestoreState ()=0
| This function returns true if backup/restore in progress else false.
virtual bool | setSyncSchedule (QString aProfileId, QString aScheduleAsXml)=0
| sets the schedule for a profile More...
virtual bool | saveSyncResults (QString aProfileId, QString aSyncResults)=0
| Save SyncResults to log.xml file. More...
virtual QString | getLastSyncResult (const QString &aProfileId)=0
| To get lastSyncResult. More...
virtual QStringList | allVisibleSyncProfiles ()=0
| Gets all visible sync profiles. More...
virtual QString | syncProfile (const QString &aProfileId)=0
| Gets a sync profile. More...
virtual QStringList | syncProfilesByKey (const QString &aKey, const QString &aValue)=0
| Gets a sync profiles matching the key-value. More...
virtual QStringList | syncProfilesByType (const QString &aType)=0
| Gets a profiles matching the profile type. More...
virtual Q_NOREPLY void | start (unsigned int aAccountId)=0
| Starts sync for all profiles matching the given account ID. More...
virtual Q_NOREPLY void | stop (unsigned int aAccountId)=0
| Stops sync for all profiles matching the given account ID. More...
virtual QList< unsigned int > | syncingAccounts ()=0
| Returns the list of account IDs for which sync is ongoing. More...
virtual int | status (unsigned int aAccountId, int &aFailedReason, qlonglong &aPrevSyncTime, qlonglong &aNextSyncTime)=0
| Returns the status of the sync for the given account Id. More...
virtual Q_NOREPLY void | isSyncedExternally (unsigned int aAccountId, const QString aClientProfileName)=0
| Queries the sync externally status of a given account, 'syncedExternallyStatus' signal is emitted with the reply is ready, clients should listen to the later. More...
virtual QString | createSyncProfileForAccount (uint aAccountId)=0
| Create a sync profile for the account if it does not exists. More...
virtual bool | startSync (QString aProfileId)=0
| Requests to starts synchronizing using a profile with the given name. More...
virtual Q_NOREPLY void | abortSync (QString aProfileId)=0
| Stops synchronizing the profile with the given name. More...
virtual bool | removeProfile (QString aProfileId)=0
| This function should be called when sync profile has to be deleted. More...
virtual bool | updateProfile (QString aProfileAsXml)=0
| This function should be called when sync profile information has been changed by someone else than the sync daemon. More...
virtual bool | requestStorages (QStringList aStorageNames)=0
| Requests sync daemon to reserve storages for the caller. More...
virtual Q_NOREPLY void | releaseStorages (QStringList aStorageNames)=0
| Releases the given storages so that sync daemon can again use them freely. More...
virtual QStringList | runningSyncs ()=0
| Gets the list of profile names of currently running syncs. More...
virtual bool | getBackUpRestoreState ()=0
| This function returns true if backup/restore in progress else false.
virtual bool | setSyncSchedule (QString aProfileId, QString aScheduleAsXml)=0
| sets the schedule for a profile More...
virtual bool | saveSyncResults (QString aProfileId, QString aSyncResults)=0
| Save SyncResults to log.xml file. More...
virtual QString | getLastSyncResult (const QString &aProfileId)=0
| To get lastSyncResult. More...
virtual QStringList | allVisibleSyncProfiles ()=0
| Gets all visible sync profiles. More...
virtual QString | syncProfile (const QString &aProfileId)=0
| Gets a sync profile. More...
virtual QStringList | syncProfilesByKey (const QString &aKey, const QString &aValue)=0
| Gets a sync profiles matching the key-value. More...
virtual QStringList | syncProfilesByType (const QString &aType)=0
| Gets a profiles matching the profile type. More...
virtual Q_NOREPLY void | start (unsigned int aAccountId)=0
| Starts sync for all profiles matching the given account ID. More...
virtual Q_NOREPLY void | stop (unsigned int aAccountId)=0
| Stops sync for all profiles matching the given account ID. More...
virtual QList< unsigned int > | syncingAccounts ()=0
| Returns the list of account IDs for which sync is ongoing. More...
virtual int | status (unsigned int aAccountId, int &aFailedReason, qlonglong &aPrevSyncTime, qlonglong &aNextSyncTime)=0
| Returns the status of the sync for the given account Id. More...

## Signals
void | storageReleased ()
| emitted by releaseStorages call
void | syncDone (const QString &aProfileName)
| emit this signal when the sync session is completed, this is useful when the session status is not important. More...
Signals inherited from Buteo::SyncDBusInterface
void | syncStatus (QString aProfileName, int aStatus, QString aMessage, int aMoreDetails)
| Notifies about a change in synchronization status. More...
void | transferProgress (QString aProfileName, int aTransferDatabase, int aTransferType, QString aMimeType, int aCommittedItems)
| Notifies about progress in transferring items. More...
void | signalProfileChanged (QString aProfileName, int aChangeType, QString aProfileAsXml)
| Notifies about a change in profile. More...
void | backupInProgress ()
| Notifies about Backup start. More...
void | backupDone ()
| Notifies about Backup done. More...
void | restoreInProgress ()
| Notifies about Restore start. More...
void | restoreDone ()
| Notifies about Restore Done. More...
void | resultsAvailable (QString aProfileName, QString aResultsAsXml)
| Notifies about the availability of Results for a recent sync. More...
void | statusChanged (unsigned int aAccountId, int aNewStatus, int aFailedReason, qlonglong aPrevSyncTime, qlonglong aNextSyncTime)
| Notifies sync status change for a set of account Ids. More...
bool | isConnectivityAvailable (int connectivityType)
| Returns the connectivity state of a specific medium like bluetooth, USB or network. More...
void | syncedExternallyStatus (uint aAccountId, const QString &aClientProfileName, bool aState)
| Notifies sync externally status for an account and client profile. More...
void | syncStatus (QString aProfileName, int aStatus, QString aMessage, int aMoreDetails)
| Notifies about a change in synchronization status. More...
void | transferProgress (QString aProfileName, int aTransferDatabase, int aTransferType, QString aMimeType, int aCommittedItems)
| Notifies about progress in transferring items. More...
void | signalProfileChanged (QString aProfileName, int aChangeType, QString aProfileAsXml)
| Notifies about a change in profile. More...
void | backupInProgress ()
| Notifies about Backup start. More...
void | backupDone ()
| Notifies about Backup done. More...
void | restoreInProgress ()
| Notifies about Restore start. More...
void | restoreDone ()
| Notifies about Restore Done. More...
void | resultsAvailable (QString aProfileName, QString aResultsAsXml)
| Notifies about the availability of Results for a recent sync. More...
void | statusChanged (unsigned int aAccountId, int aNewStatus, int aFailedReason, qlonglong aPrevSyncTime, qlonglong aNextSyncTime)
| Notifies sync status change for a set of account Ids. More...

## Public Member Functions
| Synchronizer (QCoreApplication *aApplication)
| The contructor.
virtual | ~Synchronizer ()
| Destructor.
bool | initialize ()
| registers the dbus service and creates handlers for various tasks of the synchronizer
void | close ()
| stops the daemon and unregisters the dbus object
virtual bool | requestStorage (const QString &aStorageName, const SyncPluginBase *aCaller)
virtual void | releaseStorage (const QString &aStorageName, const SyncPluginBase *aCaller)
virtual StoragePlugin * | createStorage (const QString &aPluginName)
virtual void | destroyStorage (StoragePlugin *aStorage)
virtual bool | isConnectivityAvailable (Sync::ConnectivityType aType)
virtual Profile * | getSyncProfileByRemoteAddress (const QString &aAddress)
virtual QString | getValue (const QString &aAddress, const QString &aKey)

## Detailed Description

The main entry point to the synchronization framework.

This class manages other components and connects them to provide the fully functioning synchronization framework.

## Member Function Documentation

## ◆ abortSync

void Synchronizer::abortSync | ( | QString | aProfileName | ) |
| virtualslot

See also
  SyncDBusInterface::abortSync

## ◆ allVisibleSyncProfiles

QStringList Synchronizer::allVisibleSyncProfiles | ( |  | ) |
| virtualslot

Gets all visible sync profiles.

Returns all sync profiles that should be visible in sync ui. A profile is visible if it has not been explicitly set as hidden.

Returns
  The list of sync profiles.

## ◆ createStorage()

StoragePlugin * Synchronizer::createStorage | ( | const QString & | aPluginName | ) |
| virtual

See also
  PluginCbInterface::createStorage

Implements Buteo::PluginCbInterface.

## ◆ createSyncProfileForAccount

QString Synchronizer::createSyncProfileForAccount | ( | uint | aAccountId | ) |
| virtualslot

See also
  SyncDBusInterface::createSyncProfileForAccount

## ◆ destroyStorage()

void Synchronizer::destroyStorage | ( | StoragePlugin * | aStorage | ) |
| virtual

See also
  PluginCbInterface::destroyStorage

Implements Buteo::PluginCbInterface.

## ◆ getLastSyncResult

QString Synchronizer::getLastSyncResult | ( | const QString & | aProfileId | ) |
| virtualslot

To get lastSyncResult.

Parameters

  aProfileId |

Returns
  QString of syncResult.

## ◆ getSyncProfileByRemoteAddress()

Profile * Synchronizer::getSyncProfileByRemoteAddress | ( | const QString & | aAddress | ) |
| virtual

See also
  PluginCbInterface::getSyncProfileByRemoteAddress

Implements Buteo::PluginCbInterface.

## ◆ getValue()

QString Synchronizer::getValue | ( | const QString & | aAddress,
|  | const QString & | aKey
| ) |  |
| virtual

See also
  PluginCbInterface::getValue

Implements Buteo::PluginCbInterface.

## ◆ isConnectivityAvailable()

bool Synchronizer::isConnectivityAvailable | ( | Sync::ConnectivityType | aType | ) |
| virtual

See also
  PluginCbInterface::isConnectivityAvailable

Implements Buteo::PluginCbInterface.

## ◆ isSyncedExternally

void Synchronizer::isSyncedExternally | ( | unsigned int | aAccountId,
|  | const QString | aClientProfileName
| ) |  |
| slot

Queries the sync externally status of a given account, 'syncedExternallyStatus' signal is emitted with the reply is ready, clients should listen to the later.

Parameters

  aAccountId | The account ID.
  aClientProfileName | The name of the client profile resposible for the sync, this is used to distinguish accounts having several services enabled.

## ◆ releaseStorage()

void Synchronizer::releaseStorage | ( | const QString & | aStorageName,
|  | const SyncPluginBase * | aCaller
| ) |  |
| virtual

See also
  PluginCbInterface::releaseStorage

Implements Buteo::PluginCbInterface.

## ◆ releaseStorages

void Synchronizer::releaseStorages | ( | QStringList | aStorageNames | ) |
| virtualslot

See also
  SyncDBusInterface::releaseStorages

## ◆ removeProfile

bool Synchronizer::removeProfile | ( | QString | aProfileAsXml | ) |
| virtualslot

See also
  SyncDBusInterface::removeProfile

## ◆ requestStorage()

bool Synchronizer::requestStorage | ( | const QString & | aStorageName,
|  | const SyncPluginBase * | aCaller
| ) |  |
| virtual

See also
  PluginCbInterface::requestStorage

Implements Buteo::PluginCbInterface.

## ◆ requestStorages

bool Synchronizer::requestStorages | ( | QStringList | aStorageNames | ) |
| virtualslot

See also
  SyncDBusInterface::requestStorages

## ◆ runningSyncs

QStringList Synchronizer::runningSyncs | ( |  | ) |
| virtualslot

See also
  SyncDBusInterface::runningSyncs

## ◆ saveSyncResults

bool Synchronizer::saveSyncResults | ( | QString | aProfileId,
|  | QString | aSyncResults
| ) |  |
| virtualslot

See also
  SyncDBusInterface::saveSyncResults

## ◆ setSyncSchedule

bool Synchronizer::setSyncSchedule | ( | QString | aProfileId,
|  | QString | aScheduleAsXml
| ) |  |
| virtualslot

See also
  SyncDBusInterface::setSyncSchedule

## ◆ startSync

bool Synchronizer::startSync | ( | QString | aProfileName | ) |
| virtualslot

See also
  SyncDBusInterface::startSync

## ◆ status

int Synchronizer::status | ( | unsigned int | aAccountId,
|  | int & | aFailedReason,
|  | qlonglong & | aPrevSyncTime,
|  | qlonglong & | aNextSyncTime
| ) |  |
| slot

Returns the status of the sync for the given account Id.

Parameters

  aAccountId | The account ID.
  aFailedReason | This is an out parameter. In case the last sync has failed, this will contain the code indicating the failure reason (TODO: Define error codes). In case the last sync has not failed, this must be ignored
  aPrevSyncTime | This is an out parameter. The previous sync time. Invalid time is returned if there was no last sync.
  aNextSyncTime | This is an out parameter. The next sync time.

Returns
  The status of sync: 0 = Sync is running, 1 = Last sync succeeded, 2 = last sync failed

## ◆ stop

void Synchronizer::stop | ( | unsigned int | aAccountId | ) |
| slot

Stops sync for all profiles matching the given account ID.

Parameters

  aAccountId | The account ID.

## ◆ syncDone

void Buteo::Synchronizer::syncDone | ( | const QString & | aProfileName | ) |
| signal

emit this signal when the sync session is completed, this is useful when the session status is not important.

Parameters

  aProfileName |

## ◆ syncingAccounts

QList< unsigned int > Synchronizer::syncingAccounts | ( |  | ) |
| slot

Returns the list of account IDs for which sync is ongoing.

Returns
  The list of account IDs currectly syncing.

## ◆ syncProfile

QString Synchronizer::syncProfile | ( | const QString & | aProfileId | ) |
| virtualslot

Gets a sync profile.

Loads and merges also all sub-profiles that are referenced from the main profile. Loads the log of finished synchronization sessions with this profile.

Parameters

  aProfileId | Name of the profile to get.

Returns
  The sync profile as Xml string.

## ◆ updateProfile

bool Synchronizer::updateProfile | ( | QString | aProfileAsXml | ) |
| virtualslot

See also
  SyncDBusInterface::updateProfile

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

- synchronizer.h
- moc_synchronizer.cpp
- synchronizer.cpp