summaryrefslogtreecommitdiffabout
path: root/kabc/addressbook.cpp
Side-by-side diff
Diffstat (limited to 'kabc/addressbook.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressbook.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp
index 19c26eb..8882259 100644
--- a/kabc/addressbook.cpp
+++ b/kabc/addressbook.cpp
@@ -818,154 +818,154 @@ void AddressBook::removeSyncAddressees( bool removeDeleted )
{
Iterator it = begin();
Iterator it2 ;
QDateTime dt ( QDate( 2004,1,1) );
while ( it != end() ) {
(*it).setRevision( dt );
(*it).removeCustom( "KADDRESSBOOK", "X-ExternalID" );
(*it).setIDStr("");
if ( ( (*it).tempSyncStat() == SYNC_TEMPSTATE_DELETE && removeDeleted )|| (*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;
}
}
deleteRemovedAddressees();
}
void AddressBook::removeAddressee( const Iterator &it )
{
d->mRemovedAddressees.append( (*it) );
d->mAddressees.remove( it.d->mIt );
}
AddressBook::Iterator AddressBook::find( const Addressee &a )
{
Iterator it;
for ( it = begin(); it != end(); ++it ) {
if ( a.uid() == (*it).uid() ) {
return it;
}
}
return end();
}
Addressee AddressBook::findByUid( const QString &uid )
{
Iterator it;
for ( it = begin(); it != end(); ++it ) {
if ( uid == (*it).uid() ) {
return *it;
}
}
return Addressee();
}
-void AddressBook::preExternSync( AddressBook* aBook, const QString& csd )
+void AddressBook::preExternSync( AddressBook* aBook, const QString& csd , bool isSubset )
{
//qDebug("AddressBook::preExternSync ");
AddressBook::Iterator it;
for ( it = begin(); it != end(); ++it ) {
(*it).setID( csd, (*it).externalUID() );
(*it).computeCsum( csd );
}
- mergeAB( aBook ,csd );
+ mergeAB( aBook ,csd, isSubset );
}
void AddressBook::postExternSync( AddressBook* aBook , const QString& csd)
{
//qDebug("AddressBook::postExternSync ");
AddressBook::Iterator it;
for ( it = begin(); it != end(); ++it ) {
// qDebug("check uid %s ", (*it).uid().latin1() );
if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ||
(*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_CSUM ) {
Addressee ad = aBook->findByUid( ( (*it).uid() ));
if ( ad.isEmpty() ) {
qDebug("postExternSync:ERROR addressee is empty: %s ", (*it).uid().latin1());
} else {
(*it).computeCsum( csd );
if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID )
ad.setID( csd, (*it).externalUID() );
ad.setCsum( csd, (*it).getCsum( csd ) );
aBook->insertAddressee( ad );
}
}
}
}
bool AddressBook::containsExternalUid( const QString& uid )
{
Iterator it;
for ( it = begin(); it != end(); ++it ) {
if ( uid == (*it).externalUID( ) )
return true;
}
return false;
}
Addressee AddressBook::findByExternUid( const QString& uid , const QString& profile )
{
Iterator it;
for ( it = begin(); it != end(); ++it ) {
if ( uid == (*it).getID( profile ) )
return (*it);
}
return Addressee();
}
-void AddressBook::mergeAB( AddressBook *aBook, const QString& profile )
+void AddressBook::mergeAB( AddressBook *aBook, const QString& profile , bool isSubset )
{
Iterator it;
Addressee ad;
for ( it = begin(); it != end(); ++it ) {
ad = aBook->findByExternUid( (*it).externalUID(), profile );
if ( !ad.isEmpty() ) {
- (*it).mergeContact( ad );
+ (*it).mergeContact( ad ,isSubset);
}
}
#if 0
// test only
for ( it = begin(); it != end(); ++it ) {
qDebug("uid %s ", (*it).uid().latin1());
}
#endif
}
#if 0
Addressee::List AddressBook::getExternLastSyncAddressees()
{
Addressee::List results;
Iterator it;
for ( it = begin(); it != end(); ++it ) {
if ( (*it).uid().left( 19 ) == "last-syncAddressee-" ) {
if ( (*it).familyName().left(4) == "!E: " )
results.append( *it );
}
}
return results;
}
#endif
void AddressBook::resetTempSyncStat()
{
Iterator it;
for ( it = begin(); it != end(); ++it ) {
(*it).setTempSyncStat ( SYNC_TEMPSTATE_INITIAL );
}
}
QStringList AddressBook:: uidList()
{
QStringList results;
Iterator it;
for ( it = begin(); it != end(); ++it ) {
results.append( (*it).uid() );
}
return results;
}
Addressee::List AddressBook::allAddressees()