Buteo Synchronization Framework: Buteo::SyncClientInterface Class Reference

Buteo Synchronization Framework

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

SyncInterface Class - Main Entry Point for SyncFW Clients. More...

`#include <SyncClientInterface.h>`

Inheritance diagram for Buteo::SyncClientInterface:

## Signals
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 | profileChanged (QString aProfileId, int aChangeType, QString aChangedProfile)
| Notifies about a change in profile. More...
void | resultsAvailable (QString aProfileId, Buteo::SyncResults aResults)
| Notifies about the results of a recent sync for a profile. More...
void | syncStatus (QString aProfileId, int aStatus, QString aMessage, int aStatusDetails)
| Notifies about a change in synchronization status. More...
void | transferProgress (QString aProfileId, int aTransferDatabase, int aTransferType, QString aMimeType, int aCommittedItems)
| Notifies about progress in transferring items. More...

## Public Member Functions
| SyncClientInterface ()
| Constructor.
| ~SyncClientInterface ()
| Destructor.
bool | startSync (const QString &aProfileId) const
| Requests to starts synchronizing using a profile Id. More...
void | abortSync (const QString &aProfileId) const
| Stops synchronizing the profile with the given Id. More...
QStringList | getRunningSyncList ()
| Gets the list of profile names of currently running syncs. More...
bool | setSyncSchedule (QString &aProfileId, SyncSchedule &aSchedule)
| Sets Sync Schedule to the profile. More...
bool | saveSyncResults (const QString &aProfileId, const Buteo::SyncResults &aSyncResults)
| Save SyncResults to log.xml file. More...
bool | removeProfile (QString &aProfileId)
| This function should be called when sync profile has to be deleted. More...
bool | updateProfile (Buteo::SyncProfile &aSyncProfile)
| This function should be called when sync profile information has been changed by the client. More...
bool | getBackUpRestoreState ()
| This function returns true if backup/restore in progress else false.
bool | isValid ()
| Use this function to understand if the creation of dbus connection to msyncd succeeded or not. More...
Buteo::SyncResults | getLastSyncResult (const QString &aProfileId)
| To get lastSyncResult. More...
QList< QString > | allVisibleSyncProfiles ()
| Gets all visible sync profiles. More...
QString | syncProfile (const QString &aProfileId)
| Gets a sync profile. More...
QStringList | syncProfilesByKey (const QString &aKey, const QString &aValue)
| Gets a sync profiles which matches the key-value. More...
QStringList | syncProfilesByType (const QString &aType)
| Gets a profiles matching the profile type. More...

## Detailed Description

SyncInterface Class - Main Entry Point for SyncFW Clients.

This Class Provides Interface API towards SyncFW. This Class has Methods to start and abort a sync , set schedule for a profile and use the fw functionality to automatically schedule it, get a list of running syncs( to display in UI ) and get status of the synchronization. It also has Signals that the clients can connect to know the last sync results , to keep track of profile changes by SyncFw.

## Member Function Documentation

## ◆ abortSync()

void SyncClientInterface::abortSync | ( | const QString & | aProfileId | ) | const

Stops synchronizing the profile with the given Id.

If the sync request is still in queue and not yet started, the queue entry is removed.

Parameters

  aProfileId | Id of the profile to stop syncing.

## ◆ allVisibleSyncProfiles()

QList< QString > SyncClientInterface::allVisibleSyncProfiles | ( |  | ) |

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.

## ◆ backupDone

void Buteo::SyncClientInterface::backupDone | ( |  | ) |
| signal

Notifies about Backup done.

This signal is sent when the backup framework has completed backing the sync related data.

## ◆ backupInProgress

void Buteo::SyncClientInterface::backupInProgress | ( |  | ) |
| signal

Notifies about Backup start.

This signal is sent when the backup framework is backing the sync related data

## ◆ getLastSyncResult()

Buteo::SyncResults SyncClientInterface::getLastSyncResult | ( | const QString & | aProfileId | ) |

To get lastSyncResult.

Parameters

  aProfileId |

Returns
  SyncResults of syncLastResult.

## ◆ getRunningSyncList()

QStringList SyncClientInterface::getRunningSyncList | ( |  | ) |

Gets the list of profile names of currently running syncs.

Returns
  Profile name list.

## ◆ isValid()

bool SyncClientInterface::isValid | ( |  | ) |

Use this function to understand if the creation of dbus connection to msyncd succeeded or not.

Returns
  - status of the dbus object created for msyncd

## ◆ profileChanged

void Buteo::SyncClientInterface::profileChanged | ( | QString | aProfileId,
|  | int | aChangeType,
|  | QString | aChangedProfile
| ) |  |
| signal

Notifies about a change in profile.

This signal is sent when the profile data is modified or when a profile is added or deleted in msyncd.

Parameters

  aProfileId | Id of the changed profile.
  aChangeType | 0 (ADDITION): Profile was added. 1 (MODIFICATION): Profile was modified. 2 (DELETION): Profile was deleted.
  aChangedProfile | changed sync profie as XMl string.

## ◆ removeProfile()

bool SyncClientInterface::removeProfile | ( | QString & | aProfileId | ) |

This function should be called when sync profile has to be deleted.

Parameters

  aProfileId | Id of the profile to be deleted.

Returns
  status of the remove operation

## ◆ restoreDone

void Buteo::SyncClientInterface::restoreDone | ( |  | ) |
| signal

Notifies about Restore Done.

This signal is sent when the backup framework has restored the sync related data

## ◆ restoreInProgress

void Buteo::SyncClientInterface::restoreInProgress | ( |  | ) |
| signal

Notifies about Restore start.

This signal is sent when the backup framework is restoring the sync related data

## ◆ resultsAvailable

void Buteo::SyncClientInterface::resultsAvailable | ( | QString | aProfileId,
|  | Buteo::SyncResults | aResults
| ) |  |
| signal

Notifies about the results of a recent sync for a profile.

This signal is sent after the sync has completed for a profile.

Parameters

  aProfileId | Id of the changed profile.
  aResults | - Results of the sync

## ◆ saveSyncResults()

bool SyncClientInterface::saveSyncResults | ( | const QString & | aProfileId,
|  | const Buteo::SyncResults & | aSyncResults
| ) |  |

Save SyncResults to log.xml file.

Parameters

  aProfileId | to save result in corresponding file.
  aSyncResults | to save in the <profileId>.log.xml

Returns
  status of the saveSyncResults

## ◆ setSyncSchedule()

bool SyncClientInterface::setSyncSchedule | ( | QString & | aProfileId,
|  | SyncSchedule & | aSchedule
| ) |  |

Sets Sync Schedule to the profile.

This function does the following

1. sets the sync type of the profile to schedule
2. Adds the schedule to the profile
3. saves the profile.
4. schedules the synchronization , so that sync automatically starts next time

Returns
  status of the operation

## ◆ startSync()

bool SyncClientInterface::startSync | ( | const QString & | aProfileId | ) | const

Requests to starts synchronizing using a profile Id.

A status change signal (QUEUED, STARTED or ERROR) will be sent by the daemon when the request is processed. If there is a sync already in progress using the same resources that are needed by the given profile, adds the sync request to a sync queue. Otherwise a sync session is started immediately.

Parameters

  aProfileId | Id of the profile to use in sync.

Returns
  True if a profile with the Id was found. Otherwise false and no status change signals will follow from this request.

## ◆ syncProfile()

QString SyncClientInterface::syncProfile | ( | const QString & | aProfileId | ) |

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.

## ◆ syncProfilesByKey()

QStringList SyncClientInterface::syncProfilesByKey | ( | const QString & | aKey,
|  | const QString & | aValue
| ) |  |

Gets a sync profiles which matches the key-value.

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

  aKey | Key to match for profile.
  aValue | Value to match for profile.

Returns
  The sync profiles as Xml string list.

## ◆ syncProfilesByType()

QStringList SyncClientInterface::syncProfilesByType | ( | const QString & | aType | ) |

Gets a profiles matching the profile type.

Parameters

  aType | Type of the profile service/storage/sync.

Returns
  The sync profile ids as string list.

## ◆ syncStatus

void Buteo::SyncClientInterface::syncStatus | ( | QString | aProfileId,
|  | int | aStatus,
|  | QString | aMessage,
|  | int | aStatusDetails
| ) |  |
| signal

Notifies about a change in synchronization status.

Parameters

  aProfileId | Id of the profile used in the sync session whose status has changed.
  aStatus | The new status. One of the following: 0 (QUEUED): Sync request has been queued or was already in the queue when sync start was requested. 1 (STARTED): Sync session has been started. 2 (PROGRESS): Sync session is progressing. 3 (ERROR): Sync session has encountered an error and has been stopped, or the session could not be started at all. 4 (DONE): Sync session was successfully completed. 5 (ABORTED): Sync session was aborted. Statuses 3-5 are final, no more status changes will be sent from the same sync session.
  aMessage | A message describing the status change in detail. This can for example be shown to the user or written to a log
  aStatusDetails | When aStatus is ERROR, this parameter contains a specific error code. When aStatus is PROGRESS, this parameter contains more details about the progress

See also
  SyncCommonDefs::SyncProgressDetails

## ◆ transferProgress

void Buteo::SyncClientInterface::transferProgress | ( | QString | aProfileId,
|  | int | aTransferDatabase,
|  | int | aTransferType,
|  | QString | aMimeType,
|  | int | aCommittedItems
| ) |  |
| signal

Notifies about progress in transferring items.

Parameters

  aProfileId | Id of the profile where progress has occurred
  aTransferDatabase | Database to which transfer was made. One of the following: 0 (LOCAL_DATABASE): Transfer was made from remote database to local database 1 (REMOTE_DATABASE): Transfer was made from local database to remote database
  aTransferType | Type of transfer that was made. One of the following: 0 (ADDITION): Addition was made to database 1 (MODIFICATION): Modification was made to database 2 (DELETION): Deletion was made to database 3 (ERROR): Addition/Modification/Deletion was attempted, but it failed
  aMimeType | Mime type of the processed item
  aCommittedItems | No. of items committed for this operation

## ◆ updateProfile()

bool SyncClientInterface::updateProfile | ( | Buteo::SyncProfile & | aSyncProfile | ) |

This function should be called when sync profile information has been changed by the client.

Parameters

  aSyncProfile | Modified Profile Object.If same profile already exists it will be overwritten with the changes from this object.

Returns
  status of the update operation

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

- SyncClientInterface.h
- SyncClientInterface.cpp
- moc_SyncClientInterface.cpp