~phablet-team/sync-monitor/trunk

« back to all changes in this revision

Viewing changes to src/syncevolution-server-proxy.cpp

  • 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:
40
40
{
41
41
    if (m_iface) {
42
42
        m_iface->call("Detach");
43
 
        m_iface->deleteLater();
 
43
        delete m_iface;
44
44
        m_iface = 0;
45
45
    }
46
46
}
47
47
 
 
48
void SyncEvolutionServerProxy::killServer()
 
49
{
 
50
    QProcess p;
 
51
    p.execute("pkill syncevo-dbus-server");
 
52
    p.waitForFinished();
 
53
}
 
54
 
48
55
SyncEvolutionServerProxy *SyncEvolutionServerProxy::instance()
49
56
{
50
57
    if (!m_instance) {
76
83
        return 0;
77
84
    }
78
85
 
79
 
    return new SyncEvolutionSessionProxy(reply.value(), this);
 
86
    return new SyncEvolutionSessionProxy(sessionName, reply.value(), this);
80
87
}
81
88
 
82
89
QStringList SyncEvolutionServerProxy::configs(bool templates) const
84
91
    QDBusReply<QStringList> reply = m_iface->call("GetConfigs", templates);
85
92
    return reply.value();
86
93
}
 
94
 
 
95
void SyncEvolutionServerProxy::getDatabases(const QString &sourceName)
 
96
{
 
97
    QDBusPendingCall pcall =  m_iface->asyncCall("GetDatabases", sourceName);
 
98
    QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pcall, this);
 
99
 
 
100
    QObject::connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
 
101
                     this, SLOT(getDatabasesFinished(QDBusPendingCallWatcher*)));
 
102
}
 
103
 
 
104
QArrayOfStringMap SyncEvolutionServerProxy::reports(const QString &sessionName, uint start, uint count)
 
105
{
 
106
    QDBusReply<QArrayOfStringMap> reply = m_iface->call("GetReports", sessionName, start, count);
 
107
    if (reply.error().isValid()) {
 
108
        qWarning() << "Fail to get sync reports" << reply.error().message();
 
109
        return QArrayOfStringMap();
 
110
    } else {
 
111
        return reply.value();
 
112
    }
 
113
}
 
114
 
 
115
void SyncEvolutionServerProxy::getDatabasesFinished(QDBusPendingCallWatcher *call)
 
116
{
 
117
    QDBusPendingReply<QArrayOfDatabases> reply = *call;
 
118
    if (reply.isError()) {
 
119
        qWarning() << "Fail to fetch databases" << reply.error().message();
 
120
        Q_EMIT databasesReceived(QArrayOfDatabases());
 
121
    } else {
 
122
         Q_EMIT databasesReceived(reply.value());
 
123
    }
 
124
    call->deleteLater();
 
125
}