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.
virtual QStringList | allVisibleSyncProfiles ()
| Gets all visible sync profiles.
virtual QString | syncProfile (const QString &aProfileId)
| Gets a sync profile.
virtual QStringList | syncProfilesByKey (const QString &aKey, const QString &aValue)
virtual QStringList | syncProfilesByType (const QString &aType)
virtual QStringList | profilesByType (const QString &aType) override
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.
QList< unsigned int > | syncingAccounts ()
| Returns the list of account IDs for which sync is ongoing.
int | status (unsigned int aAccountId, int &aFailedReason, qlonglong &aPrevSyncTime, qlonglong &aNextSyncTime)
| Returns the status of the sync for the given account Id.
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.
Public Slots inherited from Buteo::SyncDBusInterface
virtual bool | startSync (QString aProfileId)=0
| Requests to starts synchronizing using a profile with the given name.
virtual Q_NOREPLY void | abortSync (QString aProfileId)=0
| Stops synchronizing the profile with the given name.
virtual bool | removeProfile (QString aProfileId)=0
| This function should be called when sync profile has to be deleted.
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.
virtual bool | requestStorages (QStringList aStorageNames)=0
| Requests sync daemon to reserve storages for the caller.
virtual Q_NOREPLY void | releaseStorages (QStringList aStorageNames)=0
| Releases the given storages so that sync daemon can again use them freely.
virtual QStringList | runningSyncs ()=0
| Gets the list of profile names of currently running syncs.
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
virtual bool | saveSyncResults (QString aProfileId, QString aSyncResults)=0
| Save SyncResults to log.xml file.
virtual QString | getLastSyncResult (const QString &aProfileId)=0
| To get lastSyncResult.
virtual QStringList | allVisibleSyncProfiles ()=0
| Gets all visible sync profiles.
virtual QString | syncProfile (const QString &aProfileId)=0
| Gets a sync profile.
virtual QStringList | syncProfilesByKey (const QString &aKey, const QString &aValue)=0
| Gets a sync profiles matching the key-value.
virtual QStringList | profilesByType (const QString &aType)=0
| Gets all profiles matching the profile type.
virtual QStringList | syncProfilesByType (const QString &aType)=0
| Gets a profiles matching the profile type.
virtual Q_NOREPLY void | start (unsigned int aAccountId)=0
| Starts sync for all profiles matching the given account ID.
virtual Q_NOREPLY void | stop (unsigned int aAccountId)=0
| Stops sync for all profiles matching the given account ID.
virtual QList< unsigned int > | syncingAccounts ()=0
| Returns the list of account IDs for which sync is ongoing.
virtual int | status (unsigned int aAccountId, int &aFailedReason, qlonglong &aPrevSyncTime, qlonglong &aNextSyncTime)=0
| Returns the status of the sync for the given account Id.
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.
virtual QString | createSyncProfileForAccount (uint aAccountId)=0
| Create a sync profile for the account if it does not exists.
virtual bool | startSync (QString aProfileId)=0
| Requests to starts synchronizing using a profile with the given name.
virtual Q_NOREPLY void | abortSync (QString aProfileId)=0
| Stops synchronizing the profile with the given name.
virtual bool | removeProfile (QString aProfileId)=0
| This function should be called when sync profile has to be deleted.
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.
virtual bool | requestStorages (QStringList aStorageNames)=0
| Requests sync daemon to reserve storages for the caller.
virtual Q_NOREPLY void | releaseStorages (QStringList aStorageNames)=0
| Releases the given storages so that sync daemon can again use them freely.
virtual QStringList | runningSyncs ()=0
| Gets the list of profile names of currently running syncs.
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
virtual bool | saveSyncResults (QString aProfileId, QString aSyncResults)=0
| Save SyncResults to log.xml file.
virtual QString | getLastSyncResult (const QString &aProfileId)=0
| To get lastSyncResult.
virtual QStringList | allVisibleSyncProfiles ()=0
| Gets all visible sync profiles.
virtual QString | syncProfile (const QString &aProfileId)=0
| Gets a sync profile.
virtual QStringList | syncProfilesByKey (const QString &aKey, const QString &aValue)=0
| Gets a sync profiles matching the key-value.
virtual QStringList | syncProfilesByType (const QString &aType)=0
| Gets a profiles matching the profile type.
virtual Q_NOREPLY void | start (unsigned int aAccountId)=0
| Starts sync for all profiles matching the given account ID.
virtual Q_NOREPLY void | stop (unsigned int aAccountId)=0
| Stops sync for all profiles matching the given account ID.
virtual QList< unsigned int > | syncingAccounts ()=0
| Returns the list of account IDs for which sync is ongoing.
virtual int | status (unsigned int aAccountId, int &aFailedReason, qlonglong &aPrevSyncTime, qlonglong &aNextSyncTime)=0
| Returns the status of the sync for the given account Id.

## 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.
Signals inherited from Buteo::SyncDBusInterface
void | syncStatus (QString aProfileName, int aStatus, QString aMessage, int aMoreDetails)
| Notifies about a change in synchronization status.
void | transferProgress (QString aProfileName, int aTransferDatabase, int aTransferType, QString aMimeType, int aCommittedItems)
| Notifies about progress in transferring items.
void | signalProfileChanged (QString aProfileName, int aChangeType, QString aProfileAsXml)
| Notifies about a change in profile.
void | backupInProgress ()
| Notifies about Backup start.
void | backupDone ()
| Notifies about Backup done.
void | restoreInProgress ()
| Notifies about Restore start.
void | restoreDone ()
| Notifies about Restore Done.
void | resultsAvailable (QString aProfileName, QString aResultsAsXml)
| Notifies about the availability of Results for a recent sync.
void | statusChanged (unsigned int aAccountId, int aNewStatus, int aFailedReason, qlonglong aPrevSyncTime, qlonglong aNextSyncTime)
| Notifies sync status change for a set of account Ids.
bool | isConnectivityAvailable (int connectivityType)
| Returns the connectivity state of a specific medium like bluetooth, USB or network.
void | syncedExternallyStatus (uint aAccountId, const QString &aClientProfileName, bool aState)
| Notifies sync externally status for an account and client profile.
void | syncStatus (QString aProfileName, int aStatus, QString aMessage, int aMoreDetails)
| Notifies about a change in synchronization status.
void | transferProgress (QString aProfileName, int aTransferDatabase, int aTransferType, QString aMimeType, int aCommittedItems)
| Notifies about progress in transferring items.
void | signalProfileChanged (QString aProfileName, int aChangeType, QString aProfileAsXml)
| Notifies about a change in profile.
void | backupInProgress ()
| Notifies about Backup start.
void | backupDone ()
| Notifies about Backup done.
void | restoreInProgress ()
| Notifies about Restore start.
void | restoreDone ()
| Notifies about Restore Done.
void | resultsAvailable (QString aProfileName, QString aResultsAsXml)
| Notifies about the availability of Results for a recent sync.
void | statusChanged (unsigned int aAccountId, int aNewStatus, int aFailedReason, qlonglong aPrevSyncTime, qlonglong aNextSyncTime)
| Notifies sync status change for a set of account Ids.

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

virtual slot

See also
  SyncDBusInterface::abortSync

## allVisibleSyncProfiles

QStringList Synchronizer::allVisibleSyncProfiles | ( |  | ) |

virtual slot

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

virtual slot

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

virtual slot

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

virtual slot

See also
  SyncDBusInterface::releaseStorages

## removeProfile

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

virtual slot

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

virtual slot

See also
  SyncDBusInterface::requestStorages

## runningSyncs

QStringList Synchronizer::runningSyncs | ( |  | ) |

virtual slot

See also
  SyncDBusInterface::runningSyncs

## saveSyncResults

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

virtual slot

See also
  SyncDBusInterface::saveSyncResults

## setSyncSchedule

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

virtual slot

See also
  SyncDBusInterface::setSyncSchedule

## startSync

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

virtual slot

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

virtual slot

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

virtual slot

See also
  SyncDBusInterface::updateProfile

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

- synchronizer.h
- synchronizer.cpp