summaryrefslogtreecommitdiffabout
path: root/kabc/addressbook.cpp
Unidiff
Diffstat (limited to 'kabc/addressbook.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressbook.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp
index d101589..9b196b5 100644
--- a/kabc/addressbook.cpp
+++ b/kabc/addressbook.cpp
@@ -833,66 +833,69 @@ void AddressBook::removeAddressee( const Addressee &a )
833 if ( a.uid() == (*it).uid() ) { 833 if ( a.uid() == (*it).uid() ) {
834 found = true; 834 found = true;
835 it2 = it; 835 it2 = it;
836 } else { 836 } else {
837 if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) { 837 if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) {
838 QString name = (*it).uid().mid( 19 ); 838 QString name = (*it).uid().mid( 19 );
839 Addressee b = a; 839 Addressee b = a;
840 QString id = b.getID( name ); 840 QString id = b.getID( name );
841 if ( ! id.isEmpty() ) { 841 if ( ! id.isEmpty() ) {
842 QString des = (*it).note(); 842 QString des = (*it).note();
843 if( des.find( id ) < 0 ) { 843 if( des.find( id ) < 0 ) {
844 des += id + ","; 844 des += id + ",";
845 (*it).setNote( des ); 845 (*it).setNote( des );
846 } 846 }
847 } 847 }
848 } 848 }
849 849
850 } 850 }
851 } 851 }
852 852
853 if ( found ) 853 if ( found )
854 removeAddressee( it2 ); 854 removeAddressee( it2 );
855 855
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 (*it).removeCustom( "KADDRESSBOOK", "X-ExternalID" ); 865 if (( *it).IDStr() != "changed" ) {
866 (*it).setIDStr(""); 866 // "changed" is used for tagging changed addressees when syncing with KDE or OL
867 (*it).removeCustom( "KADDRESSBOOK", "X-ExternalID" );
868 (*it).setIDStr("");
869 }
867 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-")) {
868 it2 = it; 871 it2 = it;
869 //qDebug("removing %s ",(*it).uid().latin1() ); 872 //qDebug("removing %s ",(*it).uid().latin1() );
870 ++it; 873 ++it;
871 removeAddressee( it2 ); 874 removeAddressee( it2 );
872 } else { 875 } else {
873 //qDebug("skipping %s ",(*it).uid().latin1() ); 876 //qDebug("skipping %s ",(*it).uid().latin1() );
874 ++it; 877 ++it;
875 } 878 }
876 } 879 }
877 deleteRemovedAddressees(); 880 deleteRemovedAddressees();
878} 881}
879 882
880void AddressBook::removeAddressee( const Iterator &it ) 883void AddressBook::removeAddressee( const Iterator &it )
881{ 884{
882 d->mRemovedAddressees.append( (*it) ); 885 d->mRemovedAddressees.append( (*it) );
883 d->mAddressees.remove( it.d->mIt ); 886 d->mAddressees.remove( it.d->mIt );
884} 887}
885 888
886AddressBook::Iterator AddressBook::find( const Addressee &a ) 889AddressBook::Iterator AddressBook::find( const Addressee &a )
887{ 890{
888 Iterator it; 891 Iterator it;
889 for ( it = begin(); it != end(); ++it ) { 892 for ( it = begin(); it != end(); ++it ) {
890 if ( a.uid() == (*it).uid() ) { 893 if ( a.uid() == (*it).uid() ) {
891 return it; 894 return it;
892 } 895 }
893 } 896 }
894 return end(); 897 return end();
895} 898}
896 899
897Addressee AddressBook::findByUid( const QString &uid ) 900Addressee AddressBook::findByUid( const QString &uid )
898{ 901{