Buteo Synchronization Framework
Public Types | Public Member Functions | List of all members
Buteo::SyncProfile Class Reference

A top level synchronization profile. More...

#include <SyncProfile.h>

Inheritance diagram for Buteo::SyncProfile:
Buteo::Profile

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. More...
 
 SyncProfile (const QDomElement &aRoot)
 Constructs a SyncProfile from the given XML. More...
 
 SyncProfile (const SyncProfile &aSource)
 Copy constructor. More...
 
 ~SyncProfile ()
 Destructor.
 
virtual SyncProfileclone () const
 Creates a clone of the sync profile. More...
 
virtual void setName (const QString &aName)
 Sets the name for the profile and associated log. More...
 
virtual void setName (const QStringList &aKeys)
 Sets the name for the profile and associated log. More...
 
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). More...
 
virtual bool rushEnabled () const
 Checks if rush/off-rush schedule is enabled. More...
 
virtual bool syncExternallyDuringRush () const
 Checks if external rush schedule is to be obeyed. More...
 
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. More...
 
QDateTime lastSyncTime () const
 Gets the time of last completed sync session with this profile. More...
 
QDateTime lastSuccessfulSyncTime () const
 Gets the time of the last successful sync session for this profile. More...
 
virtual QDateTime nextSyncTime (QDateTime aDateTime=QDateTime::currentDateTime()) const
 Gets the next scheduled sync time. More...
 
QDateTime nextRushSwitchTime (const QDateTime &aFromTime) const
 Gets next time to switch rush/off-rush schedule intervals. More...
 
const SyncResultslastResults () const
 Gets the results of the last sync from the sync log. More...
 
SyncLoglog () const
 Gets the synchronization log associated with this profile. More...
 
void setLog (SyncLog *aLog)
 Sets the synchronization log for this profile. More...
 
void addResults (const SyncResults &aResults)
 Adds synchronization results to the log. More...
 
SyncType syncType () const
 Gets the sync type of this profile. More...
 
void setSyncType (SyncType aType)
 Sets the sync type of this profile (manual/scheduled). More...
 
QStringList storageBackendNames () const
 Gets the names of storage backends used by this profile. More...
 
SyncSchedule syncSchedule () const
 Gets sync schedule settings. More...
 
void setSyncSchedule (const SyncSchedule &aSchedule)
 Sets sync schedule settings. More...
 
QList< Sync::InternetConnectionType > internetConnectionTypes () const
 Gets allowed connection types. More...
 
void setInternetConnectionTypes (const QList< Sync::InternetConnectionType > &aTypes)
 Sets the internet connection types on which this profile can be synced. More...
 
const ProfileclientProfile () const
 Get the first service sub-profile. More...
 
ProfileclientProfile ()
 Get the first client sub-profile. More...
 
const ProfileserverProfile () const
 Get the first server sub-profile. More...
 
ProfileserverProfile ()
 Get the first server sub-profile. More...
 
QList< const Profile * > storageProfiles () const
 Get the storage sub-profiles. More...
 
QList< Profile * > storageProfilesNonConst ()
 Get the storage sub-profiles. More...
 
DestinationType destinationType () const
 Gets sync destination type (device or online). More...
 
SyncDirection syncDirection () const
 Gets sync direction (two way, to destination, from destination). More...
 
void setSyncDirection (SyncDirection aDirection)
 Sets sync direction. More...
 
ConflictResolutionPolicy conflictResolutionPolicy () const
 Gets conflict resolution policy. More...
 
void setConflictResolutionPolicy (ConflictResolutionPolicy aPolicy)
 Set conflict resolution policy. More...
 
QString serviceName () const
 Get the service name of profile. More...
 
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. More...
 
bool isSOCProfile () const
 checks if a profile has SOC enabled More...
 
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,. More...
 
- 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. More...
 
 Profile (const QDomElement &aRoot)
 Constructs a Profile object from XML. More...
 
 Profile (const Profile &aSource)
 Copy constructor. More...
 
virtual Profileclone () const
 Creates a clone of the profile. More...
 
virtual ~Profile ()
 Destructor.
 
QString name () const
 Gets the name of the profile. More...
 
QString displayname () const
 Gets the display name of the profile. More...
 
virtual void setName (const QString &aName)
 Sets the name of the profile. More...
 
virtual void setName (const QStringList &aKeys)
 Sets the name of the profile. More...
 
QString type () const
 Gets the type of the profile. More...
 
virtual QDomElement toXml (QDomDocument &aDoc, bool aLocalOnly=true) const
 Creates a XML representation of the profile. More...
 
QString toString () const
 Outputs a XML representation of the profile to a string. More...
 
QString key (const QString &aName, const QString &aDefault=QString()) const
 Gets the value of the given key. More...
 
QMap< QString, QString > allKeys () const
 Gets all keys and their values. More...
 
QMap< QString, QString > allNonStorageKeys () const
 Gets all keys that are not related to storages. More...
 
bool boolKey (const QString &aName, bool aDefault=false) const
 Gets the value of the given boolean key. More...
 
QStringList keyValues (const QString &aName) const
 Gets the values of all keys with the given name. More...
 
QStringList keyNames () const
 Gets the names of all keys. More...
 
void setKey (const QString &aName, const QString &aValue)
 Sets the value of a key. More...
 
void setKeyValues (const QString &aName, const QStringList &aValues)
 Sets multiple values for a key. More...
 
void setBoolKey (const QString &aName, bool aValue)
 Sets the value of a boolean key. More...
 
void removeKey (const QString &aName)
 Removes a key from profile. All instances of the key are removed. More...
 
const ProfileFieldfield (const QString &aName) const
 Gets the field with the given name. More...
 
QList< const ProfileField * > allFields () const
 Gets all fields. More...
 
QList< const ProfileField * > visibleFields () const
 Gets all visible fields of the profile. More...
 
bool isValid () const
 Checks if the profile is valid. More...
 
QStringList subProfileNames (const QString &aType="") const
 Gets the names of all sub-profiles with the given type. More...
 
ProfilesubProfile (const QString &aName, const QString &aType="")
 Gets a sub-profile with the given name and type. More...
 
const ProfilesubProfile (const QString &aName, const QString &aType="") const
 const method for subProfile More...
 
const ProfilesubProfileByKeyValue (const QString &aKey, const QString &aValue, const QString &aType, bool aEnabledOnly) const
 Gets a sub-profile by key value. More...
 
QList< Profile * > allSubProfiles ()
 Gets all sub-profiles. More...
 
QList< const Profile * > allSubProfiles () const
 Gets all sub-profiles as const. More...
 
void merge (const Profile &aSource)
 Merges a profile to this profile. More...
 
bool isLoaded () const
 Checks if the profile is fully constructed by loading all sub-profiles from separate profile files. More...
 
void setLoaded (bool aLoaded)
 Sets if the profile is fully loaded. More...
 
virtual bool isEnabled () const
 Returns if the profile is enabled. More...
 
void setEnabled (bool aEnabled)
 Set is the profile is enabled. More...
 
bool isHidden () const
 Checks if the profile is hidden. More...
 
bool isProtected () const
 Checks if the profile is protected. More...
 

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. More...
 

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

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

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

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

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

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
aNameName of the profile to create.

◆ SyncProfile() [2/3]

SyncProfile::SyncProfile ( const QDomElement &  aRoot)
explicit

Constructs a SyncProfile from the given XML.

Parameters
aRootRoot element of the XML node tree.

◆ SyncProfile() [3/3]

SyncProfile::SyncProfile ( const SyncProfile aSource)

Copy constructor.

Parameters
aSourceCopy 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
aResultsResults 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
aDateTimeDateTime 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
aFromTimeFrom 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
aTypesThe 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
aLogThe 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
aScheduleNew schedule.

◆ setSyncType()

void SyncProfile::setSyncType ( SyncType  aType)

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

Parameters
aTypeThe 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: