#include <EvolutionSyncClient.h>
Public Member Functions | |
EvolutionSyncClient (const string &server, bool doLogging=false, const set< string > &sources=set< string >()) | |
~EvolutionSyncClient () | |
virtual string | askPassword (const string &descr) |
bool | getQuiet () |
void | setQuiet (bool quiet) |
SyncMode | getSyncMode () |
void | setSyncMode (SyncMode syncMode) |
int | sync () |
void | status () |
virtual AbstractSyncSourceConfig * | getAbstractSyncSourceConfig (const char *name) const |
virtual AbstractSyncSourceConfig * | getAbstractSyncSourceConfig (unsigned int i) const |
virtual unsigned int | getAbstractSyncSourceConfigsCount () const |
virtual void | setConfigFilter (bool sync, const FilterConfigNode::ConfigFilter &filter) |
Static Public Member Functions | |
static void | throwError (const string &error) |
static void | throwError (const string &action, int error) |
static void | fatalError (void *object, const char *error) |
static void | startLoopThread () |
Protected Member Functions | |
virtual void | prepare (SyncSource **sources) |
Definition at line 41 of file EvolutionSyncClient.h.
EvolutionSyncClient::EvolutionSyncClient | ( | const string & | server, | |
bool | doLogging = false , |
|||
const set< string > & | sources = set<string>() | |||
) |
server | identifies the server config to be used | |
syncMode | setting this overrides the sync mode from the config | |
doLogging | write additional log and datatbase files about the sync |
Definition at line 47 of file EvolutionSyncClient.cpp.
EvolutionSyncClient::~EvolutionSyncClient | ( | ) |
Definition at line 59 of file EvolutionSyncClient.cpp.
string EvolutionSyncClient::askPassword | ( | const string & | descr | ) | [virtual] |
A helper function which interactively asks the user for a certain password. May throw errors.
The default implementation uses stdin/stdout to communicate with the user.
descr | A simple string explaining what the password is needed for, e.g. "SyncML server". Has to be unique and understandable by the user. |
Implements ConfigUserInterface.
Definition at line 588 of file EvolutionSyncClient.cpp.
References throwError().
void EvolutionSyncClient::fatalError | ( | void * | object, | |
const char * | error | |||
) | [static] |
An error handler which prints the error message and then stops the program. Never returns.
The API was chosen so that it can be used as libebook/libecal "backend-dies" signal handler.
Definition at line 628 of file EvolutionSyncClient.cpp.
References SourceList::syncDone().
Referenced by EvolutionContactSource::open(), EvolutionCalendarSource::open(), and throwError().
AbstractSyncSourceConfig * EvolutionSyncClient::getAbstractSyncSourceConfig | ( | unsigned int | i | ) | const [virtual] |
AbstractSyncSourceConfig * EvolutionSyncClient::getAbstractSyncSourceConfig | ( | const char * | name | ) | const [virtual] |
unsigned int EvolutionSyncClient::getAbstractSyncSourceConfigsCount | ( | ) | const [virtual] |
bool EvolutionSyncClient::getQuiet | ( | ) | [inline] |
Definition at line 79 of file EvolutionSyncClient.h.
SyncMode EvolutionSyncClient::getSyncMode | ( | ) | [inline] |
Definition at line 81 of file EvolutionSyncClient.h.
void EvolutionSyncClient::prepare | ( | SyncSource ** | sources | ) | [protected, virtual] |
Callback for derived classes: called after setting up the client's and sources' configuration. Can be used to reconfigure before actually starting the synchronization.
sources | a NULL terminated array of all active sources |
Definition at line 868 of file EvolutionSyncClient.cpp.
Referenced by sync(), and TestEvolution::sync().
void EvolutionSyncClient::setConfigFilter | ( | bool | sync, | |
const FilterConfigNode::ConfigFilter & | filter | |||
) | [virtual] |
intercept config filters
This call removes the "sync" source property and remembers it separately because it has to be applied to only the active sync sources; the generic config handling code would apply it to all sources.
Reimplemented from EvolutionSyncConfig.
Definition at line 700 of file EvolutionSyncClient.cpp.
References EvolutionSyncSourceConfig::m_sourcePropSync.
Referenced by SyncEvolutionCmdline::run().
void EvolutionSyncClient::setQuiet | ( | bool | quiet | ) | [inline] |
void EvolutionSyncClient::setSyncMode | ( | SyncMode | syncMode | ) | [inline] |
Definition at line 82 of file EvolutionSyncClient.h.
void EvolutionSyncClient::startLoopThread | ( | ) | [static] |
When using Evolution this function starts a background thread which drives the default event loop. Without that loop "backend-died" signals are not delivered. The problem with the thread is that it seems to interfere with gconf startup when added to the main() function of syncevolution. Therefore it is started by EvolutionSyncSource::beginSync() (for unit testing of sync sources) and EvolutionSyncClient::sync() (for normal operation).
Definition at line 672 of file EvolutionSyncClient.cpp.
Referenced by EvolutionSyncSource::beginSync(), and sync().
void EvolutionSyncClient::status | ( | ) |
Determines the log directory of the previous sync (either in temp or logdir) and shows changes since then.
Definition at line 878 of file EvolutionSyncClient.cpp.
References EvolutionSyncSourceConfig::checkPassword(), SourceList::dumpDatabases(), SourceList::dumpLocalChanges(), EvolutionSyncConfig::exists(), EvolutionSyncConfig::getLogDir(), SourceList::getPrevLogdir(), EvolutionSyncSource::open(), SourceList::setLogdir(), SourceList::setPath(), and throwError().
Referenced by SyncEvolutionCmdline::run().
int EvolutionSyncClient::sync | ( | ) |
Executes the sync, throws an exception in case of failure. Handles automatic backups and report generation.
Definition at line 769 of file EvolutionSyncClient.cpp.
References EvolutionSyncSourceConfig::checkPassword(), EvolutionSyncConfig::checkPassword(), EvolutionSyncConfig::checkProxyPassword(), EvolutionSyncConfig::copy(), EDSAbiWrapperDebug(), EvolutionSyncConfig::exists(), EvolutionSyncConfig::flush(), EvolutionSyncConfig::getDevID(), EvolutionSyncConfig::getDevType(), EvolutionSyncConfig::getLogDir(), EvolutionSyncConfig::getLogLevel(), EvolutionSyncConfig::getMaxLogDirs(), SourceList::getSourceArray(), SourceList::getSources(), EvolutionSyncConfig::getSwv(), EvolutionSyncConfig::getUseProxy(), EvolutionSyncConfig::getUsername(), EvolutionSyncSource::open(), prepare(), SourceList::setLogdir(), startLoopThread(), SourceList::syncDone(), SourceList::syncPrepare(), and throwError().
Referenced by SyncEvolutionCmdline::run().
void EvolutionSyncClient::throwError | ( | const string & | action, | |
int | error | |||
) | [static] |
throw an exception after an operation failed and remember that this instance has failed
output format: <action>: <error string>="">
action a string describing the operation or object involved
error | the errno error code for the failure |
Definition at line 623 of file EvolutionSyncClient.cpp.
References throwError().
void EvolutionSyncClient::throwError | ( | const string & | error | ) | [static] |
throws a runtime_error with the given string or (on the iPhone, where exception handling is not supported by the toolchain) prints an error directly and aborts
output format: <error>
error | a string describing the error |
Definition at line 608 of file EvolutionSyncClient.cpp.
References fatalError().
Referenced by askPassword(), PasswordConfigProperty::checkPassword(), SafeConfigNode::flush(), PrefixConfigNode::flush(), FilterConfigNode::flush(), FileConfigNode::flush(), isDir(), mkdir_p(), ReadDir::ReadDir(), FilterConfigNode::removeProperty(), rm_r(), SyncEvolutionCmdline::run(), LogDir::setLogdir(), FilterConfigNode::setProperty(), status(), sync(), throwError(), ConfigProperty::throwValueError(), and vCard2ABPerson::toPerson().