~untrusted-ci-dev-bot/sync-monitor/sync-monitor-ubuntu-yakkety-landing-008

« back to all changes in this revision

Viewing changes to src/sync-account.cpp

  • Committer: CI Train Bot
  • Author(s): Renato Araujo Oliveira Filho
  • Date: 2015-10-20 08:25:11 UTC
  • mfrom: (51.2.9 sync-by-account)
  • Revision ID: ci-train-bot@canonical.com-20151020082511-h23bqse389eci9tb
Export 'syncAcount' function over DBUs to be used during the account migration.
Approved by: Michael Sheldon

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
      m_account(account),
35
35
      m_state(SyncAccount::Idle),
36
36
      m_settings(settings),
37
 
      m_lastError(0)
 
37
      m_lastError(0),
 
38
      m_retrySync(true)
38
39
{
39
40
    setup();
40
41
}
41
42
 
 
43
SyncAccount::SyncAccount(Account *account,
 
44
                         const QString &service,
 
45
                         QSettings *settings,
 
46
                         QObject *parent)
 
47
    : QObject(parent),
 
48
      m_currentSession(0),
 
49
      m_account(account),
 
50
      m_state(SyncAccount::Idle),
 
51
      m_settings(settings),
 
52
      m_lastError(0),
 
53
      m_retrySync(true)
 
54
{
 
55
    m_availabeServices.insert(service, true);
 
56
}
 
57
 
42
58
SyncAccount::~SyncAccount()
43
59
{
44
60
    cancel();
102
118
    if (m_currentSession) {
103
119
        m_currentSession->destroy();
104
120
        m_currentSession = 0;
 
121
 
 
122
        if (m_state == SyncAccount::Syncing) {
 
123
            Q_EMIT syncError(serviceName, "canceled");
 
124
        } else {
 
125
            qDebug() << "Cancelled with no sync state";
 
126
        }
105
127
        setState(SyncAccount::Idle);
 
128
 
106
129
    }
107
130
}
108
131
 
369
392
    return QString();
370
393
}
371
394
 
 
395
bool SyncAccount::retrySync() const
 
396
{
 
397
    return m_retrySync;
 
398
}
 
399
 
 
400
void SyncAccount::setRetrySync(bool retry)
 
401
{
 
402
    m_retrySync = retry;
 
403
}
 
404
 
372
405
void SyncAccount::onAccountEnabledChanged(const QString &serviceName, bool enabled)
373
406
{
374
407
    // empty service name means that the hole account has been enabled/disabled
565
598
    case 20006:
566
599
    case 20007:
567
600
        return _("Server sent bad content");
 
601
    case 20017:
 
602
        return _("Sync canceled");
568
603
    case 20020:
569
604
        return _("Connection timeout");
570
605
    case 20021: