-rw-r--r-- | kabc/addressee.cpp | 1 | ||||
-rw-r--r-- | kabc/plugins/sharpdtm/resourcesharpdtm.cpp | 1 | ||||
-rw-r--r-- | kabc/plugins/sharpdtm/sharpdtmconverter.cpp | 2 |
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 | |||
@@ -267,96 +267,97 @@ void Addressee::computeCsum(const QString &dev) | |||
267 | for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); | 267 | for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); |
268 | ++addressIter ) { | 268 | ++addressIter ) { |
269 | t = (*addressIter).asList(); | 269 | t = (*addressIter).asList(); |
270 | t.sort(); | 270 | t.sort(); |
271 | for ( iii = 0; iii < t.count(); ++iii) | 271 | for ( iii = 0; iii < t.count(); ++iii) |
272 | l.append( t[iii] ); | 272 | l.append( t[iii] ); |
273 | } | 273 | } |
274 | uint cs = getCsum4List(l); | 274 | uint cs = getCsum4List(l); |
275 | // qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); | 275 | // qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); |
276 | setCsum( dev, QString::number (cs )); | 276 | setCsum( dev, QString::number (cs )); |
277 | } | 277 | } |
278 | 278 | ||
279 | void Addressee::mergeContact( const Addressee& ad ) | 279 | void Addressee::mergeContact( const Addressee& ad ) |
280 | { | 280 | { |
281 | 281 | ||
282 | detach(); | 282 | detach(); |
283 | if ( mData->name.isEmpty() ) mData->name = ad.mData->name; | 283 | if ( mData->name.isEmpty() ) mData->name = ad.mData->name; |
284 | if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName; | 284 | if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName; |
285 | if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName; | 285 | if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName; |
286 | if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ; | 286 | if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ; |
287 | if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName; | 287 | if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName; |
288 | if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix; | 288 | if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix; |
289 | if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix; | 289 | if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix; |
290 | if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName; | 290 | if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName; |
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 | ||
317 | void Addressee::removeID(const QString &prof) | 318 | void 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 | } |
323 | void Addressee::setID( const QString & prof , const QString & id ) | 324 | void 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 | } |
329 | void Addressee::setTempSyncStat( int id ) | 330 | void 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 | } |
335 | int Addressee::tempSyncStat() const | 336 | int Addressee::tempSyncStat() const |
336 | { | 337 | { |
337 | return mData->mTempSyncStat; | 338 | return mData->mTempSyncStat; |
338 | } | 339 | } |
339 | 340 | ||
340 | QString Addressee::getID( const QString & prof) | 341 | QString Addressee::getID( const QString & prof) |
341 | { | 342 | { |
342 | return KIdManager::getId ( mData->mExternalId, prof ); | 343 | return KIdManager::getId ( mData->mExternalId, prof ); |
343 | } | 344 | } |
344 | 345 | ||
345 | void Addressee::setCsum( const QString & prof , const QString & id ) | 346 | void Addressee::setCsum( const QString & prof , const QString & id ) |
346 | { | 347 | { |
347 | detach(); | 348 | detach(); |
348 | //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); | 349 | //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); |
349 | mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); | 350 | mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); |
350 | //qDebug("setcsum2 %s ",mData->mExternalId.latin1() ); | 351 | //qDebug("setcsum2 %s ",mData->mExternalId.latin1() ); |
351 | } | 352 | } |
352 | 353 | ||
353 | QString Addressee::getCsum( const QString & prof) | 354 | QString Addressee::getCsum( const QString & prof) |
354 | { | 355 | { |
355 | return KIdManager::getCsum ( mData->mExternalId, prof ); | 356 | return KIdManager::getCsum ( mData->mExternalId, prof ); |
356 | } | 357 | } |
357 | 358 | ||
358 | void Addressee::setIDStr( const QString & s ) | 359 | void Addressee::setIDStr( const QString & s ) |
359 | { | 360 | { |
360 | detach(); | 361 | detach(); |
361 | mData->mExternalId = s; | 362 | mData->mExternalId = s; |
362 | } | 363 | } |
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 | |||
@@ -253,97 +253,96 @@ bool ResourceSharpDTM::save( Ticket *ticket ) | |||
253 | mAccess->cancelEditCard(); | 253 | mAccess->cancelEditCard(); |
254 | } | 254 | } |
255 | } | 255 | } |
256 | 256 | ||
257 | } else if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { | 257 | } else if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { |
258 | res = mAccess->deleteCard(&id); | 258 | res = mAccess->deleteCard(&id); |
259 | if ( res ) | 259 | if ( res ) |
260 | qDebug("delete success "); | 260 | qDebug("delete success "); |
261 | else | 261 | else |
262 | qDebug("delete error "); | 262 | qDebug("delete error "); |
263 | 263 | ||
264 | 264 | ||
265 | } else if ( (*it).tempSyncStat() != SYNC_TEMPSTATE_NEW_EXTERNAL ) { | 265 | } else if ( (*it).tempSyncStat() != SYNC_TEMPSTATE_NEW_EXTERNAL ) { |
266 | //changed | 266 | //changed |
267 | qDebug("changed ****"); | 267 | qDebug("changed ****"); |
268 | res = mAccess->startEditCard(id); | 268 | res = mAccess->startEditCard(id); |
269 | if (res == true) | 269 | if (res == true) |
270 | { | 270 | { |
271 | res = mConverter->addresseeToSharp( (*it), mAccess, id ); | 271 | res = mConverter->addresseeToSharp( (*it), mAccess, id ); |
272 | if (res == true) | 272 | if (res == true) |
273 | { | 273 | { |
274 | res = mAccess->finishEditCard(&id); | 274 | res = mAccess->finishEditCard(&id); |
275 | //(*it).setTempSyncStat( SYNC_TEMPSTATE_NEW_CSUM ); | 275 | //(*it).setTempSyncStat( SYNC_TEMPSTATE_NEW_CSUM ); |
276 | map.insert(id,(*it).uid()); | 276 | map.insert(id,(*it).uid()); |
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() ); |
326 | addressBook()->insertAddressee((*it2)); | 325 | addressBook()->insertAddressee((*it2)); |
327 | } | 326 | } |
328 | #endif | 327 | #endif |
329 | //US mAccess->save(); | 328 | //US mAccess->save(); |
330 | 329 | ||
331 | mDirWatch.startScan(); | 330 | mDirWatch.startScan(); |
332 | delete ticket; | 331 | delete ticket; |
333 | unlock( fileName() ); | 332 | unlock( fileName() ); |
334 | 333 | ||
335 | return true; | 334 | return true; |
336 | } | 335 | } |
337 | 336 | ||
338 | bool ResourceSharpDTM::lock( const QString &lockfileName ) | 337 | bool ResourceSharpDTM::lock( const QString &lockfileName ) |
339 | { | 338 | { |
340 | #ifdef ALLOW_LOCKING | 339 | #ifdef ALLOW_LOCKING |
341 | qDebug("ResourceSharpDTM::lock: %s", fileName().latin1()); | 340 | qDebug("ResourceSharpDTM::lock: %s", fileName().latin1()); |
342 | 341 | ||
343 | kdDebug(5700) << "ResourceSharpDTM::lock()" << endl; | 342 | kdDebug(5700) << "ResourceSharpDTM::lock()" << endl; |
344 | 343 | ||
345 | QString fn = lockfileName; | 344 | QString fn = lockfileName; |
346 | 345 | ||
347 | KURL url(fn); | 346 | KURL url(fn); |
348 | QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" ); | 347 | QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" ); |
349 | 348 | ||
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 | |||
@@ -267,123 +267,125 @@ bool SharpDTMConverter::sharpToAddressee( const CardId &contact, const SlZDataBa | |||
267 | for ( unsigned int i=0; i < catArray.size(); i++ ) { | 267 | for ( unsigned int i=0; i < catArray.size(); i++ ) { |
268 | cat = catDB->label(catArray[i]); | 268 | cat = catDB->label(catArray[i]); |
269 | if ( cat.isEmpty() ) | 269 | if ( cat.isEmpty() ) |
270 | addr.insertCategory(QString::number(catArray[i])); | 270 | addr.insertCategory(QString::number(catArray[i])); |
271 | else | 271 | else |
272 | addr.insertCategory( cat ); | 272 | addr.insertCategory( cat ); |
273 | } | 273 | } |
274 | 274 | ||
275 | return true; | 275 | return true; |
276 | } | 276 | } |
277 | 277 | ||
278 | bool SharpDTMConverter::addresseeToSharp( const Addressee &addr, SlZDataBase* database , const CardId &contact ) | 278 | bool SharpDTMConverter::addresseeToSharp( const Addressee &addr, SlZDataBase* database , const CardId &contact ) |
279 | { | 279 | { |
280 | bool cellHome = false, cellWork = false; | 280 | bool cellHome = false, cellWork = false; |
281 | // name | 281 | // name |
282 | database->writeField(ZdbAdrs::LastName, addr.familyName()); | 282 | database->writeField(ZdbAdrs::LastName, addr.familyName()); |
283 | database->writeField(ZdbAdrs::FirstName, addr.givenName()); | 283 | database->writeField(ZdbAdrs::FirstName, addr.givenName()); |
284 | database->writeField(ZdbAdrs::MiddleName, addr.additionalName()); | 284 | database->writeField(ZdbAdrs::MiddleName, addr.additionalName()); |
285 | database->writeField(ZdbAdrs::Title, addr.prefix()); | 285 | database->writeField(ZdbAdrs::Title, addr.prefix()); |
286 | database->writeField(ZdbAdrs::Suffix, addr.suffix()); | 286 | database->writeField(ZdbAdrs::Suffix, addr.suffix()); |
287 | 287 | ||
288 | //qDebug("SharpDTMConverter::addresseeToSharp check if the fileAs transformation works!!\n%s",addr.formattedName().latin1() ); | 288 | //qDebug("SharpDTMConverter::addresseeToSharp check if the fileAs transformation works!!\n%s",addr.formattedName().latin1() ); |
289 | QString formattedName = addr.formattedName(); | 289 | QString formattedName = addr.formattedName(); |
290 | if ( formattedName.isEmpty() ) { | 290 | if ( formattedName.isEmpty() ) { |
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 | 303 | ||
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()); |
366 | else if (! cellWork ) | 368 | else if (! cellWork ) |
367 | database->writeField(ZdbAdrs::BusinessMobile, mobile.number()); | 369 | database->writeField(ZdbAdrs::BusinessMobile, mobile.number()); |
368 | } | 370 | } |
369 | 371 | ||
370 | PhoneNumber businesspager = addr.phoneNumber( PhoneNumber::Work | PhoneNumber::Pager ); | 372 | PhoneNumber businesspager = addr.phoneNumber( PhoneNumber::Work | PhoneNumber::Pager ); |
371 | if (!businesspager.number().isEmpty()) | 373 | if (!businesspager.number().isEmpty()) |
372 | database->writeField(ZdbAdrs::BusinessPager, businesspager.number()); | 374 | database->writeField(ZdbAdrs::BusinessPager, businesspager.number()); |
373 | 375 | ||
374 | database->writeField(ZdbAdrs::JobTitle, addr.role()); | 376 | database->writeField(ZdbAdrs::JobTitle, addr.role()); |
375 | database->writeField(ZdbAdrs::Company, addr.organization()); | 377 | database->writeField(ZdbAdrs::Company, addr.organization()); |
376 | 378 | ||
377 | database->writeField(ZdbAdrs::Profession, addr.custom( "KADDRESSBOOK", "X-Profession" )); | 379 | database->writeField(ZdbAdrs::Profession, addr.custom( "KADDRESSBOOK", "X-Profession" )); |
378 | database->writeField(ZdbAdrs::Assistant, addr.custom( "KADDRESSBOOK", "X-AssistantsName" )); | 380 | database->writeField(ZdbAdrs::Assistant, addr.custom( "KADDRESSBOOK", "X-AssistantsName" )); |
379 | database->writeField(ZdbAdrs::Department, addr.custom( "KADDRESSBOOK", "X-Department" )); | 381 | database->writeField(ZdbAdrs::Department, addr.custom( "KADDRESSBOOK", "X-Department" )); |
380 | database->writeField(ZdbAdrs::Manager, addr.custom( "KADDRESSBOOK", "X-ManagersName" )); | 382 | database->writeField(ZdbAdrs::Manager, addr.custom( "KADDRESSBOOK", "X-ManagersName" )); |
381 | database->writeField(ZdbAdrs::Office, addr.custom( "KADDRESSBOOK", "X-Office" )); | 383 | database->writeField(ZdbAdrs::Office, addr.custom( "KADDRESSBOOK", "X-Office" )); |
382 | 384 | ||
383 | //personal | 385 | //personal |
384 | database->writeField(ZdbAdrs::Spouse, addr.custom( "KADDRESSBOOK", "X-Spouse" )); | 386 | database->writeField(ZdbAdrs::Spouse, addr.custom( "KADDRESSBOOK", "X-Spouse" )); |
385 | 387 | ||
386 | QString gt = addr.custom( "KADDRESSBOOK", "X-Gender" ); | 388 | QString gt = addr.custom( "KADDRESSBOOK", "X-Gender" ); |
387 | //qDebug("SharpDTMConverter::addresseeToSharp please check that gender works!! : Gender: %s", gt.latin1()); | 389 | //qDebug("SharpDTMConverter::addresseeToSharp please check that gender works!! : Gender: %s", gt.latin1()); |
388 | //qDebug("SharpDTMConverter::addresseeToSharp: may be writeField(\"ZdbAdrs::Gender\", ushort) is here better suited?"); | 390 | //qDebug("SharpDTMConverter::addresseeToSharp: may be writeField(\"ZdbAdrs::Gender\", ushort) is here better suited?"); |
389 | //qDebug("SharpDTMConverter::addresseeToSharp: check also the reverse functionality in sharpToAddressee"); | 391 | //qDebug("SharpDTMConverter::addresseeToSharp: check also the reverse functionality in sharpToAddressee"); |