-rw-r--r-- | kabc/addressbook.cpp | 9 | ||||
-rw-r--r-- | kabc/addressee.cpp | 8 | ||||
-rw-r--r-- | kabc/secrecy.h | 2 | ||||
-rw-r--r-- | kabc/vcard/VCardv.cpp | 2 |
4 files changed, 15 insertions, 6 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index 8487ff3..4de7da2 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp @@ -911,46 +911,53 @@ void AddressBook::preExternSync( AddressBook* aBook, const QString& csd , bool i //qDebug("AddressBook::preExternSync "); AddressBook::Iterator it; for ( it = begin(); it != end(); ++it ) { (*it).setID( csd, (*it).externalUID() ); (*it).computeCsum( csd ); } mergeAB( aBook ,csd, isSubset ); } void AddressBook::postExternSync( AddressBook* aBook , const QString& csd, bool setID) { //qDebug("AddressBook::postExternSync "); AddressBook::Iterator it; + int foundEmpty = 0; 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 || (*it).tempSyncStat() == SYNC_TEMPSTATE_ADDED_EXTERNAL) { Addressee ad = aBook->findByUid( ( (*it).uid() )); if ( ad.isEmpty() ) { - qDebug("postExternSync:ERROR addressee is empty: %s ", (*it).uid().latin1()); + ++foundEmpty; + //qDebug("postExternSync:addressee is empty: %s ", (*it).uid().latin1()); + //qDebug("-- formatted name %s ",(*it).formattedName().latin1() ); } else { (*it).setIDStr(":"); if ( setID ) { if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) ad.setID( csd, (*it).externalUID() ); } else ad.setID( csd, (*it).uid() ); (*it).computeCsum( csd ); ad.setCsum( csd, (*it).getCsum( csd ) ); //qDebug("CSUM %s ",(*it).getCsum( csd ).latin1() ); aBook->insertAddressee( ad , false); } } } + if ( foundEmpty ) { + qDebug("postExternSync:%d empty addressees found:\n probably filtered out by incoming sync filter.",foundEmpty ); + } + } 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 ) diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index 568dfc4..d60cd6b 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp @@ -246,46 +246,48 @@ void Addressee::computeCsum(const QString &dev) for ( iii = 0; iii < t.count(); ++iii) l.append( t[iii] ); t = mData->emails; t.sort(); for ( iii = 0; iii < t.count(); ++iii) l.append( t[iii] ); t = mData->categories; t.sort(); for ( iii = 0; iii < t.count(); ++iii) l.append( t[iii] ); t = mData->custom; t.sort(); - for ( iii = 0; iii < t.count(); ++iii) + for ( iii = 0; iii < t.count(); ++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] ); - + l.append( t[iii] ); + } KABC::Address::List::Iterator addressIter; for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); ++addressIter ) { t = (*addressIter).asList(); t.sort(); for ( iii = 0; iii < t.count(); ++iii) l.append( t[iii] ); } uint cs = getCsum4List(l); + #if 0 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 )); } void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false) { detach(); if ( mData->name.isEmpty() ) mData->name = ad.mData->name; if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName; if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName; if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ; if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName; diff --git a/kabc/secrecy.h b/kabc/secrecy.h index 8f2f736..b2ff565 100644 --- a/kabc/secrecy.h +++ b/kabc/secrecy.h @@ -50,25 +50,25 @@ public: enum Types { Public, Private, Confidential, Invalid }; /** * Constructor. * * @param type The secrecy type, @see Types. */ - Secrecy( int type = Invalid ); + Secrecy( int type = Public ); bool operator==( const Secrecy & ) const; bool operator!=( const Secrecy & ) const; /** Returns if the Secrecy object has a valid value. */ bool isValid() const; /** * Sets the type, @see Types. */ diff --git a/kabc/vcard/VCardv.cpp b/kabc/vcard/VCardv.cpp index 1166aac..bad2ef1 100644 --- a/kabc/vcard/VCardv.cpp +++ b/kabc/vcard/VCardv.cpp @@ -163,25 +163,25 @@ VCard::_parse() QStringList refolded; QStringList::Iterator it = l.begin(); QString cur; for (; it != l.end(); ++it) { cur = (*it); ++it; while ( it!= l.end() && (*it).at(0) == ' ' && (*it).length()!= 1) { - cur += (*it) ; + cur += (*it).mid(1) ; ++it; } --it; refolded.append(cur); } QStringList::Iterator it2 = refolded.begin(); for (; it2 != refolded.end(); ++it2) { ContentLine * cl = new ContentLine(QCString((*it2).latin1())); cl->parse(); if (cl->value() == 0) { qDebug("Content line could not be parsed. Discarded: %s", (*it2).latin1()); |