-rw-r--r-- | kabc/addressbook.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index 9b196b5..5774c36 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp | |||
@@ -869,16 +869,23 @@ void AddressBook::removeSyncAddressees( bool removeDeleted ) | |||
869 | } | 869 | } |
870 | if ( ( (*it).tempSyncStat() == SYNC_TEMPSTATE_DELETE && removeDeleted )|| (*it).uid().left( 19 ) == QString("last-syncAddressee-")) { | 870 | if ( ( (*it).tempSyncStat() == SYNC_TEMPSTATE_DELETE && removeDeleted )|| (*it).uid().left( 19 ) == QString("last-syncAddressee-")) { |
871 | it2 = it; | 871 | it2 = it; |
872 | //qDebug("removing %s ",(*it).uid().latin1() ); | 872 | //qDebug("removing %s ",(*it).uid().latin1() ); |
873 | ++it; | 873 | ++it; |
874 | removeAddressee( it2 ); | 874 | removeAddressee( it2 ); |
875 | } else { | 875 | } else { |
876 | //qDebug("skipping %s ",(*it).uid().latin1() ); | 876 | //qDebug("skipping %s ",(*it).uid().latin1() ); |
877 | if ( removeDeleted ) { | ||
878 | // we have no postprocessing in the resource, we have to do it here | ||
879 | // we have to compute csum for all, because it could be the first sync | ||
880 | (*it).setTempSyncStat( SYNC_TEMPSTATE_NEW_CSUM ); | ||
881 | |||
882 | |||
883 | } | ||
877 | ++it; | 884 | ++it; |
878 | } | 885 | } |
879 | } | 886 | } |
880 | deleteRemovedAddressees(); | 887 | deleteRemovedAddressees(); |
881 | } | 888 | } |
882 | 889 | ||
883 | void AddressBook::removeAddressee( const Iterator &it ) | 890 | void AddressBook::removeAddressee( const Iterator &it ) |
884 | { | 891 | { |
@@ -912,31 +919,35 @@ void AddressBook::preExternSync( AddressBook* aBook, const QString& csd , bool i | |||
912 | //qDebug("AddressBook::preExternSync "); | 919 | //qDebug("AddressBook::preExternSync "); |
913 | AddressBook::Iterator it; | 920 | AddressBook::Iterator it; |
914 | for ( it = begin(); it != end(); ++it ) { | 921 | for ( it = begin(); it != end(); ++it ) { |
915 | (*it).setID( csd, (*it).externalUID() ); | 922 | (*it).setID( csd, (*it).externalUID() ); |
916 | (*it).computeCsum( csd ); | 923 | (*it).computeCsum( csd ); |
917 | } | 924 | } |
918 | mergeAB( aBook ,csd, isSubset ); | 925 | mergeAB( aBook ,csd, isSubset ); |
919 | } | 926 | } |
920 | void AddressBook::postExternSync( AddressBook* aBook , const QString& csd) | 927 | void AddressBook::postExternSync( AddressBook* aBook , const QString& csd, bool setID) |
921 | { | 928 | { |
922 | //qDebug("AddressBook::postExternSync "); | 929 | //qDebug("AddressBook::postExternSync "); |
923 | AddressBook::Iterator it; | 930 | AddressBook::Iterator it; |
924 | for ( it = begin(); it != end(); ++it ) { | 931 | for ( it = begin(); it != end(); ++it ) { |
925 | // qDebug("check uid %s ", (*it).uid().latin1() ); | 932 | //qDebug("check uid %s ", (*it).uid().latin1() ); |
926 | if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID || | 933 | if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID || |
927 | (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_CSUM ) { | 934 | (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_CSUM ) { |
928 | Addressee ad = aBook->findByUid( ( (*it).uid() )); | 935 | Addressee ad = aBook->findByUid( ( (*it).uid() )); |
929 | if ( ad.isEmpty() ) { | 936 | if ( ad.isEmpty() ) { |
930 | qDebug("postExternSync:ERROR addressee is empty: %s ", (*it).uid().latin1()); | 937 | qDebug("postExternSync:ERROR addressee is empty: %s ", (*it).uid().latin1()); |
931 | } else { | 938 | } else { |
939 | (*it).setIDStr(":"); | ||
932 | (*it).computeCsum( csd ); | 940 | (*it).computeCsum( csd ); |
933 | if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) | 941 | if ( setID ) { |
934 | ad.setID( csd, (*it).externalUID() ); | 942 | if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) |
943 | ad.setID( csd, (*it).externalUID() ); | ||
944 | } else | ||
945 | ad.setID( csd, "_" ); | ||
935 | ad.setCsum( csd, (*it).getCsum( csd ) ); | 946 | ad.setCsum( csd, (*it).getCsum( csd ) ); |
936 | aBook->insertAddressee( ad ); | 947 | aBook->insertAddressee( ad ); |
937 | } | 948 | } |
938 | } | 949 | } |
939 | } | 950 | } |
940 | } | 951 | } |
941 | 952 | ||
942 | bool AddressBook::containsExternalUid( const QString& uid ) | 953 | bool AddressBook::containsExternalUid( const QString& uid ) |