Buteo Synchronization Framework
|
SyncInterface Class - Main Entry Point for SyncFW Clients. More...
#include <SyncClientInterface.h>
Signals | |
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 | profileChanged (QString aProfileId, int aChangeType, QString aChangedProfile) |
Notifies about a change in profile. | |
void | resultsAvailable (QString aProfileId, Buteo::SyncResults aResults) |
Notifies about the results of a recent sync for a profile. | |
void | syncStatus (QString aProfileId, int aStatus, QString aMessage, int aStatusDetails) |
Notifies about a change in synchronization status. | |
void | transferProgress (QString aProfileId, int aTransferDatabase, int aTransferType, QString aMimeType, int aCommittedItems) |
Notifies about progress in transferring items. | |
Public Member Functions | |
SyncClientInterface () | |
Constructor. | |
~SyncClientInterface () | |
Destructor. | |
bool | startSync (const QString &aProfileId) const |
Requests to starts synchronizing using a profile Id. | |
void | abortSync (const QString &aProfileId) const |
Stops synchronizing the profile with the given Id. | |
QStringList | getRunningSyncList () |
Gets the list of profile names of currently running syncs. | |
bool | setSyncSchedule (QString &aProfileId, SyncSchedule &aSchedule) |
Sets Sync Schedule to the profile. | |
bool | saveSyncResults (const QString &aProfileId, const Buteo::SyncResults &aSyncResults) |
Save SyncResults to log.xml file. | |
bool | removeProfile (QString &aProfileId) |
This function should be called when sync profile has to be deleted. | |
bool | updateProfile (Buteo::SyncProfile &aSyncProfile) |
This function should be called when sync profile information has been changed by the client. | |
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. | |
Buteo::SyncResults | getLastSyncResult (const QString &aProfileId) |
To get lastSyncResult. | |
QList< QString > | allVisibleSyncProfiles () |
Gets all visible sync profiles. | |
QString | syncProfile (const QString &aProfileId) |
Gets a sync profile. | |
QStringList | syncProfilesByKey (const QString &aKey, const QString &aValue) |
Gets a sync profiles which matches the key-value. | |
QStringList | syncProfilesByType (const QString &aType) |
Gets a profiles matching the profile type. | |
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.
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.
aProfileId | Id of the profile to stop syncing. |
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.
|
signal |
Notifies about Backup done.
This signal is sent when the backup framework has completed backing the sync related data.
|
signal |
Notifies about Backup start.
This signal is sent when the backup framework is backing the sync related data
Buteo::SyncResults SyncClientInterface::getLastSyncResult | ( | const QString & | aProfileId | ) |
QStringList SyncClientInterface::getRunningSyncList | ( | ) |
Gets the list of profile names of currently running syncs.
bool SyncClientInterface::isValid | ( | ) |
Use this function to understand if the creation of dbus connection to msyncd succeeded or not.
|
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.
bool SyncClientInterface::removeProfile | ( | QString & | aProfileId | ) |
This function should be called when sync profile has to be deleted.
aProfileId | Id of the profile to be deleted. |
|
signal |
Notifies about Restore Done.
This signal is sent when the backup framework has restored the sync related data
|
signal |
Notifies about Restore start.
This signal is sent when the backup framework is restoring the sync related data
|
signal |
Notifies about the results of a recent sync for a profile.
This signal is sent after the sync has completed for a profile.
aProfileId | Id of the changed profile. |
aResults | - Results of the sync |
bool SyncClientInterface::saveSyncResults | ( | const QString & | aProfileId, |
const Buteo::SyncResults & | aSyncResults | ||
) |
Save SyncResults to log.xml file.
aProfileId | to save result in corresponding file. |
aSyncResults | to save in the <profileId>.log.xml
|
bool SyncClientInterface::setSyncSchedule | ( | QString & | aProfileId, |
SyncSchedule & | aSchedule | ||
) |
Sets Sync Schedule to the profile.
This function does the following
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.
aProfileId | Id of the profile to use in sync. |
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.
aProfileId | Name of the profile to get. |
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.
aKey | Key to match for profile. |
aValue | Value to match for profile. |
QStringList SyncClientInterface::syncProfilesByType | ( | const QString & | aType | ) |
Gets a profiles matching the profile type.
aType | Type of the profile service/storage/sync. |
|
signal |
Notifies about a change in synchronization status.
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 |
|
signal |
Notifies about progress in transferring items.
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 |
bool SyncClientInterface::updateProfile | ( | Buteo::SyncProfile & | aSyncProfile | ) |
This function should be called when sync profile information has been changed by the client.
aSyncProfile | Modified Profile Object.If same profile already exists it will be overwritten with the changes from this object. |