-rw-r--r-- | kabc/addressbook.cpp | 26 | ||||
-rw-r--r-- | kabc/addressee.cpp | 25 |
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 @@ -563,5 +563,4 @@ void AddressBook::removeSyncInfo( QString syncProfile) Iterator it = begin(); Iterator it2 ; - QDateTime dt ( QDate( 2004,1,1) ); while ( it != end() ) { if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) { @@ -787,10 +786,5 @@ void AddressBook::insertAddressee( const Addressee &a, bool setRev, bool takeRes if ( changed ) { if ( setRev ) { - - // get rid of micro seconds - QDateTime dt = QDateTime::currentDateTime(); - QTime t = dt.time(); - dt.setTime( QTime (t.hour (), t.minute (), t.second () ) ); - (*it).setRevision( dt ); + (*it).setRevision( QDateTime::currentDateTime() ); } (*it).setChanged( true ); @@ -816,10 +810,10 @@ void AddressBook::insertAddressee( const Addressee &a, bool setRev, bool takeRes } if ( found ) - return; + return; + d->mAddressees.append( a ); Addressee& addr = d->mAddressees.last(); if ( addr.resource() == 0 ) addr.setResource( standardResource() ); - addr.setChanged( true ); } @@ -860,5 +854,5 @@ void AddressBook::removeSyncAddressees( bool removeDeleted ) Iterator it = begin(); Iterator it2 ; - QDateTime dt ( QDate( 2004,1,1) ); + QDateTime dt ( QDate( 2003,1,1) ); while ( it != end() ) { (*it).setRevision( dt ); @@ -866,5 +860,5 @@ void AddressBook::removeSyncAddressees( bool removeDeleted ) // "changed" is used for tagging changed addressees when syncing with KDE or OL (*it).removeCustom( "KADDRESSBOOK", "X-ExternalID" ); - (*it).setIDStr(""); + (*it).setIDStr(":"); } if ( ( (*it).tempSyncStat() == SYNC_TEMPSTATE_DELETE && removeDeleted )|| (*it).uid().left( 19 ) == QString("last-syncAddressee-")) { @@ -879,6 +873,4 @@ void AddressBook::removeSyncAddressees( bool removeDeleted ) // we have to compute csum for all, because it could be the first sync (*it).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); - - } ++it; @@ -932,5 +924,6 @@ void AddressBook::postExternSync( AddressBook* aBook , const QString& csd, bool //qDebug("check uid %s ", (*it).uid().latin1() ); if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID || - (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_CSUM ) { + (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_CSUM || + (*it).tempSyncStat() == SYNC_TEMPSTATE_ADDED_EXTERNAL) { Addressee ad = aBook->findByUid( ( (*it).uid() )); if ( ad.isEmpty() ) { @@ -938,5 +931,4 @@ void AddressBook::postExternSync( AddressBook* aBook , const QString& csd, bool } else { (*it).setIDStr(":"); - (*it).computeCsum( csd ); if ( setID ) { if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) @@ -944,6 +936,8 @@ void AddressBook::postExternSync( AddressBook* aBook , const QString& csd, bool } else ad.setID( csd, (*it).uid() ); + (*it).computeCsum( csd ); ad.setCsum( csd, (*it).getCsum( csd ) ); - aBook->insertAddressee( ad ); + //qDebug("CSUM %s ",(*it).getCsum( csd ).latin1() ); + aBook->insertAddressee( ad , false); } } diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index d5a110a..3d4992c 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp @@ -210,9 +210,9 @@ void Addressee::computeCsum(const QString &dev) { QStringList l; - if ( !mData->name.isEmpty() ) l.append(mData->name); - if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName ); + //if ( !mData->name.isEmpty() ) l.append(mData->name); + //if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName ); if ( !mData->familyName.isEmpty() ) l.append( mData->familyName ); if ( !mData->givenName.isEmpty() ) l.append(mData->givenName ); - if ( !mData->additionalName ) l.append( mData->additionalName ); + if ( !mData->additionalName.isEmpty() ) l.append( mData->additionalName ); if ( !mData->prefix.isEmpty() ) l.append( mData->prefix ); if ( !mData->suffix.isEmpty() ) l.append( mData->suffix ); @@ -257,5 +257,11 @@ void Addressee::computeCsum(const QString &dev) t.sort(); for ( iii = 0; iii < t.count(); ++iii) - l.append( t[iii] ); + if ( t[iii].left( 25 ) != "KADDRESSBOOK-X-ExternalID" ) { + int find = t[iii].find (':')+1; + //qDebug("lennnn %d %d ", find, t[iii].length()); + if ( find < t[iii].length()) + l.append( t[iii] ); + + } KABC::Address::List::Iterator addressIter; for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); @@ -267,5 +273,9 @@ void Addressee::computeCsum(const QString &dev) } uint cs = getCsum4List(l); - //qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); +#if 1 + for ( iii = 0; iii < l.count(); ++iii) + qDebug("%d***%s***",iii,l[iii].latin1()); + qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); +#endif setCsum( dev, QString::number (cs )); } @@ -1112,5 +1122,8 @@ void Addressee::setRevision( const QDateTime &revision ) detach(); mData->empty = false; - mData->revision = revision; + mData->revision = QDateTime( revision.date(), + QTime (revision.time().hour(), + revision.time().minute(), + revision.time().second())); } |