author | zautrix <zautrix> | 2005-01-18 14:09:00 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-18 14:09:00 (UTC) |
commit | ced210b0c4643ddac6a2e80eab4c85c1994b20e0 (patch) (side-by-side diff) | |
tree | 5126b599b1213553ae71512a400f46d7b2037d92 | |
parent | 4b82a36d1b2479dd2e6f00aef45af848f6793099 (diff) | |
download | kdepimpi-ced210b0c4643ddac6a2e80eab4c85c1994b20e0.zip kdepimpi-ced210b0c4643ddac6a2e80eab4c85c1994b20e0.tar.gz kdepimpi-ced210b0c4643ddac6a2e80eab4c85c1994b20e0.tar.bz2 |
ab sync fixes
-rw-r--r-- | kabc/addressee.cpp | 31 | ||||
-rw-r--r-- | kaddressbook/imagewidget.cpp | 1 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 7 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbooktableview.cpp | 2 |
4 files changed, 36 insertions, 5 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index bfcfab5..18b4d58 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp @@ -191,16 +191,17 @@ ulong Addressee::getCsum4List( const QStringList & attList) for ( k = 0; k < j; ++k ) { int mul = k +1; add = s[k].unicode (); if ( k < 16 ) mul = mul * mul; int ii = i+1; add = add * mul *ii*ii*ii; cSum += add; + //qDebug("csum: %d %d %d", i,k,cSum); } } } //QString dump = attList.join(","); //qDebug("csum: %d %s", cSum,dump.latin1()); return cSum; @@ -223,19 +224,42 @@ void Addressee::computeCsum(const QString &dev) if ( mData->geo.isValid() ) l.append( mData->geo.asString() ); if ( !mData->title .isEmpty() ) l.append( mData->title ); if ( !mData->role.isEmpty() ) l.append( mData->role ); if ( !mData->organization.isEmpty() ) l.append( mData->organization ); if ( !mData->note.isEmpty() ) l.append( mData->note ); if ( !mData->productId.isEmpty() ) l.append(mData->productId ); if ( !mData->sortString.isEmpty() ) l.append( mData->sortString ); if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString()); - // if ( !mData->logo.isEmpty() ) l.append( ); - //if ( !mData->photo.isEmpty() ) l.append( ); - //if ( !mData->sound.isEmpty() ) l.append( ); + if ( !mData->logo.undefined() ) { + if ( !mData->logo.isIntern() ) + l.append( mData->logo.url() ); + else + l.append( QString::number(mData->logo.data().width()* mData->logo.data().height())); + } else { + l.append( "nologo"); + } + if ( !mData->photo.undefined() ) { + if ( !mData->photo.isIntern() ) + l.append( mData->photo.url() ); + else + l.append( QString::number(mData->photo.data().width()* mData->photo.data().height())); + } else { + l.append( "nophoto"); + } +#if 0 + if ( !mData->sound.undefined() ) { + if ( !mData->sound.isIntern() ) + l.append( mData->sound.url() ); + else + l.append( QString(mData->sound.data().with()* mData->sound.data().height())); + } else { + l.append( "nosound"); + } +#endif //if ( !mData->agent.isEmpty() ) l.append( ); if ( mData->url.isValid() ) if ( ! mData->url.path().isEmpty()) l.append( mData->url.path() ); KABC::PhoneNumber::List phoneNumbers; KABC::PhoneNumber::List::Iterator phoneIter; QStringList t; for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); @@ -274,16 +298,17 @@ void Addressee::computeCsum(const QString &dev) 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) { // merge all standard non-outlook fields. //if isSubSet (e.g. mobile phone sync) merge all fields diff --git a/kaddressbook/imagewidget.cpp b/kaddressbook/imagewidget.cpp index 1e9743c..d0f52ea 100644 --- a/kaddressbook/imagewidget.cpp +++ b/kaddressbook/imagewidget.cpp @@ -235,16 +235,17 @@ KABC::Picture ImageWidget::logo() const QPixmap *px = mLogoLabel->pixmap(); if ( px ) { #ifndef KAB_EMBEDDED if ( px->height() > px->width() ) logo.setData( px->convertToImage().scaleHeight( 140 ) ); else logo.setData( px->convertToImage().scaleWidth( 100 ) ); #else //KAB_EMBEDDED + if (px->isNull() != true ) logo.setData( px->convertToImage() ); #endif //KAB_EMBEDDED logo.setType( "PNG" ); } } return logo; diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index d970ff1..e88706e 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -1183,16 +1183,20 @@ void KABCore::setModified( bool modified ) bool KABCore::modified() const { return mModified; } void KABCore::contactModified( const KABC::Addressee &addr ) { addrModified( addr ); +#if 0 // debug only + KABC::Addressee ad = addr; + ad.computeCsum( "123"); +#endif } void KABCore::addrModified( const KABC::Addressee &addr ,bool updateDetails ) { Command *command = 0; QString uid; @@ -2708,17 +2712,18 @@ int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, i QDateTime localMod = local->revision(); QDateTime remoteMod = remote->revision(); QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { bool remCh, locCh; remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); - //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); + if ( remCh ) + qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); locCh = ( localMod > mLastAddressbookSync ); //qDebug("cahnged rem %d loc %d",remCh, locCh ); if ( !remCh && ! locCh ) { //qDebug("both not changed "); lastSync = localMod.addDays(1); if ( mode <= SYNC_PREF_ASK ) return 0; } else { diff --git a/kaddressbook/views/kaddressbooktableview.cpp b/kaddressbook/views/kaddressbooktableview.cpp index ecd6f05..7022dcb 100644 --- a/kaddressbook/views/kaddressbooktableview.cpp +++ b/kaddressbook/views/kaddressbooktableview.cpp @@ -152,17 +152,17 @@ void KAddressBookTableView::doSearch( const QString& s, KABC::Field *field ) return; KABC::Addressee::List addresseeList = addressees(); KABC::Addressee::List::Iterator it; if ( field ) { for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) continue; #if QT_VERSION >= 300 - if (re.search(field->value( *it ).lower()) != -1) + if (re.search(field->value( *it ).lower()) == 0) #else if (re.match(field->value( *it ).lower()) != -1) #endif ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); } } else { KABC::Field::List fieldList = allFields(); |