summaryrefslogtreecommitdiffstats
path: root/kitchensync/libqopensync/syncchange.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-09-07 22:30:29 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-09-07 22:30:29 +0000
commitd8b40941f9d1a221add0b9094eb09405a91a8aab (patch)
tree0b8e9b6347f6e75925bb3c386a47c5300b1a4775 /kitchensync/libqopensync/syncchange.cpp
parent009631d0fc83f471d6c515e2a5001337a5a2ea21 (diff)
downloadtdepim-d8b40941f9d1a221add0b9094eb09405a91a8aab.tar.gz
tdepim-d8b40941f9d1a221add0b9094eb09405a91a8aab.zip
Part 2/2 of Chakra patch commit
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1172727 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kitchensync/libqopensync/syncchange.cpp')
-rw-r--r--kitchensync/libqopensync/syncchange.cpp51
1 files changed, 34 insertions, 17 deletions
diff --git a/kitchensync/libqopensync/syncchange.cpp b/kitchensync/libqopensync/syncchange.cpp
index 5dd72d7ff..d45be2e4a 100644
--- a/kitchensync/libqopensync/syncchange.cpp
+++ b/kitchensync/libqopensync/syncchange.cpp
@@ -19,8 +19,13 @@
Boston, MA 02110-1301, USA.
*/
+#include <stdlib.h>
+
#include <opensync/file.h>
+
#include <opensync/opensync.h>
+#include <opensync/opensync-data.h>
+#include <opensync/opensync-format.h>
#include "syncchange.h"
@@ -64,39 +69,50 @@ TQString SyncChange::hash() const
return TQString::fromUtf8( osync_change_get_hash( mSyncChange ) );
}
-void SyncChange::setData( const TQString &data )
+void SyncChange::setData( const TQString &data , OSyncObjFormat *format )
{
- osync_change_set_data( mSyncChange, const_cast<char*>( data.utf8().data() ), data.utf8().size(), true );
+ OSyncError *error = 0;
+
+ OSyncData *odata = osync_data_new( const_cast<char*>( data.utf8().data() ), data.utf8().size(), format, &error );
+ osync_change_set_data( mSyncChange, odata );
}
TQString SyncChange::data() const
{
- int size = osync_change_get_datasize( mSyncChange );
+ char *buf;
+ unsigned int size;
+
+ OSyncData *data = osync_change_get_data( mSyncChange );
+
+ osync_data_get_data( data, &buf, &size );
TQString content;
if ( objectFormatName() == "file" ) {
- fileFormat *format = (fileFormat*)osync_change_get_data( mSyncChange );
+ OSyncFileFormat *format = (OSyncFileFormat*) buf;
if ( format )
content = TQString::fromUtf8( format->data, format->size );
} else
- content = TQString::fromUtf8( osync_change_get_data( mSyncChange ), size );
+ content = TQString::fromUtf8( buf, size );
+
+ free( buf );
return content;
}
bool SyncChange::hasData() const
{
- return osync_change_has_data( mSyncChange );
+ return osync_data_has_data( osync_change_get_data( mSyncChange ) );
}
TQString SyncChange::objectFormatName() const
{
- OSyncObjFormat *format = osync_change_get_objformat( mSyncChange );
+ OSyncObjFormat *format = osync_data_get_objformat( osync_change_get_data( mSyncChange ) );
Q_ASSERT( format );
return TQString::fromUtf8( osync_objformat_get_name( format ) );
}
+/*
Member SyncChange::member() const
{
OSyncMember *omember = osync_change_get_member( mSyncChange );
@@ -106,6 +122,7 @@ Member SyncChange::member() const
return m;
}
+*/
void SyncChange::setChangeType( Type changeType )
{
@@ -113,20 +130,20 @@ void SyncChange::setChangeType( Type changeType )
switch ( changeType ) {
case AddedChange:
- ochangeType = CHANGE_ADDED;
+ ochangeType = OSYNC_CHANGE_TYPE_ADDED;
break;
case UnmodifiedChange:
- ochangeType = CHANGE_UNMODIFIED;
+ ochangeType = OSYNC_CHANGE_TYPE_UNMODIFIED;
break;
case DeletedChange:
- ochangeType = CHANGE_DELETED;
+ ochangeType = OSYNC_CHANGE_TYPE_DELETED;
break;
case ModifiedChange:
- ochangeType = CHANGE_MODIFIED;
+ ochangeType = OSYNC_CHANGE_TYPE_MODIFIED;
break;
case UnknownChange:
default:
- ochangeType = CHANGE_UNKNOWN;
+ ochangeType = OSYNC_CHANGE_TYPE_UNKNOWN;
break;
}
@@ -138,19 +155,19 @@ SyncChange::Type SyncChange::changeType() const
OSyncChangeType ochangeType = osync_change_get_changetype( mSyncChange );
switch ( ochangeType ) {
- case CHANGE_ADDED:
+ case OSYNC_CHANGE_TYPE_ADDED:
return AddedChange;
break;
- case CHANGE_UNMODIFIED:
+ case OSYNC_CHANGE_TYPE_UNMODIFIED:
return UnmodifiedChange;
break;
- case CHANGE_DELETED:
+ case OSYNC_CHANGE_TYPE_DELETED:
return DeletedChange;
break;
- case CHANGE_MODIFIED:
+ case OSYNC_CHANGE_TYPE_MODIFIED:
return ModifiedChange;
break;
- case CHANGE_UNKNOWN:
+ case OSYNC_CHANGE_TYPE_UNKNOWN:
default:
return UnknownChange;
break;