summaryrefslogtreecommitdiffabout
path: root/kabc
Unidiff
Diffstat (limited to 'kabc') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressbook.cpp26
-rw-r--r--kabc/addressee.cpp25
2 files changed, 29 insertions, 22 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp
index 6194d6d..4c4ae09 100644
--- a/kabc/addressbook.cpp
+++ b/kabc/addressbook.cpp
@@ -541,49 +541,48 @@ void AddressBook::removeUntagged()
541 } 541 }
542 if ( todelete ) 542 if ( todelete )
543 removeAddressee( todel ); 543 removeAddressee( todel );
544 deleteRemovedAddressees(); 544 deleteRemovedAddressees();
545} 545}
546void AddressBook::smplifyAddressees() 546void AddressBook::smplifyAddressees()
547{ 547{
548 Iterator ait; 548 Iterator ait;
549 for ( ait = begin(); ait != end(); ++ait ) { 549 for ( ait = begin(); ait != end(); ++ait ) {
550 (*ait).simplifyEmails(); 550 (*ait).simplifyEmails();
551 (*ait).simplifyPhoneNumbers(); 551 (*ait).simplifyPhoneNumbers();
552 (*ait).simplifyPhoneNumberTypes(); 552 (*ait).simplifyPhoneNumberTypes();
553 (*ait).simplifyAddresses(); 553 (*ait).simplifyAddresses();
554 } 554 }
555} 555}
556void AddressBook::removeSyncInfo( QString syncProfile) 556void AddressBook::removeSyncInfo( QString syncProfile)
557{ 557{
558 Iterator ait; 558 Iterator ait;
559 for ( ait = begin(); ait != end(); ++ait ) { 559 for ( ait = begin(); ait != end(); ++ait ) {
560 (*ait).removeID( syncProfile ); 560 (*ait).removeID( syncProfile );
561 } 561 }
562 if ( syncProfile.isEmpty() ) { 562 if ( syncProfile.isEmpty() ) {
563 Iterator it = begin(); 563 Iterator it = begin();
564 Iterator it2 ; 564 Iterator it2 ;
565 QDateTime dt ( QDate( 2004,1,1) );
566 while ( it != end() ) { 565 while ( it != end() ) {
567 if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) { 566 if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) {
568 it2 = it; 567 it2 = it;
569 //qDebug("removing %s ",(*it).uid().latin1() ); 568 //qDebug("removing %s ",(*it).uid().latin1() );
570 ++it; 569 ++it;
571 removeAddressee( it2 ); 570 removeAddressee( it2 );
572 } else { 571 } else {
573 //qDebug("skipping %s ",(*it).uid().latin1() ); 572 //qDebug("skipping %s ",(*it).uid().latin1() );
574 ++it; 573 ++it;
575 } 574 }
576 } 575 }
577 } else { 576 } else {
578 Addressee lse; 577 Addressee lse;
579 lse = findByUid( "last-syncAddressee-"+ syncProfile ); 578 lse = findByUid( "last-syncAddressee-"+ syncProfile );
580 if ( ! lse.isEmpty() ) 579 if ( ! lse.isEmpty() )
581 removeAddressee( lse ); 580 removeAddressee( lse );
582 } 581 }
583 582
584} 583}
585void AddressBook::preparePhoneSync( QString currentSyncDevice, bool isPreSync ) 584void AddressBook::preparePhoneSync( QString currentSyncDevice, bool isPreSync )
586{ 585{
587 Iterator ait; 586 Iterator ait;
588 for ( ait = begin(); ait != end(); ++ait ) { 587 for ( ait = begin(); ait != end(); ++ait ) {
589 QString id = (*ait).IDStr(); 588 QString id = (*ait).IDStr();
@@ -765,142 +764,135 @@ void AddressBook::insertAddressee( const Addressee &a, bool setRev, bool takeRes
765 return; 764 return;
766 } 765 }
767 //qDebug("inserting.... %s ",a.uid().latin1() ); 766 //qDebug("inserting.... %s ",a.uid().latin1() );
768 bool found = false; 767 bool found = false;
769 Addressee::List::Iterator it; 768 Addressee::List::Iterator it;
770 for ( it = d->mAddressees.begin(); it != d->mAddressees.end(); ++it ) { 769 for ( it = d->mAddressees.begin(); it != d->mAddressees.end(); ++it ) {
771 if ( a.uid() == (*it).uid() ) { 770 if ( a.uid() == (*it).uid() ) {
772 771
773 bool changed = false; 772 bool changed = false;
774 Addressee addr = a; 773 Addressee addr = a;
775 if ( addr != (*it) ) 774 if ( addr != (*it) )
776 changed = true; 775 changed = true;
777 776
778 if ( takeResource ) { 777 if ( takeResource ) {
779 Resource * res = (*it).resource(); 778 Resource * res = (*it).resource();
780 (*it) = a; 779 (*it) = a;
781 (*it).setResource( res ); 780 (*it).setResource( res );
782 } else { 781 } else {
783 (*it) = a; 782 (*it) = a;
784 if ( (*it).resource() == 0 ) 783 if ( (*it).resource() == 0 )
785 (*it).setResource( standardResource() ); 784 (*it).setResource( standardResource() );
786 } 785 }
787 if ( changed ) { 786 if ( changed ) {
788 if ( setRev ) { 787 if ( setRev ) {
789 788 (*it).setRevision( QDateTime::currentDateTime() );
790 // get rid of micro seconds
791 QDateTime dt = QDateTime::currentDateTime();
792 QTime t = dt.time();
793 dt.setTime( QTime (t.hour (), t.minute (), t.second () ) );
794 (*it).setRevision( dt );
795 } 789 }
796 (*it).setChanged( true ); 790 (*it).setChanged( true );
797 } 791 }
798 792
799 found = true; 793 found = true;
800 } else { 794 } else {
801 if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) { 795 if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) {
802 QString name = (*it).uid().mid( 19 ); 796 QString name = (*it).uid().mid( 19 );
803 Addressee b = a; 797 Addressee b = a;
804 QString id = b.getID( name ); 798 QString id = b.getID( name );
805 if ( ! id.isEmpty() ) { 799 if ( ! id.isEmpty() ) {
806 QString des = (*it).note(); 800 QString des = (*it).note();
807 int startN; 801 int startN;
808 if( (startN = des.find( id ) ) >= 0 ) { 802 if( (startN = des.find( id ) ) >= 0 ) {
809 int endN = des.find( ",", startN+1 ); 803 int endN = des.find( ",", startN+1 );
810 des = des.left( startN ) + des.mid( endN+1 ); 804 des = des.left( startN ) + des.mid( endN+1 );
811 (*it).setNote( des ); 805 (*it).setNote( des );
812 } 806 }
813 } 807 }
814 } 808 }
815 } 809 }
816 } 810 }
817 if ( found ) 811 if ( found )
818 return; 812 return;
813
819 d->mAddressees.append( a ); 814 d->mAddressees.append( a );
820 Addressee& addr = d->mAddressees.last(); 815 Addressee& addr = d->mAddressees.last();
821 if ( addr.resource() == 0 ) 816 if ( addr.resource() == 0 )
822 addr.setResource( standardResource() ); 817 addr.setResource( standardResource() );
823
824 addr.setChanged( true ); 818 addr.setChanged( true );
825} 819}
826 820
827void AddressBook::removeAddressee( const Addressee &a ) 821void AddressBook::removeAddressee( const Addressee &a )
828{ 822{
829 Iterator it; 823 Iterator it;
830 Iterator it2; 824 Iterator it2;
831 bool found = false; 825 bool found = false;
832 for ( it = begin(); it != end(); ++it ) { 826 for ( it = begin(); it != end(); ++it ) {
833 if ( a.uid() == (*it).uid() ) { 827 if ( a.uid() == (*it).uid() ) {
834 found = true; 828 found = true;
835 it2 = it; 829 it2 = it;
836 } else { 830 } else {
837 if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) { 831 if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) {
838 QString name = (*it).uid().mid( 19 ); 832 QString name = (*it).uid().mid( 19 );
839 Addressee b = a; 833 Addressee b = a;
840 QString id = b.getID( name ); 834 QString id = b.getID( name );
841 if ( ! id.isEmpty() ) { 835 if ( ! id.isEmpty() ) {
842 QString des = (*it).note(); 836 QString des = (*it).note();
843 if( des.find( id ) < 0 ) { 837 if( des.find( id ) < 0 ) {
844 des += id + ","; 838 des += id + ",";
845 (*it).setNote( des ); 839 (*it).setNote( des );
846 } 840 }
847 } 841 }
848 } 842 }
849 843
850 } 844 }
851 } 845 }
852 846
853 if ( found ) 847 if ( found )
854 removeAddressee( it2 ); 848 removeAddressee( it2 );
855 849
856} 850}
857 851
858void AddressBook::removeSyncAddressees( bool removeDeleted ) 852void AddressBook::removeSyncAddressees( bool removeDeleted )
859{ 853{
860 Iterator it = begin(); 854 Iterator it = begin();
861 Iterator it2 ; 855 Iterator it2 ;
862 QDateTime dt ( QDate( 2004,1,1) ); 856 QDateTime dt ( QDate( 2003,1,1) );
863 while ( it != end() ) { 857 while ( it != end() ) {
864 (*it).setRevision( dt ); 858 (*it).setRevision( dt );
865 if (( *it).IDStr() != "changed" ) { 859 if (( *it).IDStr() != "changed" ) {
866 // "changed" is used for tagging changed addressees when syncing with KDE or OL 860 // "changed" is used for tagging changed addressees when syncing with KDE or OL
867 (*it).removeCustom( "KADDRESSBOOK", "X-ExternalID" ); 861 (*it).removeCustom( "KADDRESSBOOK", "X-ExternalID" );
868 (*it).setIDStr(""); 862 (*it).setIDStr(":");
869 } 863 }
870 if ( ( (*it).tempSyncStat() == SYNC_TEMPSTATE_DELETE && removeDeleted )|| (*it).uid().left( 19 ) == QString("last-syncAddressee-")) { 864 if ( ( (*it).tempSyncStat() == SYNC_TEMPSTATE_DELETE && removeDeleted )|| (*it).uid().left( 19 ) == QString("last-syncAddressee-")) {
871 it2 = it; 865 it2 = it;
872 //qDebug("removing %s ",(*it).uid().latin1() ); 866 //qDebug("removing %s ",(*it).uid().latin1() );
873 ++it; 867 ++it;
874 removeAddressee( it2 ); 868 removeAddressee( it2 );
875 } else { 869 } else {
876 //qDebug("skipping %s ",(*it).uid().latin1() ); 870 //qDebug("skipping %s ",(*it).uid().latin1() );
877 if ( removeDeleted ) { 871 if ( removeDeleted ) {
878 // we have no postprocessing in the resource, we have to do it here 872 // 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 873 // we have to compute csum for all, because it could be the first sync
880 (*it).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); 874 (*it).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID );
881
882
883 } 875 }
884 ++it; 876 ++it;
885 } 877 }
886 } 878 }
887 deleteRemovedAddressees(); 879 deleteRemovedAddressees();
888} 880}
889 881
890void AddressBook::removeAddressee( const Iterator &it ) 882void AddressBook::removeAddressee( const Iterator &it )
891{ 883{
892 d->mRemovedAddressees.append( (*it) ); 884 d->mRemovedAddressees.append( (*it) );
893 d->mAddressees.remove( it.d->mIt ); 885 d->mAddressees.remove( it.d->mIt );
894} 886}
895 887
896AddressBook::Iterator AddressBook::find( const Addressee &a ) 888AddressBook::Iterator AddressBook::find( const Addressee &a )
897{ 889{
898 Iterator it; 890 Iterator it;
899 for ( it = begin(); it != end(); ++it ) { 891 for ( it = begin(); it != end(); ++it ) {
900 if ( a.uid() == (*it).uid() ) { 892 if ( a.uid() == (*it).uid() ) {
901 return it; 893 return it;
902 } 894 }
903 } 895 }
904 return end(); 896 return end();
905} 897}
906 898
@@ -910,62 +902,64 @@ Addressee AddressBook::findByUid( const QString &uid )
910 for ( it = begin(); it != end(); ++it ) { 902 for ( it = begin(); it != end(); ++it ) {
911 if ( uid == (*it).uid() ) { 903 if ( uid == (*it).uid() ) {
912 return *it; 904 return *it;
913 } 905 }
914 } 906 }
915 return Addressee(); 907 return Addressee();
916} 908}
917void AddressBook::preExternSync( AddressBook* aBook, const QString& csd , bool isSubset ) 909void AddressBook::preExternSync( AddressBook* aBook, const QString& csd , bool isSubset )
918{ 910{
919 //qDebug("AddressBook::preExternSync "); 911 //qDebug("AddressBook::preExternSync ");
920 AddressBook::Iterator it; 912 AddressBook::Iterator it;
921 for ( it = begin(); it != end(); ++it ) { 913 for ( it = begin(); it != end(); ++it ) {
922 (*it).setID( csd, (*it).externalUID() ); 914 (*it).setID( csd, (*it).externalUID() );
923 (*it).computeCsum( csd ); 915 (*it).computeCsum( csd );
924 } 916 }
925 mergeAB( aBook ,csd, isSubset ); 917 mergeAB( aBook ,csd, isSubset );
926} 918}
927void AddressBook::postExternSync( AddressBook* aBook , const QString& csd, bool setID) 919void AddressBook::postExternSync( AddressBook* aBook , const QString& csd, bool setID)
928{ 920{
929 //qDebug("AddressBook::postExternSync "); 921 //qDebug("AddressBook::postExternSync ");
930 AddressBook::Iterator it; 922 AddressBook::Iterator it;
931 for ( it = begin(); it != end(); ++it ) { 923 for ( it = begin(); it != end(); ++it ) {
932 //qDebug("check uid %s ", (*it).uid().latin1() ); 924 //qDebug("check uid %s ", (*it).uid().latin1() );
933 if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID || 925 if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ||
934 (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_CSUM ) { 926 (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_CSUM ||
927 (*it).tempSyncStat() == SYNC_TEMPSTATE_ADDED_EXTERNAL) {
935 Addressee ad = aBook->findByUid( ( (*it).uid() )); 928 Addressee ad = aBook->findByUid( ( (*it).uid() ));
936 if ( ad.isEmpty() ) { 929 if ( ad.isEmpty() ) {
937 qDebug("postExternSync:ERROR addressee is empty: %s ", (*it).uid().latin1()); 930 qDebug("postExternSync:ERROR addressee is empty: %s ", (*it).uid().latin1());
938 } else { 931 } else {
939 (*it).setIDStr(":"); 932 (*it).setIDStr(":");
940 (*it).computeCsum( csd );
941 if ( setID ) { 933 if ( setID ) {
942 if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) 934 if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID )
943 ad.setID( csd, (*it).externalUID() ); 935 ad.setID( csd, (*it).externalUID() );
944 } else 936 } else
945 ad.setID( csd, (*it).uid() ); 937 ad.setID( csd, (*it).uid() );
938 (*it).computeCsum( csd );
946 ad.setCsum( csd, (*it).getCsum( csd ) ); 939 ad.setCsum( csd, (*it).getCsum( csd ) );
947 aBook->insertAddressee( ad ); 940 //qDebug("CSUM %s ",(*it).getCsum( csd ).latin1() );
941 aBook->insertAddressee( ad , false);
948 } 942 }
949 } 943 }
950 } 944 }
951} 945}
952 946
953bool AddressBook::containsExternalUid( const QString& uid ) 947bool AddressBook::containsExternalUid( const QString& uid )
954{ 948{
955 Iterator it; 949 Iterator it;
956 for ( it = begin(); it != end(); ++it ) { 950 for ( it = begin(); it != end(); ++it ) {
957 if ( uid == (*it).externalUID( ) ) 951 if ( uid == (*it).externalUID( ) )
958 return true; 952 return true;
959 } 953 }
960 return false; 954 return false;
961} 955}
962Addressee AddressBook::findByExternUid( const QString& uid , const QString& profile ) 956Addressee AddressBook::findByExternUid( const QString& uid , const QString& profile )
963{ 957{
964 Iterator it; 958 Iterator it;
965 for ( it = begin(); it != end(); ++it ) { 959 for ( it = begin(); it != end(); ++it ) {
966 if ( uid == (*it).getID( profile ) ) 960 if ( uid == (*it).getID( profile ) )
967 return (*it); 961 return (*it);
968 } 962 }
969 return Addressee(); 963 return Addressee();
970} 964}
971void AddressBook::mergeAB( AddressBook *aBook, const QString& profile , bool isSubset ) 965void AddressBook::mergeAB( AddressBook *aBook, const QString& profile , bool isSubset )
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index d5a110a..3d4992c 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -188,106 +188,116 @@ ulong Addressee::getCsum4List( const QStringList & attList)
188 QString s = attList[i]; 188 QString s = attList[i];
189 if ( ! s.isEmpty() ){ 189 if ( ! s.isEmpty() ){
190 j = s.length(); 190 j = s.length();
191 for ( k = 0; k < j; ++k ) { 191 for ( k = 0; k < j; ++k ) {
192 int mul = k +1; 192 int mul = k +1;
193 add = s[k].unicode (); 193 add = s[k].unicode ();
194 if ( k < 16 ) 194 if ( k < 16 )
195 mul = mul * mul; 195 mul = mul * mul;
196 int ii = i+1; 196 int ii = i+1;
197 add = add * mul *ii*ii*ii; 197 add = add * mul *ii*ii*ii;
198 cSum += add; 198 cSum += add;
199 } 199 }
200 } 200 }
201 201
202 } 202 }
203 //QString dump = attList.join(","); 203 //QString dump = attList.join(",");
204 //qDebug("csum: %d %s", cSum,dump.latin1()); 204 //qDebug("csum: %d %s", cSum,dump.latin1());
205 205
206 return cSum; 206 return cSum;
207 207
208} 208}
209void Addressee::computeCsum(const QString &dev) 209void Addressee::computeCsum(const QString &dev)
210{ 210{
211 QStringList l; 211 QStringList l;
212 if ( !mData->name.isEmpty() ) l.append(mData->name); 212 //if ( !mData->name.isEmpty() ) l.append(mData->name);
213 if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName ); 213 //if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName );
214 if ( !mData->familyName.isEmpty() ) l.append( mData->familyName ); 214 if ( !mData->familyName.isEmpty() ) l.append( mData->familyName );
215 if ( !mData->givenName.isEmpty() ) l.append(mData->givenName ); 215 if ( !mData->givenName.isEmpty() ) l.append(mData->givenName );
216 if ( !mData->additionalName ) l.append( mData->additionalName ); 216 if ( !mData->additionalName.isEmpty() ) l.append( mData->additionalName );
217 if ( !mData->prefix.isEmpty() ) l.append( mData->prefix ); 217 if ( !mData->prefix.isEmpty() ) l.append( mData->prefix );
218 if ( !mData->suffix.isEmpty() ) l.append( mData->suffix ); 218 if ( !mData->suffix.isEmpty() ) l.append( mData->suffix );
219 if ( !mData->nickName.isEmpty() ) l.append( mData->nickName ); 219 if ( !mData->nickName.isEmpty() ) l.append( mData->nickName );
220 if ( mData->birthday.isValid() ) l.append( mData->birthday.toString() ); 220 if ( mData->birthday.isValid() ) l.append( mData->birthday.toString() );
221 if ( !mData->mailer.isEmpty() ) l.append( mData->mailer ); 221 if ( !mData->mailer.isEmpty() ) l.append( mData->mailer );
222 if ( mData->timeZone.isValid() ) l.append( mData->timeZone.asString() ); 222 if ( mData->timeZone.isValid() ) l.append( mData->timeZone.asString() );
223 if ( mData->geo.isValid() ) l.append( mData->geo.asString() ); 223 if ( mData->geo.isValid() ) l.append( mData->geo.asString() );
224 if ( !mData->title .isEmpty() ) l.append( mData->title ); 224 if ( !mData->title .isEmpty() ) l.append( mData->title );
225 if ( !mData->role.isEmpty() ) l.append( mData->role ); 225 if ( !mData->role.isEmpty() ) l.append( mData->role );
226 if ( !mData->organization.isEmpty() ) l.append( mData->organization ); 226 if ( !mData->organization.isEmpty() ) l.append( mData->organization );
227 if ( !mData->note.isEmpty() ) l.append( mData->note ); 227 if ( !mData->note.isEmpty() ) l.append( mData->note );
228 if ( !mData->productId.isEmpty() ) l.append(mData->productId ); 228 if ( !mData->productId.isEmpty() ) l.append(mData->productId );
229 if ( !mData->sortString.isEmpty() ) l.append( mData->sortString ); 229 if ( !mData->sortString.isEmpty() ) l.append( mData->sortString );
230 if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString()); 230 if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString());
231 // if ( !mData->logo.isEmpty() ) l.append( ); 231 // if ( !mData->logo.isEmpty() ) l.append( );
232 //if ( !mData->photo.isEmpty() ) l.append( ); 232 //if ( !mData->photo.isEmpty() ) l.append( );
233 //if ( !mData->sound.isEmpty() ) l.append( ); 233 //if ( !mData->sound.isEmpty() ) l.append( );
234 //if ( !mData->agent.isEmpty() ) l.append( ); 234 //if ( !mData->agent.isEmpty() ) l.append( );
235 if ( mData->url.isValid() ) 235 if ( mData->url.isValid() )
236 if ( ! mData->url.path().isEmpty()) l.append( mData->url.path() ); 236 if ( ! mData->url.path().isEmpty()) l.append( mData->url.path() );
237 KABC::PhoneNumber::List phoneNumbers; 237 KABC::PhoneNumber::List phoneNumbers;
238 KABC::PhoneNumber::List::Iterator phoneIter; 238 KABC::PhoneNumber::List::Iterator phoneIter;
239 239
240 QStringList t; 240 QStringList t;
241 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); 241 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end();
242 ++phoneIter ) 242 ++phoneIter )
243 t.append( ( *phoneIter ).number()+QString::number( ( *phoneIter ).type() ) ); 243 t.append( ( *phoneIter ).number()+QString::number( ( *phoneIter ).type() ) );
244 t.sort(); 244 t.sort();
245 uint iii; 245 uint iii;
246 for ( iii = 0; iii < t.count(); ++iii) 246 for ( iii = 0; iii < t.count(); ++iii)
247 l.append( t[iii] ); 247 l.append( t[iii] );
248 t = mData->emails; 248 t = mData->emails;
249 t.sort(); 249 t.sort();
250 for ( iii = 0; iii < t.count(); ++iii) 250 for ( iii = 0; iii < t.count(); ++iii)
251 l.append( t[iii] ); 251 l.append( t[iii] );
252 t = mData->categories; 252 t = mData->categories;
253 t.sort(); 253 t.sort();
254 for ( iii = 0; iii < t.count(); ++iii) 254 for ( iii = 0; iii < t.count(); ++iii)
255 l.append( t[iii] ); 255 l.append( t[iii] );
256 t = mData->custom; 256 t = mData->custom;
257 t.sort(); 257 t.sort();
258 for ( iii = 0; iii < t.count(); ++iii) 258 for ( iii = 0; iii < t.count(); ++iii)
259 l.append( t[iii] ); 259 if ( t[iii].left( 25 ) != "KADDRESSBOOK-X-ExternalID" ) {
260 int find = t[iii].find (':')+1;
261 //qDebug("lennnn %d %d ", find, t[iii].length());
262 if ( find < t[iii].length())
263 l.append( t[iii] );
264
265 }
260 KABC::Address::List::Iterator addressIter; 266 KABC::Address::List::Iterator addressIter;
261 for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); 267 for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end();
262 ++addressIter ) { 268 ++addressIter ) {
263 t = (*addressIter).asList(); 269 t = (*addressIter).asList();
264 t.sort(); 270 t.sort();
265 for ( iii = 0; iii < t.count(); ++iii) 271 for ( iii = 0; iii < t.count(); ++iii)
266 l.append( t[iii] ); 272 l.append( t[iii] );
267 } 273 }
268 uint cs = getCsum4List(l); 274 uint cs = getCsum4List(l);
269 //qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); 275#if 1
276 for ( iii = 0; iii < l.count(); ++iii)
277 qDebug("%d***%s***",iii,l[iii].latin1());
278 qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() );
279#endif
270 setCsum( dev, QString::number (cs )); 280 setCsum( dev, QString::number (cs ));
271} 281}
272 282
273void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false) 283void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false)
274{ 284{
275 285
276 detach(); 286 detach();
277 if ( mData->name.isEmpty() ) mData->name = ad.mData->name; 287 if ( mData->name.isEmpty() ) mData->name = ad.mData->name;
278 if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName; 288 if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName;
279 if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName; 289 if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName;
280 if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ; 290 if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ;
281 if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName; 291 if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName;
282 if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix; 292 if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix;
283 if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix; 293 if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix;
284 if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName; 294 if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName;
285 if ( !mData->birthday.isValid() ) 295 if ( !mData->birthday.isValid() )
286 if ( ad.mData->birthday.isValid()) 296 if ( ad.mData->birthday.isValid())
287 mData->birthday = ad.mData->birthday; 297 mData->birthday = ad.mData->birthday;
288 if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer; 298 if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer;
289 if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone; 299 if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone;
290 if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo; 300 if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo;
291 if ( mData->title .isEmpty() ) mData->title = ad.mData->title ; 301 if ( mData->title .isEmpty() ) mData->title = ad.mData->title ;
292 if ( mData->role.isEmpty() ) mData->role = ad.mData->role ; 302 if ( mData->role.isEmpty() ) mData->role = ad.mData->role ;
293 if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ; 303 if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ;
@@ -1090,49 +1100,52 @@ QString Addressee::noteLabel()
1090void Addressee::setProductId( const QString &productId ) 1100void Addressee::setProductId( const QString &productId )
1091{ 1101{
1092 if ( productId == mData->productId ) return; 1102 if ( productId == mData->productId ) return;
1093 detach(); 1103 detach();
1094 mData->empty = false; 1104 mData->empty = false;
1095 mData->productId = productId; 1105 mData->productId = productId;
1096} 1106}
1097 1107
1098QString Addressee::productId() const 1108QString Addressee::productId() const
1099{ 1109{
1100 return mData->productId; 1110 return mData->productId;
1101} 1111}
1102 1112
1103QString Addressee::productIdLabel() 1113QString Addressee::productIdLabel()
1104{ 1114{
1105 return i18n("Product Identifier"); 1115 return i18n("Product Identifier");
1106} 1116}
1107 1117
1108 1118
1109void Addressee::setRevision( const QDateTime &revision ) 1119void Addressee::setRevision( const QDateTime &revision )
1110{ 1120{
1111 if ( revision == mData->revision ) return; 1121 if ( revision == mData->revision ) return;
1112 detach(); 1122 detach();
1113 mData->empty = false; 1123 mData->empty = false;
1114 mData->revision = revision; 1124 mData->revision = QDateTime( revision.date(),
1125 QTime (revision.time().hour(),
1126 revision.time().minute(),
1127 revision.time().second()));
1115} 1128}
1116 1129
1117QDateTime Addressee::revision() const 1130QDateTime Addressee::revision() const
1118{ 1131{
1119 return mData->revision; 1132 return mData->revision;
1120} 1133}
1121 1134
1122QString Addressee::revisionLabel() 1135QString Addressee::revisionLabel()
1123{ 1136{
1124 return i18n("Revision Date"); 1137 return i18n("Revision Date");
1125} 1138}
1126 1139
1127 1140
1128void Addressee::setSortString( const QString &sortString ) 1141void Addressee::setSortString( const QString &sortString )
1129{ 1142{
1130 if ( sortString == mData->sortString ) return; 1143 if ( sortString == mData->sortString ) return;
1131 detach(); 1144 detach();
1132 mData->empty = false; 1145 mData->empty = false;
1133 mData->sortString = sortString; 1146 mData->sortString = sortString;
1134} 1147}
1135 1148
1136QString Addressee::sortString() const 1149QString Addressee::sortString() const
1137{ 1150{
1138 return mData->sortString; 1151 return mData->sortString;