summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-09-21 11:17:18 (UTC)
committer zautrix <zautrix>2004-09-21 11:17:18 (UTC)
commitba89a5d20eb054054d9cfae3723a4d62b9f62efd (patch) (unidiff)
treeee1a42079e3204dbab6f45762f83cb4c1712579e
parent19f445f0b6e7d4591db46b89e877ed9f4332ecd4 (diff)
downloadkdepimpi-ba89a5d20eb054054d9cfae3723a4d62b9f62efd.zip
kdepimpi-ba89a5d20eb054054d9cfae3723a4d62b9f62efd.tar.gz
kdepimpi-ba89a5d20eb054054d9cfae3723a4d62b9f62efd.tar.bz2
DTM fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressee.cpp1
-rw-r--r--kabc/plugins/sharpdtm/resourcesharpdtm.cpp1
-rw-r--r--kabc/plugins/sharpdtm/sharpdtmconverter.cpp2
3 files changed, 3 insertions, 1 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index 31ce1d6..25c77f6 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -291,48 +291,49 @@ void Addressee::mergeContact( const Addressee& ad )
291 if ( !mData->birthday.isValid() ) 291 if ( !mData->birthday.isValid() )
292 if ( ad.mData->birthday.isValid()) 292 if ( ad.mData->birthday.isValid())
293 mData->birthday = ad.mData->birthday; 293 mData->birthday = ad.mData->birthday;
294 if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer; 294 if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer;
295 if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone; 295 if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone;
296 if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo; 296 if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo;
297 if ( mData->title .isEmpty() ) mData->title = ad.mData->title ; 297 if ( mData->title .isEmpty() ) mData->title = ad.mData->title ;
298 if ( mData->role.isEmpty() ) mData->role = ad.mData->role ; 298 if ( mData->role.isEmpty() ) mData->role = ad.mData->role ;
299 if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ; 299 if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ;
300 if ( mData->note.isEmpty() ) mData->note = ad.mData->note ; 300 if ( mData->note.isEmpty() ) mData->note = ad.mData->note ;
301 if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId; 301 if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId;
302 if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString; 302 if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString;
303 if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy; 303 if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy;
304 if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ; 304 if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ;
305 305
306 // pending: 306 // pending:
307 // merging phonenumbers 307 // merging phonenumbers
308 // merging addresses 308 // merging addresses
309 // merging emails; 309 // merging emails;
310 // merging categories; 310 // merging categories;
311 // merging custom; 311 // merging custom;
312 // merging keys 312 // merging keys
313 qDebug("merge contact %s ", ad.uid().latin1()); 313 qDebug("merge contact %s ", ad.uid().latin1());
314 setUid( ad.uid() ); 314 setUid( ad.uid() );
315 setRevision( ad.revision() );
315} 316}
316 317
317void Addressee::removeID(const QString &prof) 318void Addressee::removeID(const QString &prof)
318{ 319{
319 detach(); 320 detach();
320 mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); 321 mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof);
321 322
322} 323}
323void Addressee::setID( const QString & prof , const QString & id ) 324void Addressee::setID( const QString & prof , const QString & id )
324{ 325{
325 detach(); 326 detach();
326 mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); 327 mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id );
327 //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); 328 //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() );
328} 329}
329void Addressee::setTempSyncStat( int id ) 330void Addressee::setTempSyncStat( int id )
330{ 331{
331 if ( mData->mTempSyncStat == id ) return; 332 if ( mData->mTempSyncStat == id ) return;
332 detach(); 333 detach();
333 mData->mTempSyncStat = id; 334 mData->mTempSyncStat = id;
334} 335}
335int Addressee::tempSyncStat() const 336int Addressee::tempSyncStat() const
336{ 337{
337 return mData->mTempSyncStat; 338 return mData->mTempSyncStat;
338} 339}
diff --git a/kabc/plugins/sharpdtm/resourcesharpdtm.cpp b/kabc/plugins/sharpdtm/resourcesharpdtm.cpp
index 437bda8..adc7256 100644
--- a/kabc/plugins/sharpdtm/resourcesharpdtm.cpp
+++ b/kabc/plugins/sharpdtm/resourcesharpdtm.cpp
@@ -277,49 +277,48 @@ bool ResourceSharpDTM::save( Ticket *ticket )
277 277
278#if 0 278#if 0
279 KABC::Addressee addressee; 279 KABC::Addressee addressee;
280 res = mConverter->sharpToAddressee( id, mAccess, addressee ); 280 res = mConverter->sharpToAddressee( id, mAccess, addressee );
281 addressee.setUid((*it).uid() ); 281 addressee.setUid((*it).uid() );
282 addressee.setTempSyncStat( SYNC_TEMPSTATE_NEW_CSUM ); 282 addressee.setTempSyncStat( SYNC_TEMPSTATE_NEW_CSUM );
283 changedAddressees.append( addressee ); 283 changedAddressees.append( addressee );
284 res = mAccess->finishEditCard(&id); 284 res = mAccess->finishEditCard(&id);
285#endif 285#endif
286 if (res == false) 286 if (res == false)
287 qDebug("Unable to append Contact: %s", addressee.formattedName().latin1()); 287 qDebug("Unable to append Contact: %s", addressee.formattedName().latin1());
288 288
289 } 289 }
290 else 290 else
291 { 291 {
292 qDebug("Unable to convert Addressee: %s", addressee.formattedName().latin1()); 292 qDebug("Unable to convert Addressee: %s", addressee.formattedName().latin1());
293 mAccess->cancelEditCard(); 293 mAccess->cancelEditCard();
294 } 294 }
295 } 295 }
296 } 296 }
297 } 297 }
298 298
299 } 299 }
300 AddresseeMap::Iterator itam; 300 AddresseeMap::Iterator itam;
301 res;
302 for ( res=mAccess->first(); res == true; res=mAccess->next()) 301 for ( res=mAccess->first(); res == true; res=mAccess->next())
303 { 302 {
304 id = mAccess->cardId(); 303 id = mAccess->cardId();
305 int idint = id; 304 int idint = id;
306 itam = map.find( idint ); 305 itam = map.find( idint );
307 if ( itam != map.end() ) { 306 if ( itam != map.end() ) {
308 KABC::Addressee addressee; 307 KABC::Addressee addressee;
309 qDebug("found change %d %s ", idint, itam.data().latin1()); 308 qDebug("found change %d %s ", idint, itam.data().latin1());
310 res = mConverter->sharpToAddressee( id, mAccess, addressee ); 309 res = mConverter->sharpToAddressee( id, mAccess, addressee );
311 310
312 if ( !addressee.isEmpty() && res ) 311 if ( !addressee.isEmpty() && res )
313 { 312 {
314 addressee.setResource( this ); 313 addressee.setResource( this );
315 addressee.setUid( itam.data() ); 314 addressee.setUid( itam.data() );
316 addressee.setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); 315 addressee.setTempSyncStat( SYNC_TEMPSTATE_NEW_ID );
317 addressBook()->insertAddressee( addressee , false ); 316 addressBook()->insertAddressee( addressee , false );
318 } 317 }
319 } 318 }
320 } 319 }
321#if 0 320#if 0
322 KABC::Addressee::List::Iterator it2; 321 KABC::Addressee::List::Iterator it2;
323 for ( it2 = changedAddressees.begin(); it2 != changedAddressees.end(); ++it2 ) { 322 for ( it2 = changedAddressees.begin(); it2 != changedAddressees.end(); ++it2 ) {
324 (*it2).computeCsum( "Sharp_DTM" ); 323 (*it2).computeCsum( "Sharp_DTM" );
325 qDebug("CSUM: %s ",(*it2).getCsum( "Sharp_DTM" ).latin1() ); 324 qDebug("CSUM: %s ",(*it2).getCsum( "Sharp_DTM" ).latin1() );
diff --git a/kabc/plugins/sharpdtm/sharpdtmconverter.cpp b/kabc/plugins/sharpdtm/sharpdtmconverter.cpp
index fccf625..d36df20 100644
--- a/kabc/plugins/sharpdtm/sharpdtmconverter.cpp
+++ b/kabc/plugins/sharpdtm/sharpdtmconverter.cpp
@@ -291,75 +291,77 @@ bool SharpDTMConverter::addresseeToSharp( const Addressee &addr, SlZDataBase* da
291 if ( !addr.familyName().isEmpty() ) { 291 if ( !addr.familyName().isEmpty() ) {
292 formattedName = addr.familyName(); 292 formattedName = addr.familyName();
293 if ( !addr.givenName().isEmpty() ) { 293 if ( !addr.givenName().isEmpty() ) {
294 formattedName += ", "; 294 formattedName += ", ";
295 formattedName += addr.givenName(); 295 formattedName += addr.givenName();
296 } 296 }
297 } else 297 } else
298 formattedName = addr.givenName(); 298 formattedName = addr.givenName();
299 } 299 }
300 database->writeField(ZdbAdrs::FileAs, formattedName); 300 database->writeField(ZdbAdrs::FileAs, formattedName);
301 database->writeField(ZdbAdrs::FullName, formattedName); 301 database->writeField(ZdbAdrs::FullName, formattedName);
302 302
303 // email 303 // email
304 //qDebug("SharpDTMConverter::addresseeToSharp check which seperator we need here for the emails!!"); 304 //qDebug("SharpDTMConverter::addresseeToSharp check which seperator we need here for the emails!!");
305 //qDebug("SharpDTMConverter::addresseeToSharp its probably the same from sharpToAddressee"); 305 //qDebug("SharpDTMConverter::addresseeToSharp its probably the same from sharpToAddressee");
306 QString emails = addr.emails().join(" "); 306 QString emails = addr.emails().join(" ");
307 database->writeField(ZdbAdrs::Emails, emails ); 307 database->writeField(ZdbAdrs::Emails, emails );
308 308
309 database->writeField(ZdbAdrs::DefaultEmail, addr.preferredEmail() ); 309 database->writeField(ZdbAdrs::DefaultEmail, addr.preferredEmail() );
310 310
311 311
312 // home 312 // home
313 const Address homeaddress = addr.address(Address::Home); 313 const Address homeaddress = addr.address(Address::Home);
314 if (!homeaddress.isEmpty()) { 314 if (!homeaddress.isEmpty()) {
315 qDebug("write home address ");
315 database->writeField(ZdbAdrs::HomeStreet, homeaddress.street()); 316 database->writeField(ZdbAdrs::HomeStreet, homeaddress.street());
316 database->writeField(ZdbAdrs::HomeCity, homeaddress.locality()); 317 database->writeField(ZdbAdrs::HomeCity, homeaddress.locality());
317 database->writeField(ZdbAdrs::HomeState, homeaddress.region()); 318 database->writeField(ZdbAdrs::HomeState, homeaddress.region());
318 database->writeField(ZdbAdrs::HomeZip, homeaddress.postalCode()); 319 database->writeField(ZdbAdrs::HomeZip, homeaddress.postalCode());
319 database->writeField(ZdbAdrs::HomeCountry, homeaddress.country()); 320 database->writeField(ZdbAdrs::HomeCountry, homeaddress.country());
320 } 321 }
321 322
322 PhoneNumber homephone = addr.phoneNumber( PhoneNumber::Home ); 323 PhoneNumber homephone = addr.phoneNumber( PhoneNumber::Home );
323 if (!homephone.number().isEmpty()) 324 if (!homephone.number().isEmpty())
324 database->writeField(ZdbAdrs::HomePhone, homephone.number()); 325 database->writeField(ZdbAdrs::HomePhone, homephone.number());
325 326
326 PhoneNumber homefax = addr.phoneNumber( PhoneNumber::Home | PhoneNumber::Fax ); 327 PhoneNumber homefax = addr.phoneNumber( PhoneNumber::Home | PhoneNumber::Fax );
327 if (!homefax.number().isEmpty()) 328 if (!homefax.number().isEmpty())
328 database->writeField(ZdbAdrs::HomeFax, homefax.number()); 329 database->writeField(ZdbAdrs::HomeFax, homefax.number());
329 330
330 PhoneNumber homemobile = addr.phoneNumber( PhoneNumber::Home | PhoneNumber::Cell ); 331 PhoneNumber homemobile = addr.phoneNumber( PhoneNumber::Home | PhoneNumber::Cell );
331 if (!homemobile.number().isEmpty()) { 332 if (!homemobile.number().isEmpty()) {
332 database->writeField(ZdbAdrs::HomeMobile, homemobile.number()); 333 database->writeField(ZdbAdrs::HomeMobile, homemobile.number());
333 cellHome = true; 334 cellHome = true;
334 } 335 }
335 336
336 database->writeField(ZdbAdrs::HomeWebPage, addr.url().url()); 337 database->writeField(ZdbAdrs::HomeWebPage, addr.url().url());
337 338
338 339
339 // business 340 // business
340 const Address businessaddress = addr.address(Address::Work); 341 const Address businessaddress = addr.address(Address::Work);
341 if (!businessaddress.isEmpty()) { 342 if (!businessaddress.isEmpty()) {
343 qDebug("write business address ");
342 database->writeField(ZdbAdrs::BusinessStreet, businessaddress.street()); 344 database->writeField(ZdbAdrs::BusinessStreet, businessaddress.street());
343 database->writeField(ZdbAdrs::BusinessCity, businessaddress.locality()); 345 database->writeField(ZdbAdrs::BusinessCity, businessaddress.locality());
344 database->writeField(ZdbAdrs::BusinessState, businessaddress.region()); 346 database->writeField(ZdbAdrs::BusinessState, businessaddress.region());
345 database->writeField(ZdbAdrs::BusinessZip, businessaddress.postalCode()); 347 database->writeField(ZdbAdrs::BusinessZip, businessaddress.postalCode());
346 database->writeField(ZdbAdrs::BusinessCountry, businessaddress.country()); 348 database->writeField(ZdbAdrs::BusinessCountry, businessaddress.country());
347 } 349 }
348 350
349 PhoneNumber businessphone = addr.phoneNumber( PhoneNumber::Work ); 351 PhoneNumber businessphone = addr.phoneNumber( PhoneNumber::Work );
350 if (!businessphone.number().isEmpty()) 352 if (!businessphone.number().isEmpty())
351 database->writeField(ZdbAdrs::BusinessPhone, businessphone.number()); 353 database->writeField(ZdbAdrs::BusinessPhone, businessphone.number());
352 354
353 PhoneNumber businessfax = addr.phoneNumber( PhoneNumber::Work | PhoneNumber::Fax ); 355 PhoneNumber businessfax = addr.phoneNumber( PhoneNumber::Work | PhoneNumber::Fax );
354 if (!businessfax.number().isEmpty()) 356 if (!businessfax.number().isEmpty())
355 database->writeField(ZdbAdrs::BusinessFax, businessfax.number()); 357 database->writeField(ZdbAdrs::BusinessFax, businessfax.number());
356 358
357 PhoneNumber businessmobile = addr.phoneNumber( PhoneNumber::Work | PhoneNumber::Cell ); 359 PhoneNumber businessmobile = addr.phoneNumber( PhoneNumber::Work | PhoneNumber::Cell );
358 if (!businessmobile.number().isEmpty()) { 360 if (!businessmobile.number().isEmpty()) {
359 cellWork = true; 361 cellWork = true;
360 database->writeField(ZdbAdrs::BusinessMobile, businessmobile.number()); 362 database->writeField(ZdbAdrs::BusinessMobile, businessmobile.number());
361 } 363 }
362 PhoneNumber mobile = addr.phoneNumber( PhoneNumber::Cell ); 364 PhoneNumber mobile = addr.phoneNumber( PhoneNumber::Cell );
363 if (! mobile.number().isEmpty()) { 365 if (! mobile.number().isEmpty()) {
364 if ( ! cellHome ) 366 if ( ! cellHome )
365 database->writeField(ZdbAdrs::HomeMobile, mobile.number()); 367 database->writeField(ZdbAdrs::HomeMobile, mobile.number());