Buteo::SyncProfile Class Reference

A top level synchronization profile. More...

`#include <SyncProfile.h>`

Inheritance diagram for Buteo::SyncProfile:

## Public Types

enum | SyncType { SYNC_MANUAL , SYNC_SCHEDULED }
| Synchronization types. More...
enum | DestinationType { DESTINATION_TYPE_DEVICE , DESTINATION_TYPE_ONLINE , DESTINATION_TYPE_UNDEFINED }
| Sync destination type. More...
enum | SyncDirection { SYNC_DIRECTION_TWO_WAY , SYNC_DIRECTION_FROM_REMOTE , SYNC_DIRECTION_TO_REMOTE , SYNC_DIRECTION_UNDEFINED }
| Sync direction for device-to-device syncs. More...
enum | ConflictResolutionPolicy { CR_POLICY_PREFER_LOCAL_CHANGES , CR_POLICY_PREFER_REMOTE_CHANGES , CR_POLICY_UNDEFINED }
| Conflict resolution policy for device-to-device syncs. More...
enum | CurrentSyncStatus { SYNC_NEVER_HAPPENED , SYNC_SUCCESS , SYNC_FAILED , SYNC_CANCLLED }
| Current status enum. More...

## Public Member Functions

| SyncProfile (const QString &aName)
| Constructs an empty SyncProfile with the given name.
| SyncProfile (const QDomElement &aRoot)
| Constructs a SyncProfile from the given XML.
| SyncProfile (const SyncProfile &aSource)
| Copy constructor.
| ~SyncProfile ()
| Destructor.
virtual SyncProfile * | clone () const
| Creates a clone of the sync profile.
virtual void | setName (const QString &aName)
| Sets the name for the profile and associated log.
virtual void | setName (const QStringList &aKeys)
| Sets the name for the profile and associated log.
virtual QDomElement | toXml (QDomDocument &aDoc, bool aLocalOnly=true) const
virtual bool | syncExternallyEnabled () const
| Checks if schedule is controlled by a external process (e.g always-up-to-date).
virtual bool | rushEnabled () const
| Checks if rush/off-rush schedule is enabled.
virtual bool | syncExternallyDuringRush () const
| Checks if external rush schedule is to be obeyed.
virtual bool | inExternalSyncRushPeriod (QDateTime aDateTime=QDateTime::currentDateTime()) const
| Checks if a given time is inside rush hour and if the sync is controlled by a external process.
QDateTime | lastSyncTime () const
| Gets the time of last completed sync session with this profile.
QDateTime | lastSuccessfulSyncTime () const
| Gets the time of the last successful sync session for this profile.
virtual QDateTime | nextSyncTime (QDateTime aDateTime=QDateTime::currentDateTime()) const
| Gets the next scheduled sync time.
QDateTime | nextRushSwitchTime (const QDateTime &aFromTime) const
| Gets next time to switch rush/off-rush schedule intervals.
const SyncResults * | lastResults () const
| Gets the results of the last sync from the sync log.
SyncLog * | log () const
| Gets the synchronization log associated with this profile.
void | setLog (SyncLog *aLog)
| Sets the synchronization log for this profile.
void | addResults (const SyncResults &aResults)
| Adds synchronization results to the log.
SyncType | syncType () const
| Gets the sync type of this profile.
void | setSyncType (SyncType aType)
| Sets the sync type of this profile (manual/scheduled).
QStringList | storageBackendNames () const
| Gets the names of storage backends used by this profile.
SyncSchedule | syncSchedule () const
| Gets sync schedule settings.
void | setSyncSchedule (const SyncSchedule &aSchedule)
| Sets sync schedule settings.
QList< Sync::InternetConnectionType > | internetConnectionTypes () const
| Gets allowed connection types.
void | setInternetConnectionTypes (const QList< Sync::InternetConnectionType > &aTypes)
| Sets the internet connection types on which this profile can be synced.
const Profile * | clientProfile () const
| Get the first service sub-profile.
Profile * | clientProfile ()
| Get the first client sub-profile.
const Profile * | serverProfile () const
| Get the first server sub-profile.
Profile * | serverProfile ()
| Get the first server sub-profile.
QList< const Profile * > | storageProfiles () const
| Get the storage sub-profiles.
QList< Profile * > | storageProfilesNonConst ()
| Get the storage sub-profiles.
DestinationType | destinationType () const
| Gets sync destination type (device or online).
SyncDirection | syncDirection () const
| Gets sync direction (two way, to destination, from destination).
void | setSyncDirection (SyncDirection aDirection)
| Sets sync direction.
ConflictResolutionPolicy | conflictResolutionPolicy () const
| Gets conflict resolution policy.
void | setConflictResolutionPolicy (ConflictResolutionPolicy aPolicy)
| Set conflict resolution policy.
QString | serviceName () const
| Get the service name of profile.
quint32 | syncOnChangeAfter () const
| If a profiles is interested in SOC, this gets the the SOC after time from that profile. The time should be in seconds and a value of 0 means sync immediately afer change.
bool | isSOCProfile () const
| checks if a profile has SOC enabled
bool | hasRetries () const
QList< quint32 > | retryIntervals () const
CurrentSyncStatus | currentSyncStatus () const
| Gives the current status of the sync as an enum value If the current status of ongoing syncs is required, check the d-bus API "runningSyncs" which returns the list of currently running sync sessions. The current sync sessions cannot be part of a profiel,.
Public Member Functions inherited from Buteo::Profile
| Profile ()
| Default Constructor.
| Profile (const QString &aName, const QString &aType)
| Constructs a Profile object with given name and type.
| Profile (const QDomElement &aRoot)
| Constructs a Profile object from XML.
| Profile (const Profile &aSource)
| Copy constructor.
virtual | ~Profile ()
| Destructor.
QString | name () const
| Gets the name of the profile.
QString | displayname () const
| Gets the display name of the profile.
QString | type () const
| Gets the type of the profile.
QString | toString () const
| Outputs a XML representation of the profile to a string.
QString | key (const QString &aName, const QString &aDefault=QString()) const
| Gets the value of the given key.
QMap< QString, QString > | allKeys () const
| Gets all keys and their values.
QMap< QString, QString > | allNonStorageKeys () const
| Gets all keys that are not related to storages.
bool | boolKey (const QString &aName, bool aDefault=false) const
| Gets the value of the given boolean key.
QStringList | keyValues (const QString &aName) const
| Gets the values of all keys with the given name.
QStringList | keyNames () const
| Gets the names of all keys.
void | setKey (const QString &aName, const QString &aValue)
| Sets the value of a key.
void | setKeyValues (const QString &aName, const QStringList &aValues)
| Sets multiple values for a key.
void | setBoolKey (const QString &aName, bool aValue)
| Sets the value of a boolean key.
void | removeKey (const QString &aName)
| Removes a key from profile. All instances of the key are removed.
const ProfileField * | field (const QString &aName) const
| Gets the field with the given name.
QList< const ProfileField * > | allFields () const
| Gets all fields.
QList< const ProfileField * > | visibleFields () const
| Gets all visible fields of the profile.
bool | isValid () const
| Checks if the profile is valid.
QStringList | subProfileNames (const QString &aType="") const
| Gets the names of all sub-profiles with the given type.
Profile * | subProfile (const QString &aName, const QString &aType="")
| Gets a sub-profile with the given name and type.
const Profile * | subProfile (const QString &aName, const QString &aType="") const
| const method for subProfile
const Profile * | subProfileByKeyValue (const QString &aKey, const QString &aValue, const QString &aType, bool aEnabledOnly) const
| Gets a sub-profile by key value.
QList< Profile * > | allSubProfiles ()
| Gets all sub-profiles.
QList< const Profile * > | allSubProfiles () const
| Gets all sub-profiles as const.
void | merge (const Profile &aSource)
| Merges a profile to this profile.
bool | isLoaded () const
| Checks if the profile is fully constructed by loading all sub-profiles from separate profile files.
void | setLoaded (bool aLoaded)
| Sets if the profile is fully loaded.
virtual bool | isEnabled () const
| Returns if the profile is enabled.
void | setEnabled (bool aEnabled)
| Set is the profile is enabled.
bool | isHidden () const
| Checks if the profile is hidden.
bool | isProtected () const
| Checks if the profile is protected.

## Additional Inherited Members

Static Public Attributes inherited from Buteo::Profile
static const QString | TYPE_CLIENT
| String constants for different profile type names.
static const QString | TYPE_SERVER
| Server type .
static const QString | TYPE_STORAGE
| Storage type.
static const QString | TYPE_SYNC
| Service type.

## Detailed Description

A top level synchronization profile.

SyncProfile is derived from Profile. It represents a top level synchronization profile, which contains all settings needed for a synchronization session. A SyncProfile typically has sub-profiles for the used service, client/server plug-in and storage plug-ins. SyncProfile extends the Profile inteface with functions for accessing information about synchronization schedule and history of finished synchronization sessions with this profile.

## Member Enumeration Documentation

## ConflictResolutionPolicy

enum Buteo::SyncProfile::ConflictResolutionPolicy

Conflict resolution policy for device-to-device syncs.

Enumerator
CR_POLICY_PREFER_LOCAL_CHANGES | Prefer local data in conflict situation.
CR_POLICY_PREFER_REMOTE_CHANGES | Prefer remote data in conflict situation.
CR_POLICY_UNDEFINED | Conflict resolution policy is undefined.

## CurrentSyncStatus

enum Buteo::SyncProfile::CurrentSyncStatus

Current status enum.

Enumerator
SYNC_NEVER_HAPPENED | NOT_SYNCED - no sync has been done for the profile yet.
SYNC_SUCCESS | SYNC_SUCCESS - the last sync has been successful.
SYNC_FAILED | SYNC_FAILED - the last sync has failed.
SYNC_CANCLLED | SYNC_CANCELLED - the last sync has been cancelled.

## DestinationType

enum Buteo::SyncProfile::DestinationType

Sync destination type.

Enumerator
DESTINATION_TYPE_DEVICE | Destination is a device (N95, Harmattan, OviSuite etc.).
DESTINATION_TYPE_ONLINE | Destination is an online service.
DESTINATION_TYPE_UNDEFINED | Destination type is not defined.

## SyncDirection

enum Buteo::SyncProfile::SyncDirection

Sync direction for device-to-device syncs.

Enumerator
SYNC_DIRECTION_TWO_WAY | Two way sync.
SYNC_DIRECTION_FROM_REMOTE | Data is copied from remote device only.
SYNC_DIRECTION_TO_REMOTE | Data is copied to remote device only.
SYNC_DIRECTION_UNDEFINED | Sync direction is not defined.

## SyncType

enum Buteo::SyncProfile::SyncType

Synchronization types.

Enumerator
SYNC_MANUAL | Synchronization is started manually.
SYNC_SCHEDULED | Synchronization is triggered automatically based on a defined schedule.

## Constructor & Destructor Documentation

## SyncProfile() [1/3]

SyncProfile::SyncProfile | ( | const QString & | aName | ) |

explicit

Constructs an empty SyncProfile with the given name.

Parameters

  aName | Name of the profile to create.

## SyncProfile() [2/3]

SyncProfile::SyncProfile | ( | const QDomElement & | aRoot | ) |

explicit

Constructs a SyncProfile from the given XML.

Parameters

  aRoot | Root element of the XML node tree.

## SyncProfile() [3/3]

SyncProfile::SyncProfile | ( | const SyncProfile & | aSource | ) |

Copy constructor.

Parameters

  aSource | Copy source.

## Member Function Documentation

## addResults()

void SyncProfile::addResults | ( | const SyncResults & | aResults | ) |

Adds synchronization results to the log.

If a log does not exist yet, an empty log is created first.

Parameters

  aResults | Results to add.

## clientProfile() [1/2]

Profile * SyncProfile::clientProfile | ( |  | ) |

Get the first client sub-profile.

Returns
  Client profile. NULL if not found.

## clientProfile() [2/2]

const Profile * SyncProfile::clientProfile | ( |  | ) | const

Get the first service sub-profile.

Returns
  Service profile. NULL if not found.

Get the first service sub-profile.

Returns
  Service profile. NULL if not found.

Get the first client sub-profile.

Returns
  Client profile. NULL if not found.

## clone()

SyncProfile * SyncProfile::clone | ( |  | ) | const

virtual

Creates a clone of the sync profile.

Returns
  The clone.

Reimplemented from Buteo::Profile.

## conflictResolutionPolicy()

SyncProfile::ConflictResolutionPolicy SyncProfile::conflictResolutionPolicy | ( |  | ) | const

Gets conflict resolution policy.

Returns
  Conflict resolution policy.

## currentSyncStatus()

SyncProfile::CurrentSyncStatus SyncProfile::currentSyncStatus | ( |  | ) | const

Gives the current status of the sync as an enum value If the current status of ongoing syncs is required, check the d-bus API "runningSyncs" which returns the list of currently running sync sessions. The current sync sessions cannot be part of a profiel,.

Returns
  CurrentSyncStatus

## destinationType()

SyncProfile::DestinationType SyncProfile::destinationType | ( |  | ) | const

Gets sync destination type (device or online).

Returns
  Destination type.

## inExternalSyncRushPeriod()

bool SyncProfile::inExternalSyncRushPeriod | ( | QDateTime | aDateTime = QDateTime::currentDateTime() | ) | const

virtual

Checks if a given time is inside rush hour and if the sync is controlled by a external process.

Parameters

  aDateTime | DateTime to check, current DateTime used by default.

## internetConnectionTypes()

QList< Sync::InternetConnectionType > SyncProfile::internetConnectionTypes | ( |  | ) | const

Gets allowed connection types.

Returns
  List of allowed connection types.

## isSOCProfile()

bool SyncProfile::isSOCProfile | ( |  | ) | const

checks if a profile has SOC enabled

Returns
  true if SOC enabled for this profile, false otherwise

## lastResults()

const SyncResults * SyncProfile::lastResults | ( |  | ) | const

Gets the results of the last sync from the sync log.

Returns
  The results. NULL if not available.

## lastSuccessfulSyncTime()

QDateTime SyncProfile::lastSuccessfulSyncTime | ( |  | ) | const

Gets the time of the last successful sync session for this profile.

Returns
  Sync time of the last successful session. Null if this could not be determined

## lastSyncTime()

QDateTime SyncProfile::lastSyncTime | ( |  | ) | const

Gets the time of last completed sync session with this profile.

Returns
  Last sync time. Null object if this could not be determined.

## log()

SyncLog * SyncProfile::log | ( |  | ) | const

Gets the synchronization log associated with this profile.

Returns
  The sync log. NULL if no log is set.

## nextRushSwitchTime()

QDateTime SyncProfile::nextRushSwitchTime | ( | const QDateTime & | aFromTime | ) | const

Gets next time to switch rush/off-rush schedule intervals.

Parameters

  aFromTime | From time to calculate next switch, usually current time.

Returns
  Next time to switch rush/off-rush schedule intervals. Null object if schedule is not defined for rush/off-rush or if the rush and off-rush intervals are the same.

## nextSyncTime()

QDateTime SyncProfile::nextSyncTime | ( | QDateTime | aDateTime = QDateTime::currentDateTime() | ) | const

virtual

Gets the next scheduled sync time.

Returns
  Next sync time. Null object if the sync type is manual or the time could not be determined for some other reason.

## rushEnabled()

bool SyncProfile::rushEnabled | ( |  | ) | const

virtual

Checks if rush/off-rush schedule is enabled.

Returns
  True if rush/off-rush schedule is enabled. False, if rush/off-rush scheduling is off.

## serverProfile() [1/2]

Profile * SyncProfile::serverProfile | ( |  | ) |

Get the first server sub-profile.

Returns
  Server profile. NULL if not found.

## serverProfile() [2/2]

const Profile * SyncProfile::serverProfile | ( |  | ) | const

Get the first server sub-profile.

Returns
  Server profile. NULL if not found.

## serviceName()

QString Buteo::SyncProfile::serviceName | ( |  | ) | const

Get the service name of profile.

Returns
  Service name associated with profile.

## setConflictResolutionPolicy()

void SyncProfile::setConflictResolutionPolicy | ( | ConflictResolutionPolicy | aPolicy | ) |

Set conflict resolution policy.

Returns
  Conflict resolution policy.

## setInternetConnectionTypes()

void SyncProfile::setInternetConnectionTypes | ( | const QList< Sync::InternetConnectionType > & | aTypes | ) |

Sets the internet connection types on which this profile can be synced.

If empty, the default settings are used.

Parameters

  aTypes | The allowed internet connection types.

## setLog()

void SyncProfile::setLog | ( | SyncLog * | aLog | ) |

Sets the synchronization log for this profile.

The ownership of the given log object is transferred to this object. If a log is already set, the old log object is deleted first.

Parameters

  aLog | The log.

## setName() [1/2]

void SyncProfile::setName | ( | const QString & | aName | ) |

virtual

Sets the name for the profile and associated log.

Reimplemented from Buteo::Profile.

## setName() [2/2]

void SyncProfile::setName | ( | const QStringList & | aKeys | ) |

virtual

Sets the name for the profile and associated log.

Reimplemented from Buteo::Profile.

## setSyncDirection()

void SyncProfile::setSyncDirection | ( | SyncDirection | aDirection | ) |

Sets sync direction.

Returns
  New sync direction.

## setSyncSchedule()

void SyncProfile::setSyncSchedule | ( | const SyncSchedule & | aSchedule | ) |

Sets sync schedule settings.

Parameters

  aSchedule | New schedule.

## setSyncType()

void SyncProfile::setSyncType | ( | SyncType | aType | ) |

Sets the sync type of this profile (manual/scheduled).

Parameters

  aType | The new sync type.

## storageBackendNames()

QStringList SyncProfile::storageBackendNames | ( |  | ) | const

Gets the names of storage backends used by this profile.

Returns
  List of storage backend names.

## storageProfiles()

QList< const Profile * > SyncProfile::storageProfiles | ( |  | ) | const

Get the storage sub-profiles.

Returns
  Storage profiles.

## storageProfilesNonConst()

QList< Profile * > SyncProfile::storageProfilesNonConst | ( |  | ) |

Get the storage sub-profiles.

Returns
  Storage profiles.

## syncDirection()

SyncProfile::SyncDirection SyncProfile::syncDirection | ( |  | ) | const

Gets sync direction (two way, to destination, from destination).

Returns
  Sync direction.

## syncExternallyDuringRush()

bool SyncProfile::syncExternallyDuringRush | ( |  | ) | const

virtual

Checks if external rush schedule is to be obeyed.

Returns
  True if rush hour schedule is to be used by a external process, The external process will control the sync, buteo will just call the corresponding plugins when a switch from rush to offRush or vice-versa is necessary, corresponding plugins should be prepared to do any needed changes. False, if rush hour scheduling is controlled by this process or if rush hour scheduling is off (i.e. manual mode).

## syncExternallyEnabled()

bool SyncProfile::syncExternallyEnabled | ( |  | ) | const

virtual

Checks if schedule is controlled by a external process (e.g always-up-to-date).

Returns
  True if schedule is controlled by a external process. External process will control the sync, buteo schedule is disabled in this case.

## syncOnChangeAfter()

quint32 SyncProfile::syncOnChangeAfter | ( |  | ) | const

If a profiles is interested in SOC, this gets the the SOC after time from that profile. The time should be in seconds and a value of 0 means sync immediately afer change.

Returns
  SOC after time or -1 if none is specified

## syncSchedule()

SyncSchedule SyncProfile::syncSchedule | ( |  | ) | const

Gets sync schedule settings.

Returns
  Sync schedule.

## syncType()

SyncProfile::SyncType SyncProfile::syncType | ( |  | ) | const

Gets the sync type of this profile.

Returns
  The sync type.

## toXml()

QDomElement SyncProfile::toXml | ( | QDomDocument & | aDoc,
|  | bool | aLocalOnly = true ) const

virtual

See also
  Profile::toXml

Reimplemented from Buteo::Profile.

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

- SyncProfile.h
- SyncProfile.cpp