summaryrefslogtreecommitdiffabout
path: root/kabc
authorzautrix <zautrix>2004-10-27 20:17:45 (UTC)
committer zautrix <zautrix>2004-10-27 20:17:45 (UTC)
commit3d6ae51e66bafaa4b51ed43d2e72a42802669212 (patch) (unidiff)
tree86528ba48c05dcb8f575785c63f591e840a86d95 /kabc
parentbb82cac85cc196b3f60921ab27e84204036b54b8 (diff)
downloadkdepimpi-3d6ae51e66bafaa4b51ed43d2e72a42802669212.zip
kdepimpi-3d6ae51e66bafaa4b51ed43d2e72a42802669212.tar.gz
kdepimpi-3d6ae51e66bafaa4b51ed43d2e72a42802669212.tar.bz2
sync fixes
Diffstat (limited to 'kabc') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressbook.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp
index 5774c36..6194d6d 100644
--- a/kabc/addressbook.cpp
+++ b/kabc/addressbook.cpp
@@ -856,49 +856,49 @@ void AddressBook::removeAddressee( const Addressee &a )
856} 856}
857 857
858void AddressBook::removeSyncAddressees( bool removeDeleted ) 858void AddressBook::removeSyncAddressees( bool removeDeleted )
859{ 859{
860 Iterator it = begin(); 860 Iterator it = begin();
861 Iterator it2 ; 861 Iterator it2 ;
862 QDateTime dt ( QDate( 2004,1,1) ); 862 QDateTime dt ( QDate( 2004,1,1) );
863 while ( it != end() ) { 863 while ( it != end() ) {
864 (*it).setRevision( dt ); 864 (*it).setRevision( dt );
865 if (( *it).IDStr() != "changed" ) { 865 if (( *it).IDStr() != "changed" ) {
866 // "changed" is used for tagging changed addressees when syncing with KDE or OL 866 // "changed" is used for tagging changed addressees when syncing with KDE or OL
867 (*it).removeCustom( "KADDRESSBOOK", "X-ExternalID" ); 867 (*it).removeCustom( "KADDRESSBOOK", "X-ExternalID" );
868 (*it).setIDStr(""); 868 (*it).setIDStr("");
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 ) { 877 if ( removeDeleted ) {
878 // we have no postprocessing in the resource, we have to do it here 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 879 // we have to compute csum for all, because it could be the first sync
880 (*it).setTempSyncStat( SYNC_TEMPSTATE_NEW_CSUM ); 880 (*it).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID );
881 881
882 882
883 } 883 }
884 ++it; 884 ++it;
885 } 885 }
886 } 886 }
887 deleteRemovedAddressees(); 887 deleteRemovedAddressees();
888} 888}
889 889
890void AddressBook::removeAddressee( const Iterator &it ) 890void AddressBook::removeAddressee( const Iterator &it )
891{ 891{
892 d->mRemovedAddressees.append( (*it) ); 892 d->mRemovedAddressees.append( (*it) );
893 d->mAddressees.remove( it.d->mIt ); 893 d->mAddressees.remove( it.d->mIt );
894} 894}
895 895
896AddressBook::Iterator AddressBook::find( const Addressee &a ) 896AddressBook::Iterator AddressBook::find( const Addressee &a )
897{ 897{
898 Iterator it; 898 Iterator it;
899 for ( it = begin(); it != end(); ++it ) { 899 for ( it = begin(); it != end(); ++it ) {
900 if ( a.uid() == (*it).uid() ) { 900 if ( a.uid() == (*it).uid() ) {
901 return it; 901 return it;
902 } 902 }
903 } 903 }
904 return end(); 904 return end();
@@ -921,49 +921,49 @@ void AddressBook::preExternSync( AddressBook* aBook, const QString& csd , bool i
921 for ( it = begin(); it != end(); ++it ) { 921 for ( it = begin(); it != end(); ++it ) {
922 (*it).setID( csd, (*it).externalUID() ); 922 (*it).setID( csd, (*it).externalUID() );
923 (*it).computeCsum( csd ); 923 (*it).computeCsum( csd );
924 } 924 }
925 mergeAB( aBook ,csd, isSubset ); 925 mergeAB( aBook ,csd, isSubset );
926} 926}
927void AddressBook::postExternSync( AddressBook* aBook , const QString& csd, bool setID) 927void AddressBook::postExternSync( AddressBook* aBook , const QString& csd, bool setID)
928{ 928{
929 //qDebug("AddressBook::postExternSync "); 929 //qDebug("AddressBook::postExternSync ");
930 AddressBook::Iterator it; 930 AddressBook::Iterator it;
931 for ( it = begin(); it != end(); ++it ) { 931 for ( it = begin(); it != end(); ++it ) {
932 //qDebug("check uid %s ", (*it).uid().latin1() ); 932 //qDebug("check uid %s ", (*it).uid().latin1() );
933 if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID || 933 if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ||
934 (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_CSUM ) { 934 (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_CSUM ) {
935 Addressee ad = aBook->findByUid( ( (*it).uid() )); 935 Addressee ad = aBook->findByUid( ( (*it).uid() ));
936 if ( ad.isEmpty() ) { 936 if ( ad.isEmpty() ) {
937 qDebug("postExternSync:ERROR addressee is empty: %s ", (*it).uid().latin1()); 937 qDebug("postExternSync:ERROR addressee is empty: %s ", (*it).uid().latin1());
938 } else { 938 } else {
939 (*it).setIDStr(":"); 939 (*it).setIDStr(":");
940 (*it).computeCsum( csd ); 940 (*it).computeCsum( csd );
941 if ( setID ) { 941 if ( setID ) {
942 if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) 942 if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID )
943 ad.setID( csd, (*it).externalUID() ); 943 ad.setID( csd, (*it).externalUID() );
944 } else 944 } else
945 ad.setID( csd, "_" ); 945 ad.setID( csd, (*it).uid() );
946 ad.setCsum( csd, (*it).getCsum( csd ) ); 946 ad.setCsum( csd, (*it).getCsum( csd ) );
947 aBook->insertAddressee( ad ); 947 aBook->insertAddressee( ad );
948 } 948 }
949 } 949 }
950 } 950 }
951} 951}
952 952
953bool AddressBook::containsExternalUid( const QString& uid ) 953bool AddressBook::containsExternalUid( const QString& uid )
954{ 954{
955 Iterator it; 955 Iterator it;
956 for ( it = begin(); it != end(); ++it ) { 956 for ( it = begin(); it != end(); ++it ) {
957 if ( uid == (*it).externalUID( ) ) 957 if ( uid == (*it).externalUID( ) )
958 return true; 958 return true;
959 } 959 }
960 return false; 960 return false;
961} 961}
962Addressee AddressBook::findByExternUid( const QString& uid , const QString& profile ) 962Addressee AddressBook::findByExternUid( const QString& uid , const QString& profile )
963{ 963{
964 Iterator it; 964 Iterator it;
965 for ( it = begin(); it != end(); ++it ) { 965 for ( it = begin(); it != end(); ++it ) {
966 if ( uid == (*it).getID( profile ) ) 966 if ( uid == (*it).getID( profile ) )
967 return (*it); 967 return (*it);
968 } 968 }
969 return Addressee(); 969 return Addressee();