diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 460c52653ab0dcca6f19a4f492ed2c5e4e963ab0 (patch) | |
tree | 67208f7c145782a7e90b123b982ca78d88cc2c87 /kitchensync/libqopensync/syncupdates.cpp | |
download | tdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.tar.gz tdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kitchensync/libqopensync/syncupdates.cpp')
-rw-r--r-- | kitchensync/libqopensync/syncupdates.cpp | 251 |
1 files changed, 251 insertions, 0 deletions
diff --git a/kitchensync/libqopensync/syncupdates.cpp b/kitchensync/libqopensync/syncupdates.cpp new file mode 100644 index 000000000..653ccf7f3 --- /dev/null +++ b/kitchensync/libqopensync/syncupdates.cpp @@ -0,0 +1,251 @@ +/* + This file is part of libqopensync. + + Copyright (c) 2005 Tobias Koenig <tokoe@kde.org> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include <osengine/engine.h> + +#include "syncupdates.h" + +using namespace QSync; + +SyncMemberUpdate::SyncMemberUpdate() +{ +} + +SyncMemberUpdate::SyncMemberUpdate( OSyncMemberUpdate *update ) +{ + switch ( update->type ) { + case MEMBER_CONNECTED: + mType = Connected; + break; + case MEMBER_SENT_CHANGES: + mType = SentChanges; + break; + case MEMBER_COMMITTED_ALL: + mType = CommittedAll; + break; + case MEMBER_DISCONNECTED: + mType = Disconnected; + break; + case MEMBER_CONNECT_ERROR: + mType = ConnectError; + break; + case MEMBER_GET_CHANGES_ERROR: + mType = GetChangesError; + break; + case MEMBER_COMMITTED_ALL_ERROR: + mType = CommittedAllError; + break; + case MEMBER_SYNC_DONE_ERROR: + mType = SyncDoneError; + break; + case MEMBER_DISCONNECT_ERROR: + mType = DisconnectedError; + break; + } + + if ( update->error ) + mResult = Result( &(update->error) ); + + mMember.mMember = update->member; +} + +SyncMemberUpdate::~SyncMemberUpdate() +{ +} + +SyncMemberUpdate::Type SyncMemberUpdate::type() const +{ + return mType; +} + +Result SyncMemberUpdate::result() const +{ + return mResult; +} + +Member SyncMemberUpdate::member() const +{ + return mMember; +} + + +SyncChangeUpdate::SyncChangeUpdate() +{ +} + +SyncChangeUpdate::SyncChangeUpdate( OSyncChangeUpdate *update ) +{ + switch ( update->type ) { + case CHANGE_RECEIVED: + mType = Received; + break; + case CHANGE_RECEIVED_INFO: + mType = ReceivedInfo; + break; + case CHANGE_SENT: + mType = Sent; + break; + case CHANGE_WRITE_ERROR: + mType = WriteError; + break; + case CHANGE_RECV_ERROR: + mType = ReceiveError; + break; + } + + if ( update->error ) + mResult = Result( &(update->error) ); + + mChange = SyncChange( update->change ); + mMemberId = update->member_id; + mMappingId = update->mapping_id; +} + +SyncChangeUpdate::~SyncChangeUpdate() +{ +} + +SyncChangeUpdate::Type SyncChangeUpdate::type() const +{ + return mType; +} + +Result SyncChangeUpdate::result() const +{ + return mResult; +} + +SyncChange SyncChangeUpdate::change() const +{ + return mChange; +} + +int SyncChangeUpdate::memberId() const +{ + return mMemberId; +} + +int SyncChangeUpdate::mappingId() const +{ + return mMappingId; +} + +SyncMappingUpdate::SyncMappingUpdate() +{ +} + +SyncMappingUpdate::SyncMappingUpdate( OSyncMappingUpdate *update, OSyncEngine *engine ) +{ + switch ( update->type ) { + case MAPPING_SOLVED: + mType = Solved; + break; + case MAPPING_SYNCED: + mType = Synced; + break; + case MAPPING_WRITE_ERROR: + mType = WriteError; + break; + } + + if ( update->error ) + mResult = Result( &(update->error) ); + + mWinner = update->winner; + mMapping.mEngine = engine; + mMapping.mMapping = update->mapping; +} + +SyncMappingUpdate::~SyncMappingUpdate() +{ +} + +SyncMappingUpdate::Type SyncMappingUpdate::type() const +{ + return mType; +} + +Result SyncMappingUpdate::result() const +{ + return mResult; +} + +long long int SyncMappingUpdate::winner() const +{ + return mWinner; +} + +SyncMapping SyncMappingUpdate::mapping() const +{ + return mMapping; +} + +SyncEngineUpdate::SyncEngineUpdate() +{ +} + +SyncEngineUpdate::SyncEngineUpdate( OSyncEngineUpdate *update ) +{ + switch ( update->type ) { + case ENG_ENDPHASE_CON: + mType = EndPhaseConnected; + break; + case ENG_ENDPHASE_READ: + mType = EndPhaseRead; + break; + case ENG_ENDPHASE_WRITE: + mType = EndPhaseWrite; + break; + case ENG_ENDPHASE_DISCON: + mType = EndPhaseDisconnected; + break; + case ENG_ERROR: + mType = Error; + break; + case ENG_SYNC_SUCCESSFULL: + mType = SyncSuccessfull; + break; + case ENG_PREV_UNCLEAN: + mType = PrevUnclean; + break; + case ENG_END_CONFLICTS: + mType = EndConflicts; + break; + } + + if ( update->error ) + mResult = Result( &(update->error) ); +} + +SyncEngineUpdate::~SyncEngineUpdate() +{ +} + +SyncEngineUpdate::Type SyncEngineUpdate::type() const +{ + return mType; +} + +Result SyncEngineUpdate::result() const +{ + return mResult; +} + |