~seb128/sync-monitor/synchronization-typo

« back to all changes in this revision

Viewing changes to src/sync-account.h

  • Committer: CI bot
  • Author(s): Renato Araujo Oliveira Filho
  • Date: 2014-04-09 06:46:43 UTC
  • mfrom: (17.1.46 initial-release)
  • Revision ID: ps-jenkins@lists.canonical.com-20140409064643-bidc0po4gfxj6vol
Updated package version. Fixes: 1302159, 1302160, 1302171

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
#include <QtCore/QObject>
23
23
#include <QtCore/QHash>
 
24
#include <QtCore/QSettings>
24
25
 
25
26
#include <Accounts/Account>
26
27
 
27
28
#include "dbustypes.h"
28
29
 
29
30
class SyncEvolutionSessionProxy;
 
31
class SyncConfigure;
 
32
 
30
33
class SyncAccount : public QObject
31
34
{
32
35
    Q_OBJECT
35
38
    static const QString GoogleContactService;
36
39
 
37
40
    enum AccountState {
38
 
        Empty,
39
 
        Configuring,
 
41
        Configuring = 0,
40
42
        Syncing,
41
43
        Idle,
42
44
        Invalid
43
45
    };
44
46
 
45
 
    SyncAccount(Accounts::Account *account, QObject *parent=0);
46
 
    ~SyncAccount();
 
47
    SyncAccount(Accounts::Account *account,
 
48
                QSettings *settings,
 
49
                QObject *parent=0);
 
50
    virtual ~SyncAccount();
47
51
 
48
 
    void setup();
49
 
    void cancel();
50
 
    void sync();
 
52
    virtual void setup();
 
53
    void cancel(const QString &serviceName = QString());
 
54
    void sync(const QString &serviceName = QString());
51
55
    void wait();
52
56
    void status() const;
53
57
    AccountState state() const;
54
 
    QDateTime lastSyncDate() const;
55
58
    bool enabled() const;
56
59
    QString displayName() const;
57
60
    int id() const;
 
61
    QString iconName(const QString &serviceName) const;
 
62
    virtual QStringList availableServices() const;
 
63
    QStringList enabledServices() const;
 
64
    uint lastError() const;
 
65
 
 
66
    static QString statusDescription(const QString &status);
58
67
 
59
68
Q_SIGNALS:
60
69
    void stateChanged(AccountState newState);
61
 
    void syncStarted();
62
 
    void syncFinished();
63
 
    void syncError(int);
64
 
    void enableChanged(bool enable);
65
 
    void configured();
 
70
    void syncStarted(const QString &serviceName, bool firstSync);
 
71
    void syncFinished(const QString &serviceName, bool firstSync, const QString &status);
 
72
    void syncError(const QString &serviceName, int errorCode);
 
73
    void enableChanged(const QString &serviceName, bool enable);
 
74
    void configured(const QString &serviceName);
66
75
 
67
76
private Q_SLOTS:
 
77
    void onAccountConfigured();
 
78
    void onAccountConfigureError();
 
79
 
68
80
    void onAccountEnabledChanged(const QString &serviceName, bool enabled);
69
81
    void onSessionStatusChanged(const QString &newStatus);
70
82
    void onSessionProgressChanged(int progress);
73
85
private:
74
86
    Accounts::Account *m_account;
75
87
    SyncEvolutionSessionProxy *m_currentSession;
 
88
    QSettings *m_settings;
76
89
 
77
 
    QString m_sessionName;
78
 
    QStringMap m_syncOperation;
 
90
    QMap<QString, bool> m_availabeServices;
79
91
    AccountState m_state;
80
92
    QList<QMetaObject::Connection> m_sessionConnections;
81
 
 
82
 
    void configure();
83
 
    void continueConfigure();
84
 
    bool configSync();
85
 
    bool configTarget();
 
93
    QList<SyncConfigure*> m_pendingConfigs;
 
94
    uint m_lastError;
 
95
 
 
96
    // current sync information
 
97
    QString m_syncMode;
 
98
    QString m_syncServiceName;
 
99
    bool m_firstSync;
 
100
 
 
101
    void configure(const QString &serviceName);
86
102
    void setState(AccountState state);
87
 
    void continueSync();
 
103
    void continueSync(const QString &serviceName);
88
104
    void attachSession(SyncEvolutionSessionProxy *session);
89
105
    void releaseSession();
90
 
    QStringMap lastReport() const;
91
 
    QString lastSyncStatus() const;
 
106
    QStringMap lastReport(const QString &serviceName) const;
 
107
    QString syncMode(const QString &serviceName, bool *firstSync) const;
 
108
    QString lastSyncStatus(const QString &serviceName) const;
 
109
    bool syncService(const QString &serviceName);
 
110
    void setupServices();
 
111
    QString sessionName(const QString &serviceName) const;
 
112
    void dumpReport(const QStringMap &report) const;
92
113
};
93
114
 
94
115
#endif