SyncProfile.h
/*
* This file is part of buteo-syncfw package
*
* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
* Copyright (C) 2014-2019 Jolla Ltd.
* Copyright (C) 2020 Open Mobile Platform LLC.
*
* Contact: Sateesh Kavuri <sateesh.kavuri@nokia.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
#ifndef SYNCPROFILE_H
#define SYNCPROFILE_H
#include "Profile.h"
#include "SyncLog.h"
#include "SyncSchedule.h"
#include "SyncCommonDefs.h"
namespace Buteo {
class SyncProfilePrivate;
class SyncProfile : public Profile
{
public:
enum SyncType {
SYNC_MANUAL,
SYNC_SCHEDULED
};
enum DestinationType {
DESTINATION_TYPE_DEVICE,
DESTINATION_TYPE_ONLINE,
DESTINATION_TYPE_UNDEFINED
};
enum SyncDirection {
SYNC_DIRECTION_TWO_WAY,
SYNC_DIRECTION_FROM_REMOTE,
SYNC_DIRECTION_TO_REMOTE,
SYNC_DIRECTION_UNDEFINED
};
enum ConflictResolutionPolicy {
CR_POLICY_PREFER_LOCAL_CHANGES,
CR_POLICY_PREFER_REMOTE_CHANGES,
CR_POLICY_UNDEFINED
};
enum CurrentSyncStatus {
SYNC_NEVER_HAPPENED,
SYNC_SUCCESS,
SYNC_FAILED,
SYNC_CANCLLED
};
explicit SyncProfile(const QString &aName);
explicit SyncProfile(const QDomElement &aRoot);
SyncProfile(const SyncProfile &aSource);
~SyncProfile();
virtual SyncProfile *clone() const;
virtual void setName(const QString &aName);
virtual void setName(const QStringList &aKeys);
virtual QDomElement toXml(QDomDocument &aDoc, bool aLocalOnly = true) const;
virtual bool syncExternallyEnabled() const;
virtual bool rushEnabled() const;
virtual bool syncExternallyDuringRush() const;
virtual bool inExternalSyncRushPeriod(QDateTime aDateTime = QDateTime::currentDateTime()) const;
QDateTime lastSyncTime() const;
QDateTime lastSuccessfulSyncTime() const;
virtual QDateTime nextSyncTime(QDateTime aDateTime = QDateTime::currentDateTime()) const;
QDateTime nextRushSwitchTime(const QDateTime &aFromTime) const;
const SyncResults *lastResults() const;
SyncLog *log() const;
void setLog(SyncLog *aLog);
void addResults(const SyncResults &aResults);
SyncType syncType() const;
void setSyncType(SyncType aType);
QStringList storageBackendNames() const;
SyncSchedule syncSchedule() const;
void setSyncSchedule(const SyncSchedule &aSchedule);
QList<Sync::InternetConnectionType> internetConnectionTypes() const;
void setInternetConnectionTypes(const QList<Sync::InternetConnectionType> &aTypes);
//const Profile *serviceProfile() const;
//Profile *serviceProfile();
const Profile *clientProfile() const;
Profile *clientProfile();
const Profile *serverProfile() const;
Profile *serverProfile();
QList<const Profile *> storageProfiles() const;
QList<Profile *> storageProfilesNonConst();
DestinationType destinationType() const;
SyncDirection syncDirection() const;
void setSyncDirection(SyncDirection aDirection);
ConflictResolutionPolicy conflictResolutionPolicy() const;
void setConflictResolutionPolicy(ConflictResolutionPolicy aPolicy);
QString serviceName() const;
quint32 syncOnChangeAfter() const;
bool isSOCProfile() const;
bool hasRetries() const;
QList<quint32> retryIntervals() const;
CurrentSyncStatus currentSyncStatus() const;
private:
SyncProfile &operator=(const SyncProfile &aRhs);
SyncProfilePrivate *d_ptr;
};
}
#endif // SYNCPROFILE_H
Buteo::Profile
This class represents a single profile, a collection of settings or data releated to some entity.
Definition Profile.h:53
Buteo::Profile::Profile
Profile()
Default Constructor.
Definition Profile.cpp:41
Buteo::SyncLog
History of completed synchronization sessions and their results.
Definition SyncLog.h:45
Buteo::SyncProfile
A top level synchronization profile.
Definition SyncProfile.h:49
Buteo::SyncProfile::toXml
virtual QDomElement toXml(QDomDocument &aDoc, bool aLocalOnly=true) const
Definition SyncProfile.cpp:163
Buteo::SyncProfile::log
SyncLog * log() const
Gets the synchronization log associated with this profile.
Definition SyncProfile.cpp:285
Buteo::SyncProfile::syncDirection
SyncDirection syncDirection() const
Gets sync direction (two way, to destination, from destination).
Definition SyncProfile.cpp:500
Buteo::SyncProfile::storageBackendNames
QStringList storageBackendNames() const
Gets the names of storage backends used by this profile.
Definition SyncProfile.cpp:352
Buteo::SyncProfile::serverProfile
const Profile * serverProfile() const
Get the first server sub-profile.
Definition SyncProfile.cpp:433
Buteo::SyncProfile::storageProfiles
QList< const Profile * > storageProfiles() const
Get the storage sub-profiles.
Definition SyncProfile.cpp:457
Buteo::SyncProfile::setLog
void setLog(SyncLog *aLog)
Sets the synchronization log for this profile.
Definition SyncProfile.cpp:290
Buteo::SyncProfile::setSyncType
void setSyncType(SyncType aType)
Sets the sync type of this profile (manual/scheduled).
Definition SyncProfile.cpp:313
Buteo::SyncProfile::syncOnChangeAfter
quint32 syncOnChangeAfter() const
If a profiles is interested in SOC, this gets the the SOC after time from that profile....
Definition SyncProfile.cpp:534
Buteo::SyncProfile::destinationType
DestinationType destinationType() const
Gets sync destination type (device or online).
Definition SyncProfile.cpp:483
Buteo::SyncProfile::syncExternallyDuringRush
virtual bool syncExternallyDuringRush() const
Checks if external rush schedule is to be obeyed.
Definition SyncProfile.cpp:219
Buteo::SyncProfile::syncExternallyEnabled
virtual bool syncExternallyEnabled() const
Checks if schedule is controlled by a external process (e.g always-up-to-date).
Definition SyncProfile.cpp:209
Buteo::SyncProfile::clientProfile
const Profile * clientProfile() const
Get the first service sub-profile.
Definition SyncProfile.cpp:409
Buteo::SyncProfile::isSOCProfile
bool isSOCProfile() const
checks if a profile has SOC enabled
Definition SyncProfile.cpp:523
Buteo::SyncProfile::lastResults
const SyncResults * lastResults() const
Gets the results of the last sync from the sync log.
Definition SyncProfile.cpp:276
Buteo::SyncProfile::lastSyncTime
QDateTime lastSyncTime() const
Gets the time of last completed sync session with this profile.
Definition SyncProfile.cpp:230
Buteo::SyncProfile::storageProfilesNonConst
QList< Profile * > storageProfilesNonConst()
Get the storage sub-profiles.
Definition SyncProfile.cpp:470
Buteo::SyncProfile::inExternalSyncRushPeriod
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.
Definition SyncProfile.cpp:225
Buteo::SyncProfile::ConflictResolutionPolicy
ConflictResolutionPolicy
Conflict resolution policy for device-to-device syncs.
Definition SyncProfile.h:89
Buteo::SyncProfile::CR_POLICY_PREFER_REMOTE_CHANGES
@ CR_POLICY_PREFER_REMOTE_CHANGES
Prefer remote data in conflict situation.
Definition SyncProfile.h:94
Buteo::SyncProfile::CR_POLICY_PREFER_LOCAL_CHANGES
@ CR_POLICY_PREFER_LOCAL_CHANGES
Prefer local data in conflict situation.
Definition SyncProfile.h:91
Buteo::SyncProfile::CR_POLICY_UNDEFINED
@ CR_POLICY_UNDEFINED
Conflict resolution policy is undefined.
Definition SyncProfile.h:97
Buteo::SyncProfile::SyncDirection
SyncDirection
Sync direction for device-to-device syncs.
Definition SyncProfile.h:74
Buteo::SyncProfile::SYNC_DIRECTION_TWO_WAY
@ SYNC_DIRECTION_TWO_WAY
Two way sync.
Definition SyncProfile.h:76
Buteo::SyncProfile::SYNC_DIRECTION_FROM_REMOTE
@ SYNC_DIRECTION_FROM_REMOTE
Data is copied from remote device only.
Definition SyncProfile.h:79
Buteo::SyncProfile::SYNC_DIRECTION_TO_REMOTE
@ SYNC_DIRECTION_TO_REMOTE
Data is copied to remote device only.
Definition SyncProfile.h:82
Buteo::SyncProfile::SYNC_DIRECTION_UNDEFINED
@ SYNC_DIRECTION_UNDEFINED
Sync direction is not defined.
Definition SyncProfile.h:85
Buteo::SyncProfile::syncSchedule
SyncSchedule syncSchedule() const
Gets sync schedule settings.
Definition SyncProfile.cpp:318
Buteo::SyncProfile::nextRushSwitchTime
QDateTime nextRushSwitchTime(const QDateTime &aFromTime) const
Gets next time to switch rush/off-rush schedule intervals.
Definition SyncProfile.cpp:267
Buteo::SyncProfile::serviceName
QString serviceName() const
Get the service name of profile.
Buteo::SyncProfile::rushEnabled
virtual bool rushEnabled() const
Checks if rush/off-rush schedule is enabled.
Definition SyncProfile.cpp:214
Buteo::SyncProfile::setName
virtual void setName(const QString &aName)
Sets the name for the profile and associated log.
Definition SyncProfile.cpp:186
Buteo::SyncProfile::SyncProfile
SyncProfile(const QString &aName)
Constructs an empty SyncProfile with the given name.
Definition SyncProfile.cpp:118
Buteo::SyncProfile::clone
virtual SyncProfile * clone() const
Creates a clone of the sync profile.
Definition SyncProfile.cpp:158
Buteo::SyncProfile::lastSuccessfulSyncTime
QDateTime lastSuccessfulSyncTime() const
Gets the time of the last successful sync session for this profile.
Definition SyncProfile.cpp:242
Buteo::SyncProfile::nextSyncTime
virtual QDateTime nextSyncTime(QDateTime aDateTime=QDateTime::currentDateTime()) const
Gets the next scheduled sync time.
Definition SyncProfile.cpp:253
Buteo::SyncProfile::currentSyncStatus
CurrentSyncStatus currentSyncStatus() const
Gives the current status of the sync as an enum value If the current status of ongoing syncs is requi...
Definition SyncProfile.cpp:641
Buteo::SyncProfile::setSyncSchedule
void setSyncSchedule(const SyncSchedule &aSchedule)
Sets sync schedule settings.
Definition SyncProfile.cpp:323
Buteo::SyncProfile::~SyncProfile
~SyncProfile()
Destructor.
Definition SyncProfile.cpp:152
Buteo::SyncProfile::syncType
SyncType syncType() const
Gets the sync type of this profile.
Definition SyncProfile.cpp:305
Buteo::SyncProfile::setConflictResolutionPolicy
void setConflictResolutionPolicy(ConflictResolutionPolicy aPolicy)
Set conflict resolution policy.
Definition SyncProfile.cpp:603
Buteo::SyncProfile::conflictResolutionPolicy
ConflictResolutionPolicy conflictResolutionPolicy() const
Gets conflict resolution policy.
Definition SyncProfile.cpp:582
Buteo::SyncProfile::SyncType
SyncType
Synchronization types.
Definition SyncProfile.h:52
Buteo::SyncProfile::SYNC_MANUAL
@ SYNC_MANUAL
Synchronization is started manually.
Definition SyncProfile.h:54
Buteo::SyncProfile::SYNC_SCHEDULED
@ SYNC_SCHEDULED
Definition SyncProfile.h:58
Buteo::SyncProfile::DestinationType
DestinationType
Sync destination type.
Definition SyncProfile.h:62
Buteo::SyncProfile::DESTINATION_TYPE_DEVICE
@ DESTINATION_TYPE_DEVICE
Destination is a device (N95, Harmattan, OviSuite etc.).
Definition SyncProfile.h:64
Buteo::SyncProfile::DESTINATION_TYPE_UNDEFINED
@ DESTINATION_TYPE_UNDEFINED
Destination type is not defined.
Definition SyncProfile.h:70
Buteo::SyncProfile::DESTINATION_TYPE_ONLINE
@ DESTINATION_TYPE_ONLINE
Destination is an online service.
Definition SyncProfile.h:67
Buteo::SyncProfile::addResults
void addResults(const SyncResults &aResults)
Adds synchronization results to the log.
Definition SyncProfile.cpp:296
Buteo::SyncProfile::setSyncDirection
void setSyncDirection(SyncDirection aDirection)
Sets sync direction.
Definition SyncProfile.cpp:550
Buteo::SyncProfile::CurrentSyncStatus
CurrentSyncStatus
Current status enum.
Definition SyncProfile.h:101
Buteo::SyncProfile::SYNC_SUCCESS
@ SYNC_SUCCESS
SYNC_SUCCESS - the last sync has been successful.
Definition SyncProfile.h:106
Buteo::SyncProfile::SYNC_FAILED
@ SYNC_FAILED
SYNC_FAILED - the last sync has failed.
Definition SyncProfile.h:109
Buteo::SyncProfile::SYNC_NEVER_HAPPENED
@ SYNC_NEVER_HAPPENED
NOT_SYNCED - no sync has been done for the profile yet.
Definition SyncProfile.h:103
Buteo::SyncProfile::SYNC_CANCLLED
@ SYNC_CANCLLED
SYNC_CANCELLED - the last sync has been cancelled.
Definition SyncProfile.h:112
Buteo::SyncProfile::internetConnectionTypes
QList< Sync::InternetConnectionType > internetConnectionTypes() const
Gets allowed connection types.
Definition SyncProfile.cpp:328
Buteo::SyncProfile::setInternetConnectionTypes
void setInternetConnectionTypes(const QList< Sync::InternetConnectionType > &aTypes)
Sets the internet connection types on which this profile can be synced.
Definition SyncProfile.cpp:343
Buteo::SyncResults
Contains information about a completed synchronization session.
Definition SyncResults.h:67
Buteo::SyncSchedule
Class for handling sync schedule settings.
Definition SyncSchedule.h:53
QList
Definition SyncBackupAdaptor.h:40