-rw-r--r-- | kabc/addressbook.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index 2785131..df0fba4 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp @@ -537,48 +537,69 @@ void AddressBook::removeUntagged() todelete = true; todel = ait; } else todelete = false; } if ( todelete ) removeAddressee( todel ); deleteRemovedAddressees(); } void AddressBook::smplifyAddressees() { Iterator ait; for ( ait = begin(); ait != end(); ++ait ) { (*ait).simplifyEmails(); (*ait).simplifyPhoneNumbers(); (*ait).simplifyPhoneNumberTypes(); (*ait).simplifyAddresses(); } } void AddressBook::removeSyncInfo( QString syncProfile) { Iterator ait; for ( ait = begin(); ait != end(); ++ait ) { (*ait).removeID( syncProfile ); + } + if ( syncProfile.isEmpty() ) { + Iterator it = begin(); + Iterator it2 ; + QDateTime dt ( QDate( 2004,1,1) ); + while ( it != end() ) { + if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) { + it2 = it; + //qDebug("removing %s ",(*it).uid().latin1() ); + ++it; + removeAddressee( it2 ); + } else { + //qDebug("skipping %s ",(*it).uid().latin1() ); + ++it; + } + } + } else { + Addressee lse; + lse = mAddressBook->findByUid( "last-syncAddressee-"+ syncProfile ); + if ( ! lse.isEmpty() ) + removeAddressee( lse ); } } void AddressBook::preparePhoneSync( QString currentSyncDevice, bool isPreSync ) { Iterator ait; for ( ait = begin(); ait != end(); ++ait ) { QString id = (*ait).IDStr(); (*ait).setIDStr( ":"); (*ait).setExternalUID( id ); (*ait).setOriginalExternalUID( id ); if ( isPreSync ) (*ait).setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL ); else { (*ait).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); (*ait).setID( currentSyncDevice,id ); } } } void AddressBook::findNewExtIds( QString fileName, QString currentSyncDevice ) { setUntagged(); |