~phablet-team/sync-monitor/trunk

« back to all changes in this revision

Viewing changes to src/sync-daemon.cpp

  • Committer: Renato Araujo Oliveira Filho
  • Date: 2014-04-07 22:00:28 UTC
  • mto: (17.3.2 initial-release)
  • mto: This revision was merged to the branch mainline in revision 18.
  • Revision ID: renato.filho@canonical.com-20140407220028-o690634v7u7bpbp0
Show service icon on notify message.

Show diffs side-by-side

added added

removed removed

Lines of Context:
248
248
void SyncDaemon::cancel(SyncAccount *syncAcc, const QString &serviceName)
249
249
{
250
250
    NotifyMessage::instance()->show("Syncronization",
251
 
                                    QString("Sync canceled: %1").arg(syncAcc->displayName()));
 
251
                                    QString("Sync canceled: %1").arg(syncAcc->displayName()),
 
252
                                    syncAcc->iconName(serviceName));
252
253
    m_syncQueue->remove(syncAcc, serviceName);
253
254
    syncAcc->cancel(serviceName);
254
255
    Q_EMIT syncError(syncAcc, serviceName, "canceled");
269
270
    if (firstSync) {
270
271
        NotifyMessage::instance()->show("Syncronization",
271
272
                                        QString("Start sync:  %1 (%2)")
272
 
                                        .arg(m_currentAccount->displayName())
273
 
                                        .arg(serviceName));
 
273
                                            .arg(m_currentAccount->displayName())
 
274
                                            .arg(serviceName),
 
275
                                        m_currentAccount->iconName(serviceName));
274
276
    }
275
277
    m_syncElapsedTime.restart();
276
278
    qDebug() << QString("[%3] Start sync:  %1 (%2)")
286
288
    if (firstSync && errorMessage.isEmpty()) {
287
289
        NotifyMessage::instance()->show("Syncronization",
288
290
                                        QString("Sync done: %1 (%2)")
289
 
                                        .arg(m_currentAccount->displayName())
290
 
                                        .arg(serviceName));
 
291
                                            .arg(m_currentAccount->displayName())
 
292
                                            .arg(serviceName),
 
293
                                        m_currentAccount->iconName(serviceName));
291
294
    } else if (!errorMessage.isEmpty()) {
292
295
        NotifyMessage::instance()->show("Syncronization",
293
296
                                        QString("Fail to sync %1 (%2).\n%3")
294
 
                                        .arg(m_currentAccount->displayName())
295
 
                                        .arg(serviceName)
296
 
                                        .arg(errorMessage));
 
297
                                            .arg(m_currentAccount->displayName())
 
298
                                            .arg(serviceName)
 
299
                                            .arg(errorMessage),
 
300
                                        m_currentAccount->iconName(serviceName));
297
301
    }
298
302
 
299
303
    qDebug() << QString("[%6] Sync done: %1 (%2) Status: %3 Error: %4 Duration: %5s")
313
317
{
314
318
    NotifyMessage::instance()->show("Syncronization",
315
319
                                    QString("Sync error account: %1, %2, %3")
316
 
                                    .arg(m_currentAccount->displayName())
317
 
                                    .arg(serviceName)
318
 
                                    .arg(errorCode));
 
320
                                        .arg(m_currentAccount->displayName())
 
321
                                        .arg(serviceName)
 
322
                                        .arg(errorCode),
 
323
                                    m_currentAccount->iconName(serviceName));
319
324
 
320
325
    Q_EMIT syncError(m_currentAccount, serviceName, QString(errorCode));
321
326
    // sync next account