Hey guys,
I am using the DBUS API for a while do to simple syncs, but now I want
to sync all remote calendars from Google(Webdav) into individual local
calendars (EDS-calendars).
I am trying to reproduce the steps of this tutorial[1] with DBUS API.
Until now I think I did it right since I can sync it manually in the
end using:
syncevolution --sync refresh-from-remote <peer-name> <source-name>
But I fail to sync it using the DBUS API. Probably I am missing
something during the implementation. Could you guys help me with that?
These are a high level commands of the translation from command line to DBUS API
COMMAND:
Syncevolution --configure
--template Google username=uoa:ACCOUNT_ID,google-calendar
syncURL=https://apidata.googleusercontent.com/caldav/v2
target-config@gcal
syncevolution --configure
database=https://apidata.googleusercontent.com/caldav/v2/GOOGLECALENDARID...
backend=caldav target-config@gcal workcal
DBUS:
// create a new session with name "gcal"
session = Server.StartSessionWithFlags("gcal", ["all-configs"])
// get Google Template
config = session.GetConfig("Google", true)
config[""]["username"] =
QString("uoa:%1,google-caldav").arg(m_account->id());
config[""]["password"] = QString();
// use "source/calendar" as template for each remote database
template = config["source/calendar"]
// helper.listRemoteDatabase internal function that retrieves all the
remote database using
// Session.GetDatabases
foreach(db, helper.listRemoteDatabase()) {
calendar = template
calendar[database] = db.source
config["source/" + normalize(db.name)] = calendar
}
// save the new config with the new sources
session->SetNamedConfig("target-config@gcal", config)
COMMAND:
syncevolution --configure backend=evolution-calendar database=Work
@default workcal
DBUS:
// start a new session without name
session = Server.StartSessionWithFlags("", ["all-configs"])
// retrieve the @default config
config = session->GetConfig("@default", false);
// add a storage for each remote database with individuals local calendars
foreach(db, helper.listRemoteDatabase()) {
config["source/" + normalize(db.name)]["backend"] =
"evolution-calendar"
config["source/" + normalize(db.name)]["database"] =
localDatabase[db.source]
}
// save changes on @default config
session->SetNamedConfig("@default", config)
COMMAND:
syncevolution --configure --template SyncEvolution_Client
syncURL=local://@gcal username= password= gcal workcal
DBUS:
// start a session without name
session = Server.StartSessionWithFlags("", ["all-configs"])
// get the tamplate config for "SyncEvolution_Client"
config = session->GetConfig("SyncEvolution_Client", true);
// link with "gcal" remote source
config[""]["syncURL"] = QString("local://@gcal");
config[""]["username"] = QString();
config[""]["password"] = QString();
// save the new config with name "gcal"
session->SetNamedConfig("gcal", config)
COMMAND:
syncevolution --sync refresh-from-remote gcal workcal
DBUS:
// try to sync invidual sources
// start a new session without name (probably the error is here I am
not sure which name to use for the session)
session = Server.StartSessionWithFlags("", [])
syncSources = {}
foreach(db, helper.listRemoteDatabase()) {
syncSources.insert(normalize(db.name), "refresh-from-remote")
}
// start a sync for all sources
session.Sync('', syncSources)