24 #ifndef SYNCHRONIZER_H 25 #define SYNCHRONIZER_H 27 #include "SyncDBusInterface.h" 28 #include "SyncQueue.h" 29 #include "StorageBooker.h" 30 #include "SyncScheduler.h" 31 #include "SyncBackup.h" 32 #include "SyncOnChange.h" 33 #include "SyncOnChangeScheduler.h" 35 #include "SyncCommonDefs.h" 36 #include "ProfileManager.h" 37 #include "PluginManager.h" 38 #include "PluginCbInterface.h" 39 #include "ClientPlugin.h" 43 #include <QCoreApplication> 46 #include <QDBusInterface> 47 #include <QScopedPointer> 55 class ServerPluginRunner;
57 class TransportTracker;
58 class ServerActivator;
109 virtual QString
getValue(
const QString& aAddress,
const QString& aKey);
118 virtual bool startSync(QString aProfileName);
121 virtual void abortSync(QString aProfileName);
139 virtual bool setSyncSchedule(QString aProfileId , QString aScheduleAsXml);
169 virtual QString
syncProfile(
const QString &aProfileId);
170 virtual QStringList syncProfilesByKey(
const QString &aKey,
const QString &aValue);
171 virtual QStringList syncProfilesByType(
const QString &aType);
192 void start(
unsigned int aAccountId);
198 void stop(
unsigned int aAccountId);
219 int status(
unsigned int aAccountId,
int &aFailedReason, qlonglong &aPrevSyncTime, qlonglong &aNextSyncTime);
241 void syncDone(
const QString &aProfileName);
250 void onStorageReleased();
252 void onTransferProgress(
const QString &aProfileName,
253 Sync::TransferDatabase aDatabase, Sync::TransferType aType,
254 const QString &aMimeType,
int aCommittedItems );
256 void onSessionFinished(
const QString &aProfileName,
257 Sync::SyncStatus aStatus,
const QString &aMessage,
int aErrorCode );
259 void onStorageAccquired(
const QString &aProfileName,
const QString &aMimeType);
261 void onSyncProgressDetail(
const QString &aProfileName,
int aProgressDetail);
265 void onNewSession(
const QString &aDestination);
267 void slotProfileChanged(QString aProfileName,
int aChangeType , QString aProfileAsXml);
273 void startServer(
const QString &aProfileName);
279 void stopServer(
const QString &aProfileName);
281 void onNetworkStateChanged(
bool aState, Sync::InternetConnectionType type);
289 void enableSOCSlot(
const QString& aProfileName);
295 void reschedule(
const QString &aProfileName);
304 void slotSyncStatus(QString aProfileName,
int aStatus,
305 QString aMessage,
int aMoreDetails);
311 void removeScheduledSync(
const QString &aProfileName);
320 void externalSyncStatus(
const SyncProfile *aProfile,
bool aQuery=
false);
323 void profileChangeTriggerTimeout();
327 bool startSync(
const QString &aProfileName,
bool aScheduled);
342 bool startNextSync();
349 void cleanupSession(
SyncSession *aSession, Sync::SyncStatus aStatus);
355 void startServers(
bool resume =
false );
361 void stopServers(
bool suspend =
false );
366 void backupRestoreStarts ();
371 void backupRestoreFinished();
376 void initializeScheduler();
378 bool isBackupRestoreInProgress ();
385 bool cleanupProfile(
const QString &profileId);
387 bool clientProfileActive(
const QString &clientProfileName);
394 void removeExternalSyncStatus(
const SyncProfile *aProfile);
400 bool acceptScheduledSync(
bool aConnected, Sync::InternetConnectionType aType)
const;
444 void saveProfileCounter(
const SyncProfile* aProfile);
465 QTimer iProfileChangeTriggerTimer;
467 #ifdef SYNCFW_UNIT_TESTS 468 friend class SynchronizerTest;
471 QDBusInterface *iSyncUIInterface;
472 _GSettings *iSettings;
473 BatteryInfo *iBatteryInfo;
478 #endif // SYNCHRONIZER_H virtual QStringList runningSyncs()
Definition: synchronizer.cpp:1033
virtual Profile * getSyncProfileByRemoteAddress(const QString &aAddress)
Definition: synchronizer.cpp:2018
void restoreFinished()
Called when backup is restored.
Definition: synchronizer.cpp:1743
This class represents a single profile, a collection of settings or data releated to some entity...
Definition: Profile.h:52
virtual bool startSync(QString aProfileName)
Definition: synchronizer.cpp:316
Definition: SyncOnChangeScheduler.h:15
Manages plugins.
Definition: PluginManager.h:91
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:2151
virtual void releaseStorages(QStringList aStorageNames)
Definition: synchronizer.cpp:1025
void close()
stops the daemon and unregisters the dbus object
Definition: synchronizer.cpp:268
this class initiates a sync if there are changes in storage(s) it's asked to monitor ...
Definition: SyncOnChange.h:19
virtual bool requestStorages(QStringList aStorageNames)
Definition: synchronizer.cpp:1018
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:1780
QList< unsigned int > syncingAccounts()
Returns the list of account IDs for which sync is ongoing.
Definition: synchronizer.cpp:1840
virtual QStringList allVisibleSyncProfiles()
Gets all visible sync profiles.
Definition: synchronizer.cpp:1901
Definition: AccountsHelper.h:31
Synchronizer(QCoreApplication *aApplication)
The contructor.
Definition: synchronizer.cpp:88
void storageReleased()
emitted by releaseStorages call
Definition: moc_synchronizer.cpp:420
Class for queuing sync sessions.
Definition: SyncQueue.h:37
void stop(unsigned int aAccountId)
Stops sync for all profiles matching the given account ID.
Definition: synchronizer.cpp:1768
virtual StoragePlugin * createStorage(const QString &aPluginName)
Definition: synchronizer.cpp:1117
virtual QString createSyncProfileForAccount(uint aAccountId)
Definition: synchronizer.cpp:376
Keeps track of which server plug-ins should be enabled.
Definition: ServerActivator.h:47
virtual bool setSyncSchedule(QString aProfileId, QString aScheduleAsXml)
Definition: synchronizer.cpp:352
virtual bool isConnectivityAvailable(Sync::ConnectivityType aType)
Definition: synchronizer.cpp:1163
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
virtual bool requestStorage(const QString &aStorageName, const SyncPluginBase *aCaller)
Definition: synchronizer.cpp:1099
The main entry point to the synchronization framework.
Definition: synchronizer.h:66
Defines a D-Bus interface for the sync daemon.
Definition: msyncd/SyncDBusInterface.h:41
virtual ~Synchronizer()
Destructor.
Definition: synchronizer.cpp:109
Helper Class towards Accounts::Manager and various SSO related operations.
Definition: AccountsHelper.h:43
ProfileManager is responsible for storing and retrieving the profiles.
Definition: ProfileManager.h:45
virtual void releaseStorage(const QString &aStorageName, const SyncPluginBase *aCaller)
Definition: synchronizer.cpp:1108
virtual QString getLastSyncResult(const QString &aProfileId)
To get lastSyncResult.
Definition: synchronizer.cpp:1875
Class representing a single sync session.
Definition: SyncSession.h:43
virtual bool saveSyncResults(QString aProfileId, QString aSyncResults)
Definition: synchronizer.cpp:362
SyncScheduler Object to be used to set Schedule via the framework.
Definition: SyncScheduler.h:52
Interface which client and server plugins can use to communicate with synchronization daemon...
Definition: PluginCbInterface.h:38
virtual bool getBackUpRestoreState()
Called to get the current backup/restore state.
Definition: synchronizer.cpp:1750
Handles Sync requirements towards Backup.
Definition: SyncBackup.h:37
virtual QString syncProfile(const QString &aProfileId)
Gets a sync profile.
Definition: synchronizer.cpp:1922
virtual bool updateProfile(QString aProfileAsXml)
Definition: synchronizer.cpp:966
virtual void destroyStorage(StoragePlugin *aStorage)
Definition: synchronizer.cpp:1156
void backupFinished()
Called when backup is completed.
Definition: synchronizer.cpp:1729
Class for managing network sessions.
Definition: NetworkManager.h:43
void restoreStarts()
Called when starting to restore a backup.
Definition: synchronizer.cpp:1736
Base class for client and server plugins.
Definition: SyncPluginBase.h:45
A top level synchronization profile.
Definition: SyncProfile.h:47
bool initialize()
registers the dbus service and creates handlers for various tasks of the synchronizer ...
Definition: synchronizer.cpp:121
Class for tracking transport states.
Definition: TransportTracker.h:47
A helper class for managing storage reservations.
Definition: StorageBooker.h:36
Base class for storage plugins.
Definition: StoragePlugin.h:38
virtual bool removeProfile(QString aProfileAsXml)
Definition: synchronizer.cpp:945
bool startScheduledSync(QString aProfileName)
Called starts a schedule sync.
Definition: synchronizer.cpp:324
virtual void abortSync(QString aProfileName)
Definition: synchronizer.cpp:847
Definition: SyncBackupAdaptor.h:41
void backupStarts()
Called when backup starts.
Definition: synchronizer.cpp:1722
Definition: SyncBackupAdaptor.h:40
virtual QString getValue(const QString &aAddress, const QString &aKey)
Definition: synchronizer.cpp:2042