From: <svn...@op...> - 2010-10-02 11:06:22
|
Author: deloptes Date: Sat Oct 2 13:06:12 2010 New Revision: 6139 URL: http://www.opensync.org/changeset/6139 Log: - cleaned up a lot of testing code and manged to get sync changes exchanged TODO: akonadi is not accepting the changes - why? fix the update of changes Modified: plugins/akonadi-sync/trunk/src/akonadi_opensync.cpp plugins/akonadi-sync/trunk/src/akonadisink.cpp plugins/akonadi-sync/trunk/src/datasink.cpp plugins/akonadi-sync/trunk/src/sinkbase.cpp plugins/akonadi-sync/trunk/src/sinkbase.h Modified: plugins/akonadi-sync/trunk/src/akonadi_opensync.cpp ============================================================================== --- plugins/akonadi-sync/trunk/src/akonadi_opensync.cpp Fri Oct 1 00:40:36 2010 (r6138) +++ plugins/akonadi-sync/trunk/src/akonadi_opensync.cpp Sat Oct 2 13:06:12 2010 (r6139) @@ -106,7 +106,8 @@ return mainSink; } - //FIXME: this is not working in opoensync + //FIXME: this probably a bug in opoensync + // replace & static QString toXml(QString str) { str.replace("<","<").replace(">",">").replace("&","and"); return str; @@ -134,11 +135,12 @@ // OSyncFormatEnv *formatEnv = osync_plugin_info_get_format_env(info); OSyncObjTypeSink *sinkEvent = osync_objtype_sink_new(mType, error); + OSyncPluginResource *res = NULL; foreach ( const Akonadi::Collection &col, colsCal ) { kDebug() << "processing resource " << col.name() << col.contentMimeTypes(); kDebug() << " " << col.name() << col.url().url(); - OSyncPluginResource *res = osync_plugin_config_find_active_resource(config ,mType); + res = osync_plugin_config_find_active_resource(config ,mType); if ( res ) osync_plugin_resource_enable(res,FALSE); //TODO add some logic here (compare names etc) @@ -165,6 +167,7 @@ osync_objtype_sink_set_available( sinkEvent, TRUE ); // osync_objtype_sink_add_objformat_sink( sinkEvent, "vevent20" ); osync_plugin_info_add_objtype( info, sinkEvent ); + return TRUE; } @@ -193,19 +196,24 @@ */ if ( ! testSupport(info, config, "event", "application/x-vnd.akonadi.calendar.event", "vevent20" ,error) ) - return false; + kDebug() << "NO support for vevent20"; +// return false; if ( ! testSupport(info, config, "todo", "application/x-vnd.akonadi.calendar.todo", "vtodo10" ,error) ) - return false; + kDebug() << "NO support for vtodo10"; +// return false; if ( ! testSupport(info, config, "journal", "application/x-vnd.akonadi.calendar.journal", "vjournal" ,error) ) - return false; + kDebug() << "NO support for vjournal"; +// return false; // fetch all address books if ( ! testSupport(info, config, "contact", KABC::Addressee::mimeType().toLatin1(), "vcard30" ,error) ) - return false; + kDebug() << "NO support for vcard30"; +// return false; // fetch all notes if ( ! testSupport(info, config, "note", "application/x-vnd.kde.notes", "vnote11" ,error) ) - return false; + kDebug() << "NO support for vnote11"; +// return false; // set information about the peer (KDE itself) { OSyncVersion *version = osync_version_new(error); @@ -248,6 +256,7 @@ osync_plugin_set_description(plugin, "Plugin to synchronize with Akonadi"); osync_plugin_set_config_type(plugin, OSYNC_PLUGIN_OPTIONAL_CONFIGURATION); osync_plugin_set_initialize(plugin, akonadi_initialize); + osync_plugin_set_finalize_timeout(plugin, 5); osync_plugin_set_finalize(plugin, akonadi_finalize); osync_plugin_set_discover(plugin, akonadi_discover); osync_plugin_set_start_type(plugin, OSYNC_START_TYPE_PROCESS); Modified: plugins/akonadi-sync/trunk/src/akonadisink.cpp ============================================================================== --- plugins/akonadi-sync/trunk/src/akonadisink.cpp Fri Oct 1 00:40:36 2010 (r6138) +++ plugins/akonadi-sync/trunk/src/akonadisink.cpp Sat Oct 2 13:06:12 2010 (r6139) @@ -29,7 +29,7 @@ #include <opensync/opensync-format.h> AkonadiSink::AkonadiSink() : - SinkBase( Connect ) + SinkBase( Connect ) { } @@ -40,35 +40,36 @@ bool AkonadiSink::initialize(OSyncPlugin * plugin, OSyncPluginInfo * info, OSyncError ** error) { Q_UNUSED( plugin ); - kDebug(); - - if ( !Akonadi::Control::start() ) - return false; - - OSyncObjTypeSink *sink = osync_objtype_main_sink_new( error ); - if (!sink) { - - kDebug() << "No sink "; - return false; - } - osync_plugin_info_set_main_sink( info, sink ); - wrapSink( sink ); + kDebug(); - return true; + if ( !Akonadi::Control::start() ) + return false; + + OSyncObjTypeSink *sink = osync_objtype_main_sink_new( error ); + if (!sink) { + + kDebug() << "No sink "; + return false; + } + osync_plugin_info_set_main_sink( info, sink ); + osync_objtype_sink_set_userdata(sink, this); + wrapSink( sink ); + + return true; } void AkonadiSink::connect() { - osync_trace(TRACE_ENTRY, "%s(%p, %p)", __PRETTY_FUNCTION__, pluginInfo(), context()); - kDebug(); + osync_trace(TRACE_ENTRY, "%s(%p, %p)", __PRETTY_FUNCTION__, pluginInfo(), context()); + kDebug(); - if ( !Akonadi::Control::start() ) { - error( OSYNC_ERROR_NO_CONNECTION, "Could not start Akonadi." ); - osync_trace(TRACE_EXIT_ERROR, "%s: %s", __PRETTY_FUNCTION__, "Could not start Akonadi."); - return; - } - success(); - osync_trace(TRACE_EXIT, "%s", __PRETTY_FUNCTION__); + if ( !Akonadi::Control::start() ) { + error( OSYNC_ERROR_NO_CONNECTION, "Could not start Akonadi." ); + osync_trace(TRACE_EXIT_ERROR, "%s: %s", __PRETTY_FUNCTION__, "Could not start Akonadi."); + return; + } +// success(); + osync_trace(TRACE_EXIT, "%s", __PRETTY_FUNCTION__); } Modified: plugins/akonadi-sync/trunk/src/datasink.cpp ============================================================================== --- plugins/akonadi-sync/trunk/src/datasink.cpp Fri Oct 1 00:40:36 2010 (r6138) +++ plugins/akonadi-sync/trunk/src/datasink.cpp Sat Oct 2 13:06:12 2010 (r6139) @@ -59,10 +59,11 @@ kDebug() << "Create obj:" << type; m_type = type; -// m_isEvent = ( type == DataSink::Calendars ) ? true : false; -// m_isContact = ( type == DataSink::Contacts ) ? true : false; -// m_isNote = ( type == DataSink::Notes ) ? true : false; -// m_isTodo = ( type == DataSink::Todos ) ? true : false; + m_isEvent = ( type == DataSink::Calendars ) ? true : false; + m_isContact = ( type == DataSink::Contacts ) ? true : false; + m_isNote = ( type == DataSink::Notes ) ? true : false; + m_isTodo = ( type == DataSink::Todos ) ? true : false; + m_isJournal = ( type == DataSink::Journals ) ? true : false; } @@ -84,11 +85,7 @@ return false; } - bool enabled = osync_objtype_sink_is_enabled( sink ); - if ( ! enabled ) { - kDebug() << "sink is not enabled.."; - return false; - } + // kDebug() << "Sink wrapped: " << osync_objtype_sink_get_name(sink); @@ -102,8 +99,20 @@ // return false; // } - wrapSink( sink ); + osync_bool enabled = osync_objtype_sink_is_enabled( sink ); + if ( ! enabled ) { + kDebug() << "sink is not enabled.."; +// osync_objtype_sink_remove_objformat_sink( sink ); + return false; + } + osync_objtype_sink_set_userdata(sink, this); + osync_objtype_sink_enable_hashtable(sink , TRUE); + OSyncHashTable *hashtable = osync_objtype_sink_get_hashtable(sink); + + if ( ! hashtable ) + kDebug() << ">> NO hashtable for objtype:" << osync_objtype_sink_get_name(sink); + OSyncPluginResource *resource = osync_plugin_config_find_active_resource(config, osync_objtype_sink_get_name(sink)); OSyncList *objfrmtList = osync_plugin_resource_get_objformat_sinks(resource); @@ -112,24 +121,86 @@ for(r = objfrmtList;r;r = r->next) { OSyncObjFormatSink *objformatsink = (OSyncObjFormatSink *) r->data; + switch (m_type) { + case Contacts: { + if(!strcmp("vcard21", osync_objformat_sink_get_objformat(objformatsink))) { + hasObjFormat = true; + kDebug() << "Has objformat vcard21"; + break; + } else + kDebug() << "No objformat vcard21"; + if(!strcmp("vcard30", osync_objformat_sink_get_objformat(objformatsink))) { hasObjFormat = true; kDebug() << "Has objformat vcard30"; break; - } - } - - if (!hasObjFormat) { + } else kDebug() << "No objformat vcard30"; - return false; + + break; + } + case Calendars: { + if(!strcmp("vevent10", osync_objformat_sink_get_objformat(objformatsink))) { + hasObjFormat = true; + kDebug() << "Has objformat vevent10"; + break; + } else + kDebug() << "No objformat vevent10"; + break; + if(!strcmp("vevent20", osync_objformat_sink_get_objformat(objformatsink))) { + hasObjFormat = true; + kDebug() << "Has objformat vevent20"; + break; + } else + kDebug() << "No objformat vevent20"; + break; + } + case Notes: { + if(!strcmp("vnote11", osync_objformat_sink_get_objformat(objformatsink))) { + hasObjFormat = true; + kDebug() << "Has objformat vnote11"; + break; + } else + kDebug() << "No objformat vnote11"; + break; + } + case Journals: { + if(!strcmp("vjournal", osync_objformat_sink_get_objformat(objformatsink))) { + hasObjFormat = true; + kDebug() << "Has objformat vjournal"; + break; + } else + kDebug() << "No objformat vjournal"; + break; + } + case Todos: { + if(!strcmp("vtodo10", osync_objformat_sink_get_objformat(objformatsink))) { + hasObjFormat = true; + kDebug() << "Has objformat vtodo10"; + break; + } else + kDebug() << "No objformat vtodo10"; + if(!strcmp("vtodo20", osync_objformat_sink_get_objformat(objformatsink))) { + hasObjFormat = true; + kDebug() << "Has objformat vtodo20"; + break; + } else + kDebug() << "No objformat vtodo20"; + break; + } + + default: + continue; + } } - - osync_objtype_sink_set_userdata(sink, this); - osync_objtype_sink_enable_hashtable(sink , TRUE); - OSyncHashTable *hashtable = osync_objtype_sink_get_hashtable(sink); - if ( ! hashtable ) - kDebug() << ">> NO hashtable for objtype:" << osync_objtype_sink_get_name(sink); +// if (!hasObjFormat) { +// kDebug() << "No objformat vcard30"; +// return false; +// } + + + wrapSink( sink ); return true; } @@ -174,17 +245,16 @@ // FIXME if ( getSlowSink() ) { kDebug() << "we're in the middle of slow-syncing..."; - osync_trace( TRACE_INTERNAL, "EKO Got slow-sync, resetting hashtable" ); + osync_trace( TRACE_INTERNAL, "resetting hashtable" ); if ( ! osync_hashtable_slowsync( hashtable, &oerror ) ) { warning( oerror ); osync_trace( TRACE_EXIT_ERROR, "%s: %s", __PRETTY_FUNCTION__, osync_error_print( &oerror ) ); - kDebug() << "Will abort >>> whatever - because of slowsync"; return; } } ItemFetchJob *job = new ItemFetchJob( col ); - job->fetchScope().fetchFullPayload(); + job->fetchScope().fetchFullPayload(true); kDebug() << "Fetched FullPayload" ; QObject::connect( job, SIGNAL( itemsReceived( const Akonadi::Item::List & ) ), this, SLOT( slotItemsReceived( const Akonadi::Item::List & ) ) ); @@ -202,13 +272,20 @@ { kDebug() << "retrieved" << items.count() << "items"; Q_FOREACH( const Item& item, items ) { - kDebug() << item.payloadData(); + kDebug() << "Id:" << item.id() << "\n"; + kDebug() << "Mime:" << item.mimeType() << "\n"; + kDebug() << "availablePayloadParts:" << item.availablePayloadParts() << "\n"; + kDebug() << "storageCollectionId:" << item.storageCollectionId() << "\n"; + kDebug() << "url:" << item.url() << "\n"; reportChange( item ); } } void DataSink::reportChange( const Item& item ) { + + kDebug() << item.id() << "\n" ; + kDebug() << "item.payloadData().data():" << item.payloadData().data() << "\n" ; OSyncFormatEnv *formatenv = osync_plugin_info_get_format_env( pluginInfo() ); OSyncObjFormat *format = osync_format_env_find_objformat( formatenv, formatName().toLatin1() ); @@ -224,7 +301,7 @@ osync_change_set_uid( change, QString::number( item.id() ).toLatin1() ); error = 0; - + OSyncData *odata = osync_data_new( item.payloadData().data(), item.payloadData().size(), format, &error ); if ( !odata ) { osync_change_unref( change ); @@ -235,7 +312,7 @@ osync_change_set_data( change, odata ); - kDebug() << item.id() << "\n" << "DATA:" << osync_data_get_printable( odata , &error) << "\n" << "ORIG:" << item.payloadData().data(); +// kDebug() << item.id() << "\n" << "DATA:" << osync_data_get_printable( odata , &error) << "\n" ; osync_data_unref( odata ); osync_change_set_hash( change, QString::number( item.revision() ).toLatin1() ); @@ -244,13 +321,13 @@ /* */ - kDebug() << "changeid:" << osync_change_get_uid( change ) - << "itemid:" << item.id() - << "revision:" << item.revision() - << "changetype:" << changeType - << "hash:" << osync_hashtable_get_hash( hashtable, osync_change_get_uid( change ) ) - << "objtype:" << osync_change_get_objtype( change ) - << "objform:" << osync_objformat_get_name( osync_change_get_objformat( change ) ) + kDebug() << "changeid:" << osync_change_get_uid( change ) << "; " + << "itemid:" << item.id()<< "; " + << "revision:" << item.revision()<< "; " + << "changetype:" << changeType << "; " + << "hash:" << osync_hashtable_get_hash( hashtable, osync_change_get_uid( change ) ) << "; " + << "objtype:" << osync_change_get_objtype( change ) << "; " + << "objform:" << osync_objformat_get_name( osync_change_get_objformat( change ) ) << "; " << "sinkname:" << osync_objtype_sink_get_name( sink() ); /* */ @@ -303,7 +380,7 @@ osync_list_free( uids ); kDebug() << "got all changes.."; - success(); + } void DataSink::commit(OSyncChange *change) @@ -406,20 +483,12 @@ } else kDebug() << "unable to delete item";*/ + success(); // TODO } bool DataSink::setPayload( Item *item, const QString &str ) { switch ( m_type ) { - case Calendars: { - KCal::ICalFormat format; - KCal::Incidence *calEntry = format.fromString( str ); - - item->setMimeType( "application/x-vnd.akonadi.calendar.event" ); - item->setPayload<IncidencePtr>( IncidencePtr( calEntry->clone() ) ); - - break; - } case Contacts: { KABC::VCardConverter converter; KABC::Addressee vcard = converter.parseVCard( str.toLatin1() ); @@ -430,9 +499,18 @@ //item->setPayload<KABC::Addressee>( vcard.toString() ); // FIXME break; } - case Todos: { + case Calendars: { KCal::ICalFormat format; - KCal::Incidence *todoEntry = format.fromString( str ); + KCal::Incidence *calEntry = format.fromString( str ); + + item->setMimeType( "application/x-vnd.akonadi.calendar.event" ); + item->setPayload<IncidencePtr>( IncidencePtr( calEntry->clone() ) ); + + break; + } + case Todos: { + KCal::ICalFormat format; + KCal::Incidence *todoEntry = format.fromString(str); //format.fromString( str ); item->setMimeType( "application/x-vnd.akonadi.calendar.todo" ); item->setPayload<IncidencePtr>( IncidencePtr( todoEntry->clone() ) ); @@ -442,7 +520,7 @@ case Notes: { kDebug() << "notes"; KCal::ICalFormat format; - KCal::Incidence *noteEntry = format.fromString( str ); + KCal::Incidence *noteEntry = format.fromString(str); item->setMimeType( "application/x-vnd.kde.notes" ); item->setPayload<IncidencePtr>( IncidencePtr( noteEntry->clone() ) ); @@ -452,7 +530,7 @@ case Journals: { kDebug() << "journals"; KCal::ICalFormat format; - KCal::Incidence *journalEntry = format.fromString( str ); + KCal::Incidence *journalEntry = format.fromString(str); item->setMimeType( "application/x-vnd.akonadi.calendar.journal" ); item->setPayload<IncidencePtr>( IncidencePtr( journalEntry->clone() ) ); @@ -486,7 +564,7 @@ formatName = "vevent20"; break; case Contacts: - formatName = "vcard10"; + formatName = "vcard30"; break; case Notes: formatName = "vjournal"; @@ -524,10 +602,6 @@ { kDebug() << "sync for sink member done"; OSyncError *error = 0; -// OSyncHashTable *hashtable = osync_objtype_sink_get_hashtable(sink()); -// osync_objtype_sink_save_hashtable( sink, &error ); -// OSyncError *error = 0; -// OSyncObjTypeSink *sink =sink(); osync_objtype_sink_save_hashtable( sink() , &error ); //TODO check for errors success(); Modified: plugins/akonadi-sync/trunk/src/sinkbase.cpp ============================================================================== --- plugins/akonadi-sync/trunk/src/sinkbase.cpp Fri Oct 1 00:40:36 2010 (r6138) +++ plugins/akonadi-sync/trunk/src/sinkbase.cpp Sat Oct 2 13:06:12 2010 (r6139) @@ -23,44 +23,75 @@ #include "sinkbase.h" #include <KDebug> -#define WRAP(X) \ +#define WRAP() \ osync_trace( TRACE_ENTRY, "%s(%p,%p, %p, %p)", __PRETTY_FUNCTION__, sink, info, ctx, userdata); \ SinkBase *sb = reinterpret_cast<SinkBase*>(userdata ); \ sb->setContext( ctx ); \ - sb->setPluginInfo( info ); \ - sb->X; \ - osync_trace( TRACE_EXIT, "%s", __PRETTY_FUNCTION__ ); + sb->setPluginInfo( info ); extern "C" { static void connect_wrapper(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *userdata ) { - WRAP( connect() ) + WRAP( ) + sb->connect(); osync_context_report_success(ctx); + osync_trace( TRACE_EXIT, "%s", __PRETTY_FUNCTION__ ); } static void disconnect_wrapper(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *userdata) { - WRAP( disconnect() ) + WRAP( ) + sb->disconnect(); // osync_context_report_success(ctx); + osync_trace( TRACE_EXIT, "%s", __PRETTY_FUNCTION__ ); } static void get_changes_wrapper(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, osync_bool slow_sync, void *userdata) { - WRAP ( getChanges() ) + WRAP ( ) if ( slow_sync ) sb->setSlowSink(slow_sync); + sb->getChanges(); // osync_context_report_success(ctx); + osync_trace( TRACE_EXIT, "%s", __PRETTY_FUNCTION__ ); } static void sync_done_wrapper(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *userdata) { - WRAP( syncDone() ) + WRAP( ) + sb->syncDone(); +// osync_context_report_success(ctx); + osync_trace( TRACE_EXIT, "%s", __PRETTY_FUNCTION__ ); } static void commit_wrapper(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *change, void *userdata) { - WRAP( commit(change) ) + WRAP( ) + sb->commit(change); +// osync_context_report_success(ctx); + osync_trace( TRACE_EXIT, "%s", __PRETTY_FUNCTION__ ); + } + + static void read_wrapper(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *change, void *userdata) { + WRAP( ) + sb->commit(change); +// osync_context_report_success(ctx); + osync_trace( TRACE_EXIT, "%s", __PRETTY_FUNCTION__ ); + } + + static void commitAll_wrapper(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *userdata) { + WRAP( ) + sb->commitAll(); +// osync_context_report_success(ctx); + osync_trace( TRACE_EXIT, "%s", __PRETTY_FUNCTION__ ); } +// static void commit_all_wrapper(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *change, void *userdata) { +// WRAP( ) +// sb->commitAll(change); +// // osync_context_report_success(ctx); +// osync_trace( TRACE_EXIT, "%s", __PRETTY_FUNCTION__ ); +// } + } // extern C @@ -68,7 +99,16 @@ mContext( 0 ), mSink( 0 ), mPluginInfo( 0 ), - m_SlowSync( false ) + m_canConnect(false), + m_canDisconnect(false), + m_canCommit (false), + m_canCommitAll (false), +// m_canBatchCommit(false), + m_canGetChanges(false), + m_canWrite (false), + m_canRead (false), + m_canSyncDone (false), + m_SlowSync (false) { m_canConnect = ( features & Connect ) ? true : false; @@ -78,15 +118,19 @@ m_canWrite = ( features & Write ) ? true : false; m_canCommitAll = ( features & CommittedAll ) ? true : false; m_canRead = ( features & Read ) ? true : false; - m_canBatchCommit = ( features & BatchCommit ) ? true : false; +// m_canBatchCommit = ( features & BatchCommit ) ? true : false; m_canSyncDone = ( features & SyncDone ) ? true : false; } SinkBase::~SinkBase() { + if ( mContext) + osync_context_unref(mContext); if ( mSink ) osync_objtype_sink_unref( mSink ); + if (mPluginInfo) + osync_plugin_info_unref(mPluginInfo); } void SinkBase::connect() @@ -122,6 +166,22 @@ Q_ASSERT( false ); } +void SinkBase::commitAll() +{ + Q_ASSERT( false ); +} + +void SinkBase::write() +{ + Q_ASSERT( false ); +} + +void SinkBase::read() +{ + Q_ASSERT( false ); +} + + void SinkBase::syncDone() { Q_ASSERT( false ); @@ -132,7 +192,7 @@ kDebug(); Q_ASSERT( mContext ); osync_context_report_success( mContext ); - mContext = 0; +// mContext = 0; } void SinkBase::error(OSyncErrorType type, const QString &msg) const @@ -157,32 +217,50 @@ Q_ASSERT( sink ); Q_ASSERT( mSink == 0 ); mSink = sink; - kDebug() << ">> m_canConnect:" << m_canConnect; + kDebug() << ">> m_canDisconnect:" << m_canDisconnect; + kDebug() << ">> m_canCommit:" << m_canCommit; kDebug() << ">> m_canGetChanges:" << m_canGetChanges; + kDebug() << ">> m_canWrite:" << m_canConnect; + kDebug() << ">> m_canCommitAll:" << m_canGetChanges; + kDebug() << ">> m_canRead:" << m_canConnect; + kDebug() << ">> m_canSyncDone:" << m_canGetChanges; // kDebug() << ">> NO hashtable for objtype:" << m_canConnect; - if ( ! m_canConnect ) +// if ( m_canConnect && ( m_isEvent || m_isContact || m_isJournal || m_isNote || m_isTodo) ) { + if ( m_canConnect ) { osync_objtype_sink_set_connect_func(sink, connect_wrapper); - if ( ! m_canDisconnect ) + osync_objtype_sink_set_connect_timeout(sink, 5); + } + if ( m_canDisconnect ) { osync_objtype_sink_set_disconnect_func(sink, disconnect_wrapper); - if ( ! m_canGetChanges || m_isContact || m_isEvent ) + osync_objtype_sink_set_disconnect_timeout(sink, 5); + } + if ( m_canGetChanges ) { osync_objtype_sink_set_get_changes_func(sink, get_changes_wrapper); - - if ( ! m_canCommit || m_isContact || m_isEvent ) + osync_objtype_sink_set_getchanges_timeout(sink, 5); + } + if ( m_canCommit ) { osync_objtype_sink_set_commit_func(sink, commit_wrapper); + osync_objtype_sink_set_commit_timeout(sink, 5); + } // TODO: check if relevant for akonadi - if ( m_canWrite ) - osync_objtype_sink_set_commit_func(sink, 0); - if ( m_canCommitAll ) - osync_objtype_sink_set_commit_func(sink, 0); - if ( m_canRead ) - osync_objtype_sink_set_commit_func(sink, 0); - if ( m_canBatchCommit ) - osync_objtype_sink_set_commit_func(sink, 0); - if ( ! m_canSyncDone || m_isContact || m_isEvent) +// if ( m_canWrite ) +// osync_objtype_sink_set_write(sink, TRUE); +// if ( m_canCommitAll || m_isContact || m_isEvent || m_isNote || m_isJournal || m_isTodo) { +// if ( m_canCommitAll ) { +// osync_objtype_sink_set_committed_all_func(sink, commitAll_wrapper); +// osync_objtype_sink_set_committedall_timeout(sink, 5); +// } +// if ( m_canRead ) { +// osync_objtype_sink_set_read_func(sink, read_wrapper); +// osync_objtype_sink_set_read_timeout(sink, 5); +// } + if ( m_canSyncDone ) { osync_objtype_sink_set_sync_done_func(sink, sync_done_wrapper); + osync_objtype_sink_set_syncdone_timeout(sink, 5); + } } Modified: plugins/akonadi-sync/trunk/src/sinkbase.h ============================================================================== --- plugins/akonadi-sync/trunk/src/sinkbase.h Fri Oct 1 00:40:36 2010 (r6138) +++ plugins/akonadi-sync/trunk/src/sinkbase.h Sat Oct 2 13:06:12 2010 (r6139) @@ -56,6 +56,9 @@ virtual void disconnect(); virtual void getChanges(); virtual void commit( OSyncChange *chg ); + virtual void write(); + virtual void read(); + virtual void commitAll(); virtual void syncDone(); OSyncContext* context() const { return mContext; } @@ -72,7 +75,7 @@ void warning( OSyncError *error ) const; void wrapSink( OSyncObjTypeSink* sink ); OSyncObjTypeSink* sink() const { return mSink; } - bool m_isContact, m_isEvent, m_isTodo, m_isNote; //TODO intended to be private + bool m_isContact, m_isEvent, m_isTodo, m_isNote, m_isJournal; //TODO intended to be private private: // OSyncObjTypeSinkFunctions mWrapedFunctions; @@ -80,8 +83,8 @@ OSyncObjTypeSink *mSink; OSyncPluginInfo *mPluginInfo; // what do we have and what can we do - bool m_canConnect, m_canDisconnect, m_canSyncDone, m_canCommit, m_canGetChanges; - bool m_canWrite, m_canRead, m_canCommitAll, m_canCommitRead, m_canBatchCommit; + bool m_canConnect, m_canDisconnect, m_canCommit, m_canCommitAll, m_canGetChanges, m_canWrite, m_canRead, m_canSyncDone; +// bool m_canCommitRead, m_canBatchCommit; osync_bool m_SlowSync; }; |