summaryrefslogtreecommitdiffabout
path: root/kabc/addressbook.cpp
Unidiff
Diffstat (limited to 'kabc/addressbook.cpp') (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 4de7da2..9e61261 100644
--- a/kabc/addressbook.cpp
+++ b/kabc/addressbook.cpp
@@ -915,99 +915,99 @@ void AddressBook::preExternSync( AddressBook* aBook, const QString& csd , bool i
915 (*it).computeCsum( csd ); 915 (*it).computeCsum( csd );
916 } 916 }
917 mergeAB( aBook ,csd, isSubset ); 917 mergeAB( aBook ,csd, isSubset );
918} 918}
919void AddressBook::postExternSync( AddressBook* aBook , const QString& csd, bool setID) 919void AddressBook::postExternSync( AddressBook* aBook , const QString& csd, bool setID)
920{ 920{
921 //qDebug("AddressBook::postExternSync "); 921 //qDebug("AddressBook::postExternSync ");
922 AddressBook::Iterator it; 922 AddressBook::Iterator it;
923 int foundEmpty = 0; 923 int foundEmpty = 0;
924 for ( it = begin(); it != end(); ++it ) { 924 for ( it = begin(); it != end(); ++it ) {
925 //qDebug("check uid %s ", (*it).uid().latin1() ); 925 //qDebug("check uid %s ", (*it).uid().latin1() );
926 if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID || 926 if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ||
927 (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_CSUM || 927 (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_CSUM ||
928 (*it).tempSyncStat() == SYNC_TEMPSTATE_ADDED_EXTERNAL) { 928 (*it).tempSyncStat() == SYNC_TEMPSTATE_ADDED_EXTERNAL) {
929 Addressee ad = aBook->findByUid( ( (*it).uid() )); 929 Addressee ad = aBook->findByUid( ( (*it).uid() ));
930 if ( ad.isEmpty() ) { 930 if ( ad.isEmpty() ) {
931 ++foundEmpty; 931 ++foundEmpty;
932 //qDebug("postExternSync:addressee is empty: %s ", (*it).uid().latin1()); 932 //qDebug("postExternSync:addressee is empty: %s ", (*it).uid().latin1());
933 //qDebug("-- formatted name %s ",(*it).formattedName().latin1() ); 933 //qDebug("-- formatted name %s ",(*it).formattedName().latin1() );
934 } else { 934 } else {
935 (*it).setIDStr(":"); 935 (*it).setIDStr(":");
936 if ( setID ) { 936 if ( setID ) {
937 if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) 937 if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID )
938 ad.setID( csd, (*it).externalUID() ); 938 ad.setID( csd, (*it).externalUID() );
939 } else 939 } else
940 ad.setID( csd, (*it).uid() ); 940 ad.setID( csd, (*it).uid() );
941 (*it).computeCsum( csd ); 941 (*it).computeCsum( csd );
942 ad.setCsum( csd, (*it).getCsum( csd ) ); 942 ad.setCsum( csd, (*it).getCsum( csd ) );
943 //qDebug("CSUM %s ",(*it).getCsum( csd ).latin1() ); 943 //qDebug("CSUM %s ",(*it).getCsum( csd ).latin1() );
944 aBook->insertAddressee( ad , false); 944 aBook->insertAddressee( ad , false);
945 } 945 }
946 } 946 }
947 } 947 }
948 if ( foundEmpty ) { 948 if ( foundEmpty ) {
949 qDebug("postExternSync:%d empty addressees found:\n probably filtered out by incoming sync filter.",foundEmpty ); 949 qDebug("postExternSync:%d empty addressees found:\n probably filtered out by incoming sync filter.",foundEmpty );
950 } 950 }
951 951
952} 952}
953 953
954bool AddressBook::containsExternalUid( const QString& uid ) 954bool AddressBook::containsExternalUid( const QString& uid )
955{ 955{
956 Iterator it; 956 Iterator it;
957 for ( it = begin(); it != end(); ++it ) { 957 for ( it = begin(); it != end(); ++it ) {
958 if ( uid == (*it).externalUID( ) ) 958 if ( uid == (*it).externalUID( ) )
959 return true; 959 return true;
960 } 960 }
961 return false; 961 return false;
962} 962}
963Addressee AddressBook::findByExternUid( const QString& uid , const QString& profile ) 963const Addressee AddressBook::findByExternUid( const QString& uid , const QString& profile ) const
964{ 964{
965 Iterator it; 965 ConstIterator it;
966 for ( it = begin(); it != end(); ++it ) { 966 for ( it = begin(); it != end(); ++it ) {
967 if ( uid == (*it).getID( profile ) ) 967 if ( uid == (*it).getID( profile ) )
968 return (*it); 968 return (*it);
969 } 969 }
970 return Addressee(); 970 return Addressee();
971} 971}
972void AddressBook::mergeAB( AddressBook *aBook, const QString& profile , bool isSubset ) 972void AddressBook::mergeAB( AddressBook *aBook, const QString& profile , bool isSubset )
973{ 973{
974 Iterator it; 974 Iterator it;
975 Addressee ad; 975 Addressee ad;
976 for ( it = begin(); it != end(); ++it ) { 976 for ( it = begin(); it != end(); ++it ) {
977 ad = aBook->findByExternUid( (*it).externalUID(), profile ); 977 ad = aBook->findByExternUid( (*it).externalUID(), profile );
978 if ( !ad.isEmpty() ) { 978 if ( !ad.isEmpty() ) {
979 (*it).mergeContact( ad ,isSubset); 979 (*it).mergeContact( ad ,isSubset);
980 } 980 }
981 } 981 }
982#if 0 982#if 0
983 // test only 983 // test only
984 for ( it = begin(); it != end(); ++it ) { 984 for ( it = begin(); it != end(); ++it ) {
985 985
986 qDebug("uid %s ", (*it).uid().latin1()); 986 qDebug("uid %s ", (*it).uid().latin1());
987 } 987 }
988#endif 988#endif
989} 989}
990 990
991#if 0 991#if 0
992Addressee::List AddressBook::getExternLastSyncAddressees() 992Addressee::List AddressBook::getExternLastSyncAddressees()
993{ 993{
994 Addressee::List results; 994 Addressee::List results;
995 995
996 Iterator it; 996 Iterator it;
997 for ( it = begin(); it != end(); ++it ) { 997 for ( it = begin(); it != end(); ++it ) {
998 if ( (*it).uid().left( 19 ) == "last-syncAddressee-" ) { 998 if ( (*it).uid().left( 19 ) == "last-syncAddressee-" ) {
999 if ( (*it).familyName().left(4) == "!E: " ) 999 if ( (*it).familyName().left(4) == "!E: " )
1000 results.append( *it ); 1000 results.append( *it );
1001 } 1001 }
1002 } 1002 }
1003 1003
1004 return results; 1004 return results;
1005} 1005}
1006#endif 1006#endif
1007void AddressBook::resetTempSyncStat() 1007void AddressBook::resetTempSyncStat()
1008{ 1008{
1009 Iterator it; 1009 Iterator it;
1010 for ( it = begin(); it != end(); ++it ) { 1010 for ( it = begin(); it != end(); ++it ) {
1011 (*it).setTempSyncStat ( SYNC_TEMPSTATE_INITIAL ); 1011 (*it).setTempSyncStat ( SYNC_TEMPSTATE_INITIAL );
1012 } 1012 }
1013 1013