-rw-r--r-- | kabc/addressbook.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index f9e4387..fe59fcb 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp | |||
@@ -933,52 +933,70 @@ Addressee AddressBook::findByUid( const QString &uid ) | |||
933 | if ( uid == (*it).uid() ) { | 933 | if ( uid == (*it).uid() ) { |
934 | return *it; | 934 | return *it; |
935 | } | 935 | } |
936 | } | 936 | } |
937 | return Addressee(); | 937 | return Addressee(); |
938 | } | 938 | } |
939 | void AddressBook::preExternSync( AddressBook* aBook, const QString& csd , bool isSubset ) | 939 | void AddressBook::preExternSync( AddressBook* aBook, const QString& csd , bool isSubset ) |
940 | { | 940 | { |
941 | //qDebug("AddressBook::preExternSync "); | 941 | //qDebug("AddressBook::preExternSync "); |
942 | AddressBook::Iterator it; | 942 | AddressBook::Iterator it; |
943 | for ( it = begin(); it != end(); ++it ) { | 943 | for ( it = begin(); it != end(); ++it ) { |
944 | (*it).setID( csd, (*it).externalUID() ); | 944 | (*it).setID( csd, (*it).externalUID() ); |
945 | (*it).computeCsum( csd ); | 945 | (*it).computeCsum( csd ); |
946 | } | 946 | } |
947 | mergeAB( aBook ,csd, isSubset ); | 947 | mergeAB( aBook ,csd, isSubset ); |
948 | } | 948 | } |
949 | void AddressBook::preOLSync( AddressBook* aBook, const QString& csd ) | ||
950 | { | ||
951 | //qDebug("AddressBook::preExternSync "); | ||
952 | AddressBook::Iterator it; | ||
953 | for ( it = begin(); it != end(); ++it ) { | ||
954 | (*it).setID( csd, (*it).externalUID() ); | ||
955 | (*it).computeCsum( csd ); | ||
956 | } | ||
957 | |||
958 | Addressee ad; | ||
959 | for ( it = begin(); it != end(); ++it ) { | ||
960 | ad = aBook->findByExternUid( (*it).externalUID(), csd ); | ||
961 | if ( !ad.isEmpty() ) { | ||
962 | (*it).mergeOLContact( ad ); | ||
963 | } | ||
964 | } | ||
965 | } | ||
949 | void AddressBook::postExternSync( AddressBook* aBook , const QString& csd, bool setID) | 966 | void AddressBook::postExternSync( AddressBook* aBook , const QString& csd, bool setID) |
950 | { | 967 | { |
951 | //qDebug("AddressBook::postExternSync "); | 968 | //qDebug("AddressBook::postExternSync "); |
952 | AddressBook::Iterator it; | 969 | AddressBook::Iterator it; |
953 | int foundEmpty = 0; | 970 | int foundEmpty = 0; |
954 | for ( it = begin(); it != end(); ++it ) { | 971 | for ( it = begin(); it != end(); ++it ) { |
955 | //qDebug("check uid %s ", (*it).uid().latin1() ); | 972 | //qDebug("check uid %s ", (*it).uid().latin1() ); |
956 | if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID || | 973 | if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID || |
957 | (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_CSUM || | 974 | (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_CSUM || |
958 | (*it).tempSyncStat() == SYNC_TEMPSTATE_ADDED_EXTERNAL) { | 975 | (*it).tempSyncStat() == SYNC_TEMPSTATE_ADDED_EXTERNAL) { |
959 | Addressee ad = aBook->findByUid( ( (*it).uid() )); | 976 | Addressee ad = aBook->findByUid( ( (*it).uid() )); |
960 | if ( ad.isEmpty() ) { | 977 | if ( ad.isEmpty() ) { |
961 | ++foundEmpty; | 978 | ++foundEmpty; |
962 | //qDebug("postExternSync:addressee is empty: %s ", (*it).uid().latin1()); | 979 | //qDebug("postExternSync:addressee is empty: %s ", (*it).uid().latin1()); |
963 | //qDebug("-- formatted name %s ",(*it).formattedName().latin1() ); | 980 | //qDebug("-- formatted name %s ",(*it).formattedName().latin1() ); |
964 | } else { | 981 | } else { |
965 | (*it).setIDStr(":"); | 982 | (*it).setIDStr(":"); |
966 | if ( setID ) { | 983 | if ( setID ) { |
967 | if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) | 984 | if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) |
968 | ad.setID( csd, (*it).externalUID() ); | 985 | ad.setID( csd, (*it).externalUID() );{ |
986 | } | ||
969 | } else | 987 | } else |
970 | ad.setID( csd, (*it).uid() ); | 988 | ad.setID( csd, (*it).uid() ); |
971 | (*it).computeCsum( csd ); | 989 | (*it).computeCsum( csd ); |
972 | ad.setCsum( csd, (*it).getCsum( csd ) ); | 990 | ad.setCsum( csd, (*it).getCsum( csd ) ); |
973 | //qDebug("CSUM %s ",(*it).getCsum( csd ).latin1() ); | 991 | //qDebug("CSUM %s ",(*it).getCsum( csd ).latin1() ); |
974 | aBook->insertAddressee( ad , false); | 992 | aBook->insertAddressee( ad , false); |
975 | } | 993 | } |
976 | } | 994 | } |
977 | } | 995 | } |
978 | if ( foundEmpty ) { | 996 | if ( foundEmpty ) { |
979 | qDebug("postExternSync:%d empty addressees found:\n probably filtered out by incoming sync filter.",foundEmpty ); | 997 | qDebug("postExternSync:%d empty addressees found:\n probably filtered out by incoming sync filter.",foundEmpty ); |
980 | } | 998 | } |
981 | 999 | ||
982 | } | 1000 | } |
983 | 1001 | ||
984 | bool AddressBook::containsExternalUid( const QString& uid ) | 1002 | bool AddressBook::containsExternalUid( const QString& uid ) |