summaryrefslogtreecommitdiffstats
path: root/kitchensync/libqopensync/syncchange.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kitchensync/libqopensync/syncchange.cpp')
-rw-r--r--kitchensync/libqopensync/syncchange.cpp51
1 files changed, 17 insertions, 34 deletions
diff --git a/kitchensync/libqopensync/syncchange.cpp b/kitchensync/libqopensync/syncchange.cpp
index d45be2e4a..5dd72d7ff 100644
--- a/kitchensync/libqopensync/syncchange.cpp
+++ b/kitchensync/libqopensync/syncchange.cpp
@@ -19,13 +19,8 @@
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"
@@ -69,50 +64,39 @@ TQString SyncChange::hash() const
return TQString::fromUtf8( osync_change_get_hash( mSyncChange ) );
}
-void SyncChange::setData( const TQString &data , OSyncObjFormat *format )
+void SyncChange::setData( const TQString &data )
{
- 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 );
+ osync_change_set_data( mSyncChange, const_cast<char*>( data.utf8().data() ), data.utf8().size(), true );
}
TQString SyncChange::data() const
{
- char *buf;
- unsigned int size;
-
- OSyncData *data = osync_change_get_data( mSyncChange );
-
- osync_data_get_data( data, &buf, &size );
+ int size = osync_change_get_datasize( mSyncChange );
TQString content;
if ( objectFormatName() == "file" ) {
- OSyncFileFormat *format = (OSyncFileFormat*) buf;
+ fileFormat *format = (fileFormat*)osync_change_get_data( mSyncChange );
if ( format )
content = TQString::fromUtf8( format->data, format->size );
} else
- content = TQString::fromUtf8( buf, size );
-
- free( buf );
+ content = TQString::fromUtf8( osync_change_get_data( mSyncChange ), size );
return content;
}
bool SyncChange::hasData() const
{
- return osync_data_has_data( osync_change_get_data( mSyncChange ) );
+ return osync_change_has_data( mSyncChange );
}
TQString SyncChange::objectFormatName() const
{
- OSyncObjFormat *format = osync_data_get_objformat( osync_change_get_data( mSyncChange ) );
+ OSyncObjFormat *format = osync_change_get_objformat( mSyncChange );
Q_ASSERT( format );
return TQString::fromUtf8( osync_objformat_get_name( format ) );
}
-/*
Member SyncChange::member() const
{
OSyncMember *omember = osync_change_get_member( mSyncChange );
@@ -122,7 +106,6 @@ Member SyncChange::member() const
return m;
}
-*/
void SyncChange::setChangeType( Type changeType )
{
@@ -130,20 +113,20 @@ void SyncChange::setChangeType( Type changeType )
switch ( changeType ) {
case AddedChange:
- ochangeType = OSYNC_CHANGE_TYPE_ADDED;
+ ochangeType = CHANGE_ADDED;
break;
case UnmodifiedChange:
- ochangeType = OSYNC_CHANGE_TYPE_UNMODIFIED;
+ ochangeType = CHANGE_UNMODIFIED;
break;
case DeletedChange:
- ochangeType = OSYNC_CHANGE_TYPE_DELETED;
+ ochangeType = CHANGE_DELETED;
break;
case ModifiedChange:
- ochangeType = OSYNC_CHANGE_TYPE_MODIFIED;
+ ochangeType = CHANGE_MODIFIED;
break;
case UnknownChange:
default:
- ochangeType = OSYNC_CHANGE_TYPE_UNKNOWN;
+ ochangeType = CHANGE_UNKNOWN;
break;
}
@@ -155,19 +138,19 @@ SyncChange::Type SyncChange::changeType() const
OSyncChangeType ochangeType = osync_change_get_changetype( mSyncChange );
switch ( ochangeType ) {
- case OSYNC_CHANGE_TYPE_ADDED:
+ case CHANGE_ADDED:
return AddedChange;
break;
- case OSYNC_CHANGE_TYPE_UNMODIFIED:
+ case CHANGE_UNMODIFIED:
return UnmodifiedChange;
break;
- case OSYNC_CHANGE_TYPE_DELETED:
+ case CHANGE_DELETED:
return DeletedChange;
break;
- case OSYNC_CHANGE_TYPE_MODIFIED:
+ case CHANGE_MODIFIED:
return ModifiedChange;
break;
- case OSYNC_CHANGE_TYPE_UNKNOWN:
+ case CHANGE_UNKNOWN:
default:
return UnknownChange;
break;