|
ButeoSynchronizationFramework
|
25 #ifndef SYNCHRONIZER_H
26 #define SYNCHRONIZER_H
28 #include "SyncDBusInterface.h"
29 #include "SyncQueue.h"
30 #include "StorageBooker.h"
31 #include "SyncScheduler.h"
32 #include "SyncBackup.h"
33 #include "SyncOnChange.h"
34 #include "SyncOnChangeScheduler.h"
36 #include "SyncCommonDefs.h"
37 #include "ProfileManager.h"
38 #include "PluginManager.h"
39 #include "PluginCbInterface.h"
40 #include "ClientPlugin.h"
44 #include <QCoreApplication>
47 #include <QDBusInterface>
48 #include <QScopedPointer>
56 class ServerPluginRunner;
58 class TransportTracker;
59 class ServerActivator;
110 virtual QString
getValue(
const QString& aAddress,
const QString& aKey);
119 virtual bool startSync(QString aProfileName);
122 virtual void abortSync(QString aProfileName);
140 virtual bool setSyncSchedule(QString aProfileId , QString aScheduleAsXml);
170 virtual QString
syncProfile(
const QString &aProfileId);
171 virtual QStringList syncProfilesByKey(
const QString &aKey,
const QString &aValue);
172 virtual QStringList syncProfilesByType(
const QString &aType);
193 void start(
unsigned int aAccountId);
199 void stop(
unsigned int aAccountId);
220 int status(
unsigned int aAccountId,
int &aFailedReason, qlonglong &aPrevSyncTime, qlonglong &aNextSyncTime);
242 void syncDone(
const QString &aProfileName);
251 void onStorageReleased();
253 void onTransferProgress(
const QString &aProfileName,
254 Sync::TransferDatabase aDatabase, Sync::TransferType aType,
255 const QString &aMimeType,
int aCommittedItems );
257 void onSessionFinished(
const QString &aProfileName,
258 Sync::SyncStatus aStatus,
const QString &aMessage,
int aErrorCode );
260 void onStorageAccquired(
const QString &aProfileName,
const QString &aMimeType);
262 void onSyncProgressDetail(
const QString &aProfileName,
int aProgressDetail);
266 void onNewSession(
const QString &aDestination);
268 void slotProfileChanged(QString aProfileName,
int aChangeType , QString aProfileAsXml);
274 void startServer(
const QString &aProfileName);
280 void stopServer(
const QString &aProfileName);
282 void onNetworkStateChanged(
bool aState, Sync::InternetConnectionType type);
290 void enableSOCSlot(
const QString& aProfileName);
296 void reschedule(
const QString &aProfileName);
305 void slotSyncStatus(QString aProfileName,
int aStatus,
306 QString aMessage,
int aMoreDetails);
312 void removeScheduledSync(
const QString &aProfileName);
319 void externalSyncStatus(
const QString &aProfileName,
bool aQuery);
322 void profileChangeTriggerTimeout();
326 bool startSync(
const QString &aProfileName,
bool aScheduled);
341 bool startNextSync();
348 void cleanupSession(
SyncSession *aSession, Sync::SyncStatus aStatus);
354 void startServers(
bool resume =
false );
360 void stopServers(
bool suspend =
false );
365 void backupRestoreStarts ();
370 void backupRestoreFinished();
375 void initializeScheduler();
377 bool isBackupRestoreInProgress ();
384 bool cleanupProfile(
const QString &profileId);
386 bool clientProfileActive(
const QString &clientProfileName);
393 void removeExternalSyncStatus(
const SyncProfile *aProfile);
399 bool acceptScheduledSync(
bool aConnected, Sync::InternetConnectionType aType,
SyncProfile *profile)
const;
408 void externalSyncStatus(
const SyncProfile *aProfile,
bool aQuery=
false);
452 void saveProfileCounter(
const SyncProfile* aProfile);
473 QTimer iProfileChangeTriggerTimer;
475 #ifdef SYNCFW_UNIT_TESTS
476 friend class SynchronizerTest;
479 QDBusInterface *iSyncUIInterface;
480 _GSettings *iSettings;
481 BatteryInfo *iBatteryInfo;
486 #endif // SYNCHRONIZER_H
Helper Class towards Accounts::Manager and various SSO related operations.
Definition: AccountsHelper.h:43
virtual StoragePlugin * createStorage(const QString &aPluginName)
Definition: synchronizer.cpp:1156
Defines a D-Bus interface for the sync daemon.
Definition: msyncd/SyncDBusInterface.h:41
virtual bool setSyncSchedule(QString aProfileId, QString aScheduleAsXml)
Definition: synchronizer.cpp:379
virtual ~Synchronizer()
Destructor.
Definition: synchronizer.cpp:95
this class initiates a sync if there are changes in storage(s) it's asked to monitor
Definition: SyncOnChange.h:19
Class for tracking transport states.
Definition: TransportTracker.h:44
virtual QString createSyncProfileForAccount(uint aAccountId)
Definition: synchronizer.cpp:403
void isSyncedExternally(unsigned int aAccountId, const QString aClientProfileName)
Queries the sync externally status of a given account, 'syncedExternallyStatus' signal is emitted wit...
Definition: synchronizer.cpp:2242
virtual bool isConnectivityAvailable(Sync::ConnectivityType aType)
Definition: synchronizer.cpp:1202
Manages plugins.
Definition: PluginManager.h:67
virtual bool getBackUpRestoreState()
Called to get the current backup/restore state.
Definition: synchronizer.cpp:1802
Definition: SyncBackupAdaptor.h:40
Class for queuing sync sessions.
Definition: SyncQueue.h:37
virtual QString syncProfile(const QString &aProfileId)
Gets a sync profile.
Definition: synchronizer.cpp:1974
virtual bool requestStorages(QStringList aStorageNames)
Definition: synchronizer.cpp:1057
Base class for storage plugins.
Definition: StoragePlugin.h:38
The main entry point to the synchronization framework.
Definition: synchronizer.h:67
void syncDone(const QString &aProfileName)
emit this signal when the sync session is completed, this is useful when the session status is not im...
Definition: moc_synchronizer.cpp:426
Definition: SyncBackupAdaptor.h:41
virtual QString getValue(const QString &aAddress, const QString &aKey)
Definition: synchronizer.cpp:2098
A top level synchronization profile.
Definition: SyncProfile.h:48
bool initialize()
registers the dbus service and creates handlers for various tasks of the synchronizer
Definition: synchronizer.cpp:107
bool startScheduledSync(QString aProfileName)
Called starts a schedule sync.
Definition: synchronizer.cpp:312
virtual bool removeProfile(QString aProfileAsXml)
Definition: synchronizer.cpp:984
Keeps track of which server plug-ins should be enabled.
Definition: ServerActivator.h:47
void backupFinished()
Called when backup is completed.
Definition: synchronizer.cpp:1781
void backupStarts()
Called when backup starts.
Definition: synchronizer.cpp:1774
Synchronizer(QCoreApplication *aApplication)
The contructor.
Definition: synchronizer.cpp:74
virtual void releaseStorages(QStringList aStorageNames)
Definition: synchronizer.cpp:1064
virtual Profile * getSyncProfileByRemoteAddress(const QString &aAddress)
Definition: synchronizer.cpp:2074
Base class for client and server plugins.
Definition: SyncPluginBase.h:45
A helper class for managing storage reservations.
Definition: StorageBooker.h:36
virtual QStringList allVisibleSyncProfiles()
Gets all visible sync profiles.
Definition: synchronizer.cpp:1953
ProfileManager is responsible for storing and retrieving the profiles.
Definition: ProfileManager.h:45
This class represents a single profile, a collection of settings or data releated to some entity.
Definition: Profile.h:52
virtual QString getLastSyncResult(const QString &aProfileId)
To get lastSyncResult.
Definition: synchronizer.cpp:1927
virtual void abortSync(QString aProfileName)
Definition: synchronizer.cpp:886
void storageReleased()
emitted by releaseStorages call
Definition: moc_synchronizer.cpp:420
void stop(unsigned int aAccountId)
Stops sync for all profiles matching the given account ID.
Definition: synchronizer.cpp:1820
virtual bool updateProfile(QString aProfileAsXml)
Definition: synchronizer.cpp:1005
int status(unsigned int aAccountId, int &aFailedReason, qlonglong &aPrevSyncTime, qlonglong &aNextSyncTime)
Returns the status of the sync for the given account Id.
Definition: synchronizer.cpp:1832
void close()
stops the daemon and unregisters the dbus object
Definition: synchronizer.cpp:256
virtual bool requestStorage(const QString &aStorageName, const SyncPluginBase *aCaller)
Definition: synchronizer.cpp:1138
SyncScheduler Object to be used to set Schedule via the framework.
Definition: SyncScheduler.h:54
virtual bool saveSyncResults(QString aProfileId, QString aSyncResults)
Definition: synchronizer.cpp:389
virtual QStringList runningSyncs()
Definition: synchronizer.cpp:1072
QList< unsigned int > syncingAccounts()
Returns the list of account IDs for which sync is ongoing.
Definition: synchronizer.cpp:1892
void restoreFinished()
Called when backup is restored.
Definition: synchronizer.cpp:1795
virtual bool startSync(QString aProfileName)
Definition: synchronizer.cpp:304
Handles Sync requirements towards Backup.
Definition: SyncBackup.h:37
virtual void releaseStorage(const QString &aStorageName, const SyncPluginBase *aCaller)
Definition: synchronizer.cpp:1147
virtual void destroyStorage(StoragePlugin *aStorage)
Definition: synchronizer.cpp:1195
Definition: SyncOnChangeScheduler.h:15
Class representing a single sync session.
Definition: SyncSession.h:43
void restoreStarts()
Called when starting to restore a backup.
Definition: synchronizer.cpp:1788
Class for managing network sessions.
Definition: NetworkManager.h:43
Interface which client and server plugins can use to communicate with synchronization daemon.
Definition: PluginCbInterface.h:38