~phablet-team/sync-monitor/trunk

« back to all changes in this revision

Viewing changes to src/sync-daemon.h

  • Committer: Bileto Bot
  • Author(s): Renato Araujo Oliveira Filho
  • Date: 2016-07-01 02:14:41 UTC
  • mfrom: (37.3.61 sync-individual-sources)
  • Revision ID: ci-train-bot@canonical.com-20160701021441-su9ubhybvttesfqt
Remove syncevolution account config files if the account get removed.
Avoid create extra sources for accounts on syncevolution config.
Create a config for each google calendar.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
#include <Accounts/Manager>
29
29
 
30
30
#include "sync-network.h"
 
31
#include "sync-queue.h"
31
32
 
32
33
class SyncAccount;
33
34
class EdsHelper;
34
35
class ProviderTemplate;
35
 
class SyncQueue;
36
36
class SyncDBus;
37
37
class PowerdProxy;
38
38
 
49
49
    QStringList availableServices() const;
50
50
    QStringList enabledServices() const;
51
51
    bool isOnline() const;
52
 
    QString lastSuccessfulSyncDate(quint32 accountId, const QString &service);
 
52
    QString lastSuccessfulSyncDate(quint32 accountId, const QString &calendarId);
53
53
    bool syncOnMobileConnection() const;
54
54
    void setSyncOnMobileConnection(bool flag);
55
55
 
 
56
    SyncAccount *accountById(quint32 accountId);
 
57
 
56
58
Q_SIGNALS:
57
 
    void syncStarted(SyncAccount *syncAcc, const QString &serviceName);
58
 
    void syncFinished(SyncAccount *syncAcc, const QString &serviceName);
59
 
    void syncError(SyncAccount *syncAcc, const QString &serviceName, const QString &error);
 
59
    void syncStarted(SyncAccount *syncAcc, const QString &source);
 
60
    void syncFinished(SyncAccount *syncAcc, const QString &source);
 
61
    void syncError(SyncAccount *syncAcc, const QString &source, const QString &error);
60
62
    void syncAboutToStart();
61
63
    void done();
62
64
    void accountsChanged();
64
66
 
65
67
public Q_SLOTS:
66
68
    void quit();
67
 
    void syncAll(const QString &serviceName, bool runNow, bool syncOnMobile);
68
 
    void syncAccount(quint32 accountId, const QString &service);
69
 
    void cancel(const QString &serviceName = QString());
 
69
    void syncAll(bool runNow, bool syncOnMobile);
 
70
    void syncAccount(quint32 accountId, const QStringList &calendars, bool runNow = true, bool syncOnMobile = false);
 
71
    void cancel(uint accountId = 0, const QStringList &sources = QStringList());
70
72
 
71
73
private Q_SLOTS:
72
74
    void continueSync();
77
79
                             const QString &serviceName);
78
80
    void runAuthentication();
79
81
 
80
 
    void onAccountSyncStarted(const QString &serviceName, bool firstSync);
81
 
    void onAccountSyncFinished(const QString &serviceName, bool firstSync, const QString &status, const QString &syncMode);
 
82
 
 
83
    void onAccountSyncStart();
 
84
    void onAccountSyncFinished(const QString &serviceName, const QMap<QString, QString> &statusList);
 
85
    void onAccountSourceSyncStarted(const QString &serviceName, const QString &source, bool firstSync);
 
86
    void onAccountSourceSyncFinished(const QString &serviceName, const QString &sourceName, const bool firstSync, const QString &status, const QString &mode);
82
87
    void onAccountSyncError(const QString &serviceName, const QString &error);
83
88
    void onAccountEnableChanged(const QString &serviceName, bool enabled);
84
 
    void onAccountConfigured(const QString &serviceName);
85
 
    void onDataChanged(const QString &serviceName, const QString &sourceName);
 
89
    void onAccountSourceRemoved(const QString &source);
 
90
    void onDataChanged(const QString &sourceId);
86
91
    void onClientAttached();
87
92
 
88
93
    void onOnlineStatusChanged(SyncNetwork::NetworkState state);
93
98
    QHash<Accounts::AccountId, SyncAccount*> m_accounts;
94
99
    SyncQueue *m_syncQueue;
95
100
    SyncQueue *m_offlineQueue;
96
 
    SyncAccount *m_currentAccount;
97
 
    QString m_currentServiceName;
 
101
    SyncJob m_currentJob;
98
102
    EdsHelper *m_eds;
99
103
    ProviderTemplate *m_provider;
100
104
    SyncDBus *m_dbusAddaptor;
108
112
 
109
113
    void setupAccounts();
110
114
    void setupTriggers();
111
 
    void sync(SyncAccount *syncAcc, const QString &serviceName, bool runNow, bool syncOnMobile);
112
 
    void cancel(SyncAccount *syncAcc, const QString &serviceName = QString());
113
 
    void setup();
 
115
    void cleanupConfig();
 
116
    void sync(SyncAccount *syncAcc, const QStringList &calendars, bool runNow, bool syncOnMobile);
 
117
    void cancel(SyncAccount *syncAcc, const QStringList &sources);
114
118
    void sync(bool runNow);
115
119
    bool registerService();
116
120
    void syncFinishedImpl();
 
121
 
 
122
    void saveSyncResult(uint accountId, const QString &sourceName, const QString &result, const QString &date);
 
123
    void clearResultForSource(uint accountId, const QString &sourceName);
 
124
    QString loadSyncResult(uint accountId, const QString &sourceName);
 
125
    bool isFirstSync(uint accountId);
 
126
    void cleanupLogs();
117
127
};
118
128
 
119
129
#endif