author | zecke <zecke> | 2003-02-16 22:25:46 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-02-16 22:25:46 (UTC) |
commit | 4d0e8ffd8518fe24ed94cfcf92eeff666b014094 (patch) (unidiff) | |
tree | 86a0bec752418c409cbc9ad95d6479997dfaf909 | |
parent | 8ecc375c803dc57b160bd0335891fcaf4f6de1df (diff) | |
download | opie-4d0e8ffd8518fe24ed94cfcf92eeff666b014094.zip opie-4d0e8ffd8518fe24ed94cfcf92eeff666b014094.tar.gz opie-4d0e8ffd8518fe24ed94cfcf92eeff666b014094.tar.bz2 |
0000276 Fix for that bug.. or better temp workaround
A Preferred Number is HOME|VOICE
A CellPhone is HOME|VOICE|CELL the type & HOME|VOICE test
triggers both
and the cell phone number overrides the other entries..
as a temp I check that it's not equal to HOME|VOICE|CELL before setting the
number
The right and final fix would be to reorder the if statement to make it
if else based and the less common thing put to the bottom
OTodoAccessVcal fix the date for beaming
-rw-r--r-- | libopie/pim/ocontactaccessbackend_vcard.cpp | 82 | ||||
-rw-r--r-- | libopie/pim/otodoaccessvcal.cpp | 7 | ||||
-rw-r--r-- | libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp | 82 | ||||
-rw-r--r-- | libopie2/opiepim/backend/otodoaccessvcal.cpp | 7 |
4 files changed, 108 insertions, 70 deletions
diff --git a/libopie/pim/ocontactaccessbackend_vcard.cpp b/libopie/pim/ocontactaccessbackend_vcard.cpp index 1dc6b48..622d40a 100644 --- a/libopie/pim/ocontactaccessbackend_vcard.cpp +++ b/libopie/pim/ocontactaccessbackend_vcard.cpp | |||
@@ -17,6 +17,21 @@ | |||
17 | * ===================================================================== | 17 | * ===================================================================== |
18 | * History: | 18 | * History: |
19 | * $Log$ | 19 | * $Log$ |
20 | * Revision 1.7 2003/02/16 22:25:46 zecke | ||
21 | * 0000276 Fix for that bug.. or better temp workaround | ||
22 | * A Preferred Number is HOME|VOICE | ||
23 | * A CellPhone is HOME|VOICE|CELL the type & HOME|VOICE test | ||
24 | * triggers both | ||
25 | * and the cell phone number overrides the other entries.. | ||
26 | * | ||
27 | * as a temp I check that it's not equal to HOME|VOICE|CELL before setting the | ||
28 | * number | ||
29 | * | ||
30 | * The right and final fix would be to reorder the if statement to make it | ||
31 | * if else based and the less common thing put to the bottom | ||
32 | * | ||
33 | * OTodoAccessVcal fix the date for beaming | ||
34 | * | ||
20 | * Revision 1.6 2003/01/13 15:49:31 eilers | 35 | * Revision 1.6 2003/01/13 15:49:31 eilers |
21 | * Fixing crash when businesscard.vcf is missing.. | 36 | * Fixing crash when businesscard.vcf is missing.. |
22 | * | 37 | * |
@@ -53,10 +68,10 @@ OContactAccessBackend_VCard::OContactAccessBackend_VCard ( QString , QString fil | |||
53 | 68 | ||
54 | 69 | ||
55 | bool OContactAccessBackend_VCard::load () | 70 | bool OContactAccessBackend_VCard::load () |
56 | { | 71 | { |
57 | m_map.clear(); | 72 | m_map.clear(); |
58 | m_dirty = false; | 73 | m_dirty = false; |
59 | 74 | ||
60 | VObject* obj = 0l; | 75 | VObject* obj = 0l; |
61 | 76 | ||
62 | if ( QFile( m_file ).exists() ){ | 77 | if ( QFile( m_file ).exists() ){ |
@@ -81,7 +96,7 @@ bool OContactAccessBackend_VCard::load () | |||
81 | } | 96 | } |
82 | 97 | ||
83 | m_map.insert( con.uid(), con ); | 98 | m_map.insert( con.uid(), con ); |
84 | 99 | ||
85 | VObject *t = obj; | 100 | VObject *t = obj; |
86 | obj = nextVObjectInList(obj); | 101 | obj = nextVObjectInList(obj); |
87 | cleanVObject( t ); | 102 | cleanVObject( t ); |
@@ -95,7 +110,7 @@ bool OContactAccessBackend_VCard::reload() | |||
95 | return load(); | 110 | return load(); |
96 | } | 111 | } |
97 | bool OContactAccessBackend_VCard::save() | 112 | bool OContactAccessBackend_VCard::save() |
98 | { | 113 | { |
99 | if (!m_dirty ) | 114 | if (!m_dirty ) |
100 | return true; | 115 | return true; |
101 | 116 | ||
@@ -117,7 +132,7 @@ bool OContactAccessBackend_VCard::save() | |||
117 | 132 | ||
118 | m_dirty = false; | 133 | m_dirty = false; |
119 | return true; | 134 | return true; |
120 | 135 | ||
121 | 136 | ||
122 | } | 137 | } |
123 | void OContactAccessBackend_VCard::clear () | 138 | void OContactAccessBackend_VCard::clear () |
@@ -137,7 +152,7 @@ bool OContactAccessBackend_VCard::remove ( int uid ) | |||
137 | { | 152 | { |
138 | m_map.remove( uid ); | 153 | m_map.remove( uid ); |
139 | m_dirty = true; | 154 | m_dirty = true; |
140 | return true; | 155 | return true; |
141 | } | 156 | } |
142 | 157 | ||
143 | bool OContactAccessBackend_VCard::replace ( const OContact &contact ) | 158 | bool OContactAccessBackend_VCard::replace ( const OContact &contact ) |
@@ -146,7 +161,7 @@ bool OContactAccessBackend_VCard::replace ( const OContact &contact ) | |||
146 | m_dirty = true; | 161 | m_dirty = true; |
147 | return true; | 162 | return true; |
148 | } | 163 | } |
149 | 164 | ||
150 | OContact OContactAccessBackend_VCard::find ( int uid ) const | 165 | OContact OContactAccessBackend_VCard::find ( int uid ) const |
151 | { | 166 | { |
152 | return m_map[uid]; | 167 | return m_map[uid]; |
@@ -206,7 +221,7 @@ QArray<int> OContactAccessBackend_VCard::sorted( bool , int, int, int ) | |||
206 | OContact OContactAccessBackend_VCard::parseVObject( VObject *obj ) | 221 | OContact OContactAccessBackend_VCard::parseVObject( VObject *obj ) |
207 | { | 222 | { |
208 | OContact c; | 223 | OContact c; |
209 | 224 | ||
210 | VObjectIterator it; | 225 | VObjectIterator it; |
211 | initPropIterator( &it, obj ); | 226 | initPropIterator( &it, obj ); |
212 | while( moreIteration( &it ) ) { | 227 | while( moreIteration( &it ) ) { |
@@ -239,7 +254,7 @@ OContact OContactAccessBackend_VCard::parseVObject( VObject *obj ) | |||
239 | QString region; | 254 | QString region; |
240 | QString postal; | 255 | QString postal; |
241 | QString country; | 256 | QString country; |
242 | 257 | ||
243 | VObjectIterator nit; | 258 | VObjectIterator nit; |
244 | initPropIterator( &nit, o ); | 259 | initPropIterator( &nit, o ); |
245 | while( moreIteration( &nit ) ) { | 260 | while( moreIteration( &nit ) ) { |
@@ -286,7 +301,7 @@ OContact OContactAccessBackend_VCard::parseVObject( VObject *obj ) | |||
286 | UNKNOWN = 0x80 | 301 | UNKNOWN = 0x80 |
287 | }; | 302 | }; |
288 | int type = 0; | 303 | int type = 0; |
289 | 304 | ||
290 | VObjectIterator nit; | 305 | VObjectIterator nit; |
291 | initPropIterator( &nit, o ); | 306 | initPropIterator( &nit, o ); |
292 | while( moreIteration( &nit ) ) { | 307 | while( moreIteration( &nit ) ) { |
@@ -314,14 +329,15 @@ OContact OContactAccessBackend_VCard::parseVObject( VObject *obj ) | |||
314 | type |= HOME; | 329 | type |= HOME; |
315 | if ( ( type & (VOICE|CELL|FAX|PAGER) ) == 0 ) // default | 330 | if ( ( type & (VOICE|CELL|FAX|PAGER) ) == 0 ) // default |
316 | type |= VOICE; | 331 | type |= VOICE; |
317 | 332 | ||
318 | if ( (type & (VOICE|HOME) ) == (VOICE|HOME) ) | 333 | qWarning("value %s %d", value.data(), type ); |
334 | if ( (type & (VOICE|HOME) ) == (VOICE|HOME) && (type & (CELL|HOME) ) != (CELL|HOME) ) | ||
319 | c.setHomePhone( value ); | 335 | c.setHomePhone( value ); |
320 | if ( ( type & (FAX|HOME) ) == (FAX|HOME) ) | 336 | if ( ( type & (FAX|HOME) ) == (FAX|HOME) ) |
321 | c.setHomeFax( value ); | 337 | c.setHomeFax( value ); |
322 | if ( ( type & (CELL|HOME) ) == (CELL|HOME) ) | 338 | if ( ( type & (CELL|HOME) ) == (CELL|HOME) ) |
323 | c.setHomeMobile( value ); | 339 | c.setHomeMobile( value ); |
324 | if ( ( type & (VOICE|WORK) ) == (VOICE|WORK) ) | 340 | if ( ( type & (VOICE|WORK) ) == (VOICE|WORK) && (type & (CELL|WORK) ) != (CELL|WORK) ) |
325 | c.setBusinessPhone( value ); | 341 | c.setBusinessPhone( value ); |
326 | if ( ( type & (FAX|WORK) ) == (FAX|WORK) ) | 342 | if ( ( type & (FAX|WORK) ) == (FAX|WORK) ) |
327 | c.setBusinessFax( value ); | 343 | c.setBusinessFax( value ); |
@@ -406,9 +422,9 @@ OContact OContactAccessBackend_VCard::parseVObject( VObject *obj ) | |||
406 | else if ( name == VCBirthDateProp ) { | 422 | else if ( name == VCBirthDateProp ) { |
407 | // Reading Birthdate regarding RFC 2425 (5.8.4) | 423 | // Reading Birthdate regarding RFC 2425 (5.8.4) |
408 | c.setBirthday( convVCardDateToDate( value ) ); | 424 | c.setBirthday( convVCardDateToDate( value ) ); |
409 | 425 | ||
410 | } | 426 | } |
411 | 427 | ||
412 | #if 0 | 428 | #if 0 |
413 | else { | 429 | else { |
414 | printf("Name: %s, value=%s\n", name.data(), vObjectStringZValue( o ) ); | 430 | printf("Name: %s, value=%s\n", name.data(), vObjectStringZValue( o ) ); |
@@ -434,10 +450,10 @@ VObject* OContactAccessBackend_VCard::createVObject( const OContact &c ) | |||
434 | safeAddPropValue( vcard, VCVersionProp, "2.1" ); | 450 | safeAddPropValue( vcard, VCVersionProp, "2.1" ); |
435 | safeAddPropValue( vcard, VCLastRevisedProp, TimeConversion::toISO8601( QDateTime::currentDateTime() ) ); | 451 | safeAddPropValue( vcard, VCLastRevisedProp, TimeConversion::toISO8601( QDateTime::currentDateTime() ) ); |
436 | safeAddPropValue( vcard, VCUniqueStringProp, QString::number(c.uid()) ); | 452 | safeAddPropValue( vcard, VCUniqueStringProp, QString::number(c.uid()) ); |
437 | 453 | ||
438 | // full name | 454 | // full name |
439 | safeAddPropValue( vcard, VCFullNameProp, c.fullName() ); | 455 | safeAddPropValue( vcard, VCFullNameProp, c.fullName() ); |
440 | 456 | ||
441 | // name properties | 457 | // name properties |
442 | VObject *name = safeAddProp( vcard, VCNameProp ); | 458 | VObject *name = safeAddProp( vcard, VCNameProp ); |
443 | safeAddPropValue( name, VCFamilyNameProp, c.lastName() ); | 459 | safeAddPropValue( name, VCFamilyNameProp, c.lastName() ); |
@@ -445,7 +461,7 @@ VObject* OContactAccessBackend_VCard::createVObject( const OContact &c ) | |||
445 | safeAddPropValue( name, VCAdditionalNamesProp, c.middleName() ); | 461 | safeAddPropValue( name, VCAdditionalNamesProp, c.middleName() ); |
446 | safeAddPropValue( name, VCNamePrefixesProp, c.title() ); | 462 | safeAddPropValue( name, VCNamePrefixesProp, c.title() ); |
447 | safeAddPropValue( name, VCNameSuffixesProp, c.suffix() ); | 463 | safeAddPropValue( name, VCNameSuffixesProp, c.suffix() ); |
448 | 464 | ||
449 | // home properties | 465 | // home properties |
450 | VObject *home_adr= safeAddProp( vcard, VCAdrProp ); | 466 | VObject *home_adr= safeAddProp( vcard, VCAdrProp ); |
451 | safeAddProp( home_adr, VCHomeProp ); | 467 | safeAddProp( home_adr, VCHomeProp ); |
@@ -454,7 +470,7 @@ VObject* OContactAccessBackend_VCard::createVObject( const OContact &c ) | |||
454 | safeAddPropValue( home_adr, VCRegionProp, c.homeState() ); | 470 | safeAddPropValue( home_adr, VCRegionProp, c.homeState() ); |
455 | safeAddPropValue( home_adr, VCPostalCodeProp, c.homeZip() ); | 471 | safeAddPropValue( home_adr, VCPostalCodeProp, c.homeZip() ); |
456 | safeAddPropValue( home_adr, VCCountryNameProp, c.homeCountry() ); | 472 | safeAddPropValue( home_adr, VCCountryNameProp, c.homeCountry() ); |
457 | 473 | ||
458 | VObject *home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homePhone() ); | 474 | VObject *home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homePhone() ); |
459 | safeAddProp( home_phone, VCHomeProp ); | 475 | safeAddProp( home_phone, VCHomeProp ); |
460 | home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homeMobile() ); | 476 | home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homeMobile() ); |
@@ -463,10 +479,10 @@ VObject* OContactAccessBackend_VCard::createVObject( const OContact &c ) | |||
463 | home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homeFax() ); | 479 | home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homeFax() ); |
464 | safeAddProp( home_phone, VCHomeProp ); | 480 | safeAddProp( home_phone, VCHomeProp ); |
465 | safeAddProp( home_phone, VCFaxProp ); | 481 | safeAddProp( home_phone, VCFaxProp ); |
466 | 482 | ||
467 | VObject *url = safeAddPropValue( vcard, VCURLProp, c.homeWebpage() ); | 483 | VObject *url = safeAddPropValue( vcard, VCURLProp, c.homeWebpage() ); |
468 | safeAddProp( url, VCHomeProp ); | 484 | safeAddProp( url, VCHomeProp ); |
469 | 485 | ||
470 | // work properties | 486 | // work properties |
471 | VObject *work_adr= safeAddProp( vcard, VCAdrProp ); | 487 | VObject *work_adr= safeAddProp( vcard, VCAdrProp ); |
472 | safeAddProp( work_adr, VCWorkProp ); | 488 | safeAddProp( work_adr, VCWorkProp ); |
@@ -475,7 +491,7 @@ VObject* OContactAccessBackend_VCard::createVObject( const OContact &c ) | |||
475 | safeAddPropValue( work_adr, VCRegionProp, c.businessState() ); | 491 | safeAddPropValue( work_adr, VCRegionProp, c.businessState() ); |
476 | safeAddPropValue( work_adr, VCPostalCodeProp, c.businessZip() ); | 492 | safeAddPropValue( work_adr, VCPostalCodeProp, c.businessZip() ); |
477 | safeAddPropValue( work_adr, VCCountryNameProp, c.businessCountry() ); | 493 | safeAddPropValue( work_adr, VCCountryNameProp, c.businessCountry() ); |
478 | 494 | ||
479 | VObject *work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPhone() ); | 495 | VObject *work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPhone() ); |
480 | safeAddProp( work_phone, VCWorkProp ); | 496 | safeAddProp( work_phone, VCWorkProp ); |
481 | work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessMobile() ); | 497 | work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessMobile() ); |
@@ -487,41 +503,41 @@ VObject* OContactAccessBackend_VCard::createVObject( const OContact &c ) | |||
487 | work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPager() ); | 503 | work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPager() ); |
488 | safeAddProp( work_phone, VCWorkProp ); | 504 | safeAddProp( work_phone, VCWorkProp ); |
489 | safeAddProp( work_phone, VCPagerProp ); | 505 | safeAddProp( work_phone, VCPagerProp ); |
490 | 506 | ||
491 | url = safeAddPropValue( vcard, VCURLProp, c.businessWebpage() ); | 507 | url = safeAddPropValue( vcard, VCURLProp, c.businessWebpage() ); |
492 | safeAddProp( url, VCWorkProp ); | 508 | safeAddProp( url, VCWorkProp ); |
493 | 509 | ||
494 | VObject *title = safeAddPropValue( vcard, VCTitleProp, c.jobTitle() ); | 510 | VObject *title = safeAddPropValue( vcard, VCTitleProp, c.jobTitle() ); |
495 | safeAddProp( title, VCWorkProp ); | 511 | safeAddProp( title, VCWorkProp ); |
496 | 512 | ||
497 | 513 | ||
498 | QStringList emails = c.emailList(); | 514 | QStringList emails = c.emailList(); |
499 | emails.prepend( c.defaultEmail() ); | 515 | emails.prepend( c.defaultEmail() ); |
500 | for( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) { | 516 | for( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) { |
501 | VObject *email = safeAddPropValue( vcard, VCEmailAddressProp, *it ); | 517 | VObject *email = safeAddPropValue( vcard, VCEmailAddressProp, *it ); |
502 | safeAddProp( email, VCInternetProp ); | 518 | safeAddProp( email, VCInternetProp ); |
503 | } | 519 | } |
504 | 520 | ||
505 | safeAddPropValue( vcard, VCNoteProp, c.notes() ); | 521 | safeAddPropValue( vcard, VCNoteProp, c.notes() ); |
506 | 522 | ||
507 | // Exporting Birthday regarding RFC 2425 (5.8.4) | 523 | // Exporting Birthday regarding RFC 2425 (5.8.4) |
508 | if ( c.birthday().isValid() ){ | 524 | if ( c.birthday().isValid() ){ |
509 | qWarning("Exporting birthday as: %s", convDateToVCardDate( c.birthday() ).latin1() ); | 525 | qWarning("Exporting birthday as: %s", convDateToVCardDate( c.birthday() ).latin1() ); |
510 | safeAddPropValue( vcard, VCBirthDateProp, convDateToVCardDate( c.birthday() ) ); | 526 | safeAddPropValue( vcard, VCBirthDateProp, convDateToVCardDate( c.birthday() ) ); |
511 | } | 527 | } |
512 | 528 | ||
513 | if ( !c.company().isEmpty() || !c.department().isEmpty() || !c.office().isEmpty() ) { | 529 | if ( !c.company().isEmpty() || !c.department().isEmpty() || !c.office().isEmpty() ) { |
514 | VObject *org = safeAddProp( vcard, VCOrgProp ); | 530 | VObject *org = safeAddProp( vcard, VCOrgProp ); |
515 | safeAddPropValue( org, VCOrgNameProp, c.company() ); | 531 | safeAddPropValue( org, VCOrgNameProp, c.company() ); |
516 | safeAddPropValue( org, VCOrgUnitProp, c.department() ); | 532 | safeAddPropValue( org, VCOrgUnitProp, c.department() ); |
517 | safeAddPropValue( org, VCOrgUnit2Prop, c.office() ); | 533 | safeAddPropValue( org, VCOrgUnit2Prop, c.office() ); |
518 | } | 534 | } |
519 | 535 | ||
520 | // some values we have to export as custom fields | 536 | // some values we have to export as custom fields |
521 | safeAddPropValue( vcard, "X-Qtopia-Profession", c.profession() ); | 537 | safeAddPropValue( vcard, "X-Qtopia-Profession", c.profession() ); |
522 | safeAddPropValue( vcard, "X-Qtopia-Manager", c.manager() ); | 538 | safeAddPropValue( vcard, "X-Qtopia-Manager", c.manager() ); |
523 | safeAddPropValue( vcard, "X-Qtopia-Assistant", c.assistant() ); | 539 | safeAddPropValue( vcard, "X-Qtopia-Assistant", c.assistant() ); |
524 | 540 | ||
525 | safeAddPropValue( vcard, "X-Qtopia-Spouse", c.spouse() ); | 541 | safeAddPropValue( vcard, "X-Qtopia-Spouse", c.spouse() ); |
526 | safeAddPropValue( vcard, "X-Qtopia-Gender", c.gender() ); | 542 | safeAddPropValue( vcard, "X-Qtopia-Gender", c.gender() ); |
527 | if ( c.anniversary().isValid() ){ | 543 | if ( c.anniversary().isValid() ){ |
@@ -530,7 +546,7 @@ VObject* OContactAccessBackend_VCard::createVObject( const OContact &c ) | |||
530 | } | 546 | } |
531 | safeAddPropValue( vcard, "X-Qtopia-Nickname", c.nickname() ); | 547 | safeAddPropValue( vcard, "X-Qtopia-Nickname", c.nickname() ); |
532 | safeAddPropValue( vcard, "X-Qtopia-Children", c.children() ); | 548 | safeAddPropValue( vcard, "X-Qtopia-Children", c.children() ); |
533 | 549 | ||
534 | return vcard; | 550 | return vcard; |
535 | } | 551 | } |
536 | 552 | ||
@@ -544,7 +560,7 @@ QString OContactAccessBackend_VCard::convDateToVCardDate( const QDate& d ) const | |||
544 | int pos = 0; | 560 | int pos = 0; |
545 | while ( ( pos = str_rfc2425.find (' ') ) > 0 ) | 561 | while ( ( pos = str_rfc2425.find (' ') ) > 0 ) |
546 | str_rfc2425.replace( pos, 1, "0" ); | 562 | str_rfc2425.replace( pos, 1, "0" ); |
547 | 563 | ||
548 | return str_rfc2425; | 564 | return str_rfc2425; |
549 | } | 565 | } |
550 | 566 | ||
diff --git a/libopie/pim/otodoaccessvcal.cpp b/libopie/pim/otodoaccessvcal.cpp index e96cc3c..309f9e1 100644 --- a/libopie/pim/otodoaccessvcal.cpp +++ b/libopie/pim/otodoaccessvcal.cpp | |||
@@ -58,9 +58,12 @@ namespace { | |||
58 | if( task == 0 ) | 58 | if( task == 0 ) |
59 | return 0l; | 59 | return 0l; |
60 | 60 | ||
61 | if( event.hasDueDate() ) | 61 | if( event.hasDueDate() ) { |
62 | QTime time(0, 0, 0); | ||
63 | QDateTime date(event.dueDate(), time ); | ||
62 | addPropValue( task, VCDueProp, | 64 | addPropValue( task, VCDueProp, |
63 | TimeConversion::toISO8601( event.dueDate() ) ); | 65 | TimeConversion::toISO8601( date ) ); |
66 | } | ||
64 | 67 | ||
65 | if( event.isCompleted() ) | 68 | if( event.isCompleted() ) |
66 | addPropValue( task, VCStatusProp, "COMPLETED"); | 69 | addPropValue( task, VCStatusProp, "COMPLETED"); |
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp index 1dc6b48..622d40a 100644 --- a/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp +++ b/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp | |||
@@ -17,6 +17,21 @@ | |||
17 | * ===================================================================== | 17 | * ===================================================================== |
18 | * History: | 18 | * History: |
19 | * $Log$ | 19 | * $Log$ |
20 | * Revision 1.7 2003/02/16 22:25:46 zecke | ||
21 | * 0000276 Fix for that bug.. or better temp workaround | ||
22 | * A Preferred Number is HOME|VOICE | ||
23 | * A CellPhone is HOME|VOICE|CELL the type & HOME|VOICE test | ||
24 | * triggers both | ||
25 | * and the cell phone number overrides the other entries.. | ||
26 | * | ||
27 | * as a temp I check that it's not equal to HOME|VOICE|CELL before setting the | ||
28 | * number | ||
29 | * | ||
30 | * The right and final fix would be to reorder the if statement to make it | ||
31 | * if else based and the less common thing put to the bottom | ||
32 | * | ||
33 | * OTodoAccessVcal fix the date for beaming | ||
34 | * | ||
20 | * Revision 1.6 2003/01/13 15:49:31 eilers | 35 | * Revision 1.6 2003/01/13 15:49:31 eilers |
21 | * Fixing crash when businesscard.vcf is missing.. | 36 | * Fixing crash when businesscard.vcf is missing.. |
22 | * | 37 | * |
@@ -53,10 +68,10 @@ OContactAccessBackend_VCard::OContactAccessBackend_VCard ( QString , QString fil | |||
53 | 68 | ||
54 | 69 | ||
55 | bool OContactAccessBackend_VCard::load () | 70 | bool OContactAccessBackend_VCard::load () |
56 | { | 71 | { |
57 | m_map.clear(); | 72 | m_map.clear(); |
58 | m_dirty = false; | 73 | m_dirty = false; |
59 | 74 | ||
60 | VObject* obj = 0l; | 75 | VObject* obj = 0l; |
61 | 76 | ||
62 | if ( QFile( m_file ).exists() ){ | 77 | if ( QFile( m_file ).exists() ){ |
@@ -81,7 +96,7 @@ bool OContactAccessBackend_VCard::load () | |||
81 | } | 96 | } |
82 | 97 | ||
83 | m_map.insert( con.uid(), con ); | 98 | m_map.insert( con.uid(), con ); |
84 | 99 | ||
85 | VObject *t = obj; | 100 | VObject *t = obj; |
86 | obj = nextVObjectInList(obj); | 101 | obj = nextVObjectInList(obj); |
87 | cleanVObject( t ); | 102 | cleanVObject( t ); |
@@ -95,7 +110,7 @@ bool OContactAccessBackend_VCard::reload() | |||
95 | return load(); | 110 | return load(); |
96 | } | 111 | } |
97 | bool OContactAccessBackend_VCard::save() | 112 | bool OContactAccessBackend_VCard::save() |
98 | { | 113 | { |
99 | if (!m_dirty ) | 114 | if (!m_dirty ) |
100 | return true; | 115 | return true; |
101 | 116 | ||
@@ -117,7 +132,7 @@ bool OContactAccessBackend_VCard::save() | |||
117 | 132 | ||
118 | m_dirty = false; | 133 | m_dirty = false; |
119 | return true; | 134 | return true; |
120 | 135 | ||
121 | 136 | ||
122 | } | 137 | } |
123 | void OContactAccessBackend_VCard::clear () | 138 | void OContactAccessBackend_VCard::clear () |
@@ -137,7 +152,7 @@ bool OContactAccessBackend_VCard::remove ( int uid ) | |||
137 | { | 152 | { |
138 | m_map.remove( uid ); | 153 | m_map.remove( uid ); |
139 | m_dirty = true; | 154 | m_dirty = true; |
140 | return true; | 155 | return true; |
141 | } | 156 | } |
142 | 157 | ||
143 | bool OContactAccessBackend_VCard::replace ( const OContact &contact ) | 158 | bool OContactAccessBackend_VCard::replace ( const OContact &contact ) |
@@ -146,7 +161,7 @@ bool OContactAccessBackend_VCard::replace ( const OContact &contact ) | |||
146 | m_dirty = true; | 161 | m_dirty = true; |
147 | return true; | 162 | return true; |
148 | } | 163 | } |
149 | 164 | ||
150 | OContact OContactAccessBackend_VCard::find ( int uid ) const | 165 | OContact OContactAccessBackend_VCard::find ( int uid ) const |
151 | { | 166 | { |
152 | return m_map[uid]; | 167 | return m_map[uid]; |
@@ -206,7 +221,7 @@ QArray<int> OContactAccessBackend_VCard::sorted( bool , int, int, int ) | |||
206 | OContact OContactAccessBackend_VCard::parseVObject( VObject *obj ) | 221 | OContact OContactAccessBackend_VCard::parseVObject( VObject *obj ) |
207 | { | 222 | { |
208 | OContact c; | 223 | OContact c; |
209 | 224 | ||
210 | VObjectIterator it; | 225 | VObjectIterator it; |
211 | initPropIterator( &it, obj ); | 226 | initPropIterator( &it, obj ); |
212 | while( moreIteration( &it ) ) { | 227 | while( moreIteration( &it ) ) { |
@@ -239,7 +254,7 @@ OContact OContactAccessBackend_VCard::parseVObject( VObject *obj ) | |||
239 | QString region; | 254 | QString region; |
240 | QString postal; | 255 | QString postal; |
241 | QString country; | 256 | QString country; |
242 | 257 | ||
243 | VObjectIterator nit; | 258 | VObjectIterator nit; |
244 | initPropIterator( &nit, o ); | 259 | initPropIterator( &nit, o ); |
245 | while( moreIteration( &nit ) ) { | 260 | while( moreIteration( &nit ) ) { |
@@ -286,7 +301,7 @@ OContact OContactAccessBackend_VCard::parseVObject( VObject *obj ) | |||
286 | UNKNOWN = 0x80 | 301 | UNKNOWN = 0x80 |
287 | }; | 302 | }; |
288 | int type = 0; | 303 | int type = 0; |
289 | 304 | ||
290 | VObjectIterator nit; | 305 | VObjectIterator nit; |
291 | initPropIterator( &nit, o ); | 306 | initPropIterator( &nit, o ); |
292 | while( moreIteration( &nit ) ) { | 307 | while( moreIteration( &nit ) ) { |
@@ -314,14 +329,15 @@ OContact OContactAccessBackend_VCard::parseVObject( VObject *obj ) | |||
314 | type |= HOME; | 329 | type |= HOME; |
315 | if ( ( type & (VOICE|CELL|FAX|PAGER) ) == 0 ) // default | 330 | if ( ( type & (VOICE|CELL|FAX|PAGER) ) == 0 ) // default |
316 | type |= VOICE; | 331 | type |= VOICE; |
317 | 332 | ||
318 | if ( (type & (VOICE|HOME) ) == (VOICE|HOME) ) | 333 | qWarning("value %s %d", value.data(), type ); |
334 | if ( (type & (VOICE|HOME) ) == (VOICE|HOME) && (type & (CELL|HOME) ) != (CELL|HOME) ) | ||
319 | c.setHomePhone( value ); | 335 | c.setHomePhone( value ); |
320 | if ( ( type & (FAX|HOME) ) == (FAX|HOME) ) | 336 | if ( ( type & (FAX|HOME) ) == (FAX|HOME) ) |
321 | c.setHomeFax( value ); | 337 | c.setHomeFax( value ); |
322 | if ( ( type & (CELL|HOME) ) == (CELL|HOME) ) | 338 | if ( ( type & (CELL|HOME) ) == (CELL|HOME) ) |
323 | c.setHomeMobile( value ); | 339 | c.setHomeMobile( value ); |
324 | if ( ( type & (VOICE|WORK) ) == (VOICE|WORK) ) | 340 | if ( ( type & (VOICE|WORK) ) == (VOICE|WORK) && (type & (CELL|WORK) ) != (CELL|WORK) ) |
325 | c.setBusinessPhone( value ); | 341 | c.setBusinessPhone( value ); |
326 | if ( ( type & (FAX|WORK) ) == (FAX|WORK) ) | 342 | if ( ( type & (FAX|WORK) ) == (FAX|WORK) ) |
327 | c.setBusinessFax( value ); | 343 | c.setBusinessFax( value ); |
@@ -406,9 +422,9 @@ OContact OContactAccessBackend_VCard::parseVObject( VObject *obj ) | |||
406 | else if ( name == VCBirthDateProp ) { | 422 | else if ( name == VCBirthDateProp ) { |
407 | // Reading Birthdate regarding RFC 2425 (5.8.4) | 423 | // Reading Birthdate regarding RFC 2425 (5.8.4) |
408 | c.setBirthday( convVCardDateToDate( value ) ); | 424 | c.setBirthday( convVCardDateToDate( value ) ); |
409 | 425 | ||
410 | } | 426 | } |
411 | 427 | ||
412 | #if 0 | 428 | #if 0 |
413 | else { | 429 | else { |
414 | printf("Name: %s, value=%s\n", name.data(), vObjectStringZValue( o ) ); | 430 | printf("Name: %s, value=%s\n", name.data(), vObjectStringZValue( o ) ); |
@@ -434,10 +450,10 @@ VObject* OContactAccessBackend_VCard::createVObject( const OContact &c ) | |||
434 | safeAddPropValue( vcard, VCVersionProp, "2.1" ); | 450 | safeAddPropValue( vcard, VCVersionProp, "2.1" ); |
435 | safeAddPropValue( vcard, VCLastRevisedProp, TimeConversion::toISO8601( QDateTime::currentDateTime() ) ); | 451 | safeAddPropValue( vcard, VCLastRevisedProp, TimeConversion::toISO8601( QDateTime::currentDateTime() ) ); |
436 | safeAddPropValue( vcard, VCUniqueStringProp, QString::number(c.uid()) ); | 452 | safeAddPropValue( vcard, VCUniqueStringProp, QString::number(c.uid()) ); |
437 | 453 | ||
438 | // full name | 454 | // full name |
439 | safeAddPropValue( vcard, VCFullNameProp, c.fullName() ); | 455 | safeAddPropValue( vcard, VCFullNameProp, c.fullName() ); |
440 | 456 | ||
441 | // name properties | 457 | // name properties |
442 | VObject *name = safeAddProp( vcard, VCNameProp ); | 458 | VObject *name = safeAddProp( vcard, VCNameProp ); |
443 | safeAddPropValue( name, VCFamilyNameProp, c.lastName() ); | 459 | safeAddPropValue( name, VCFamilyNameProp, c.lastName() ); |
@@ -445,7 +461,7 @@ VObject* OContactAccessBackend_VCard::createVObject( const OContact &c ) | |||
445 | safeAddPropValue( name, VCAdditionalNamesProp, c.middleName() ); | 461 | safeAddPropValue( name, VCAdditionalNamesProp, c.middleName() ); |
446 | safeAddPropValue( name, VCNamePrefixesProp, c.title() ); | 462 | safeAddPropValue( name, VCNamePrefixesProp, c.title() ); |
447 | safeAddPropValue( name, VCNameSuffixesProp, c.suffix() ); | 463 | safeAddPropValue( name, VCNameSuffixesProp, c.suffix() ); |
448 | 464 | ||
449 | // home properties | 465 | // home properties |
450 | VObject *home_adr= safeAddProp( vcard, VCAdrProp ); | 466 | VObject *home_adr= safeAddProp( vcard, VCAdrProp ); |
451 | safeAddProp( home_adr, VCHomeProp ); | 467 | safeAddProp( home_adr, VCHomeProp ); |
@@ -454,7 +470,7 @@ VObject* OContactAccessBackend_VCard::createVObject( const OContact &c ) | |||
454 | safeAddPropValue( home_adr, VCRegionProp, c.homeState() ); | 470 | safeAddPropValue( home_adr, VCRegionProp, c.homeState() ); |
455 | safeAddPropValue( home_adr, VCPostalCodeProp, c.homeZip() ); | 471 | safeAddPropValue( home_adr, VCPostalCodeProp, c.homeZip() ); |
456 | safeAddPropValue( home_adr, VCCountryNameProp, c.homeCountry() ); | 472 | safeAddPropValue( home_adr, VCCountryNameProp, c.homeCountry() ); |
457 | 473 | ||
458 | VObject *home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homePhone() ); | 474 | VObject *home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homePhone() ); |
459 | safeAddProp( home_phone, VCHomeProp ); | 475 | safeAddProp( home_phone, VCHomeProp ); |
460 | home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homeMobile() ); | 476 | home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homeMobile() ); |
@@ -463,10 +479,10 @@ VObject* OContactAccessBackend_VCard::createVObject( const OContact &c ) | |||
463 | home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homeFax() ); | 479 | home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homeFax() ); |
464 | safeAddProp( home_phone, VCHomeProp ); | 480 | safeAddProp( home_phone, VCHomeProp ); |
465 | safeAddProp( home_phone, VCFaxProp ); | 481 | safeAddProp( home_phone, VCFaxProp ); |
466 | 482 | ||
467 | VObject *url = safeAddPropValue( vcard, VCURLProp, c.homeWebpage() ); | 483 | VObject *url = safeAddPropValue( vcard, VCURLProp, c.homeWebpage() ); |
468 | safeAddProp( url, VCHomeProp ); | 484 | safeAddProp( url, VCHomeProp ); |
469 | 485 | ||
470 | // work properties | 486 | // work properties |
471 | VObject *work_adr= safeAddProp( vcard, VCAdrProp ); | 487 | VObject *work_adr= safeAddProp( vcard, VCAdrProp ); |
472 | safeAddProp( work_adr, VCWorkProp ); | 488 | safeAddProp( work_adr, VCWorkProp ); |
@@ -475,7 +491,7 @@ VObject* OContactAccessBackend_VCard::createVObject( const OContact &c ) | |||
475 | safeAddPropValue( work_adr, VCRegionProp, c.businessState() ); | 491 | safeAddPropValue( work_adr, VCRegionProp, c.businessState() ); |
476 | safeAddPropValue( work_adr, VCPostalCodeProp, c.businessZip() ); | 492 | safeAddPropValue( work_adr, VCPostalCodeProp, c.businessZip() ); |
477 | safeAddPropValue( work_adr, VCCountryNameProp, c.businessCountry() ); | 493 | safeAddPropValue( work_adr, VCCountryNameProp, c.businessCountry() ); |
478 | 494 | ||
479 | VObject *work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPhone() ); | 495 | VObject *work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPhone() ); |
480 | safeAddProp( work_phone, VCWorkProp ); | 496 | safeAddProp( work_phone, VCWorkProp ); |
481 | work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessMobile() ); | 497 | work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessMobile() ); |
@@ -487,41 +503,41 @@ VObject* OContactAccessBackend_VCard::createVObject( const OContact &c ) | |||
487 | work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPager() ); | 503 | work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPager() ); |
488 | safeAddProp( work_phone, VCWorkProp ); | 504 | safeAddProp( work_phone, VCWorkProp ); |
489 | safeAddProp( work_phone, VCPagerProp ); | 505 | safeAddProp( work_phone, VCPagerProp ); |
490 | 506 | ||
491 | url = safeAddPropValue( vcard, VCURLProp, c.businessWebpage() ); | 507 | url = safeAddPropValue( vcard, VCURLProp, c.businessWebpage() ); |
492 | safeAddProp( url, VCWorkProp ); | 508 | safeAddProp( url, VCWorkProp ); |
493 | 509 | ||
494 | VObject *title = safeAddPropValue( vcard, VCTitleProp, c.jobTitle() ); | 510 | VObject *title = safeAddPropValue( vcard, VCTitleProp, c.jobTitle() ); |
495 | safeAddProp( title, VCWorkProp ); | 511 | safeAddProp( title, VCWorkProp ); |
496 | 512 | ||
497 | 513 | ||
498 | QStringList emails = c.emailList(); | 514 | QStringList emails = c.emailList(); |
499 | emails.prepend( c.defaultEmail() ); | 515 | emails.prepend( c.defaultEmail() ); |
500 | for( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) { | 516 | for( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) { |
501 | VObject *email = safeAddPropValue( vcard, VCEmailAddressProp, *it ); | 517 | VObject *email = safeAddPropValue( vcard, VCEmailAddressProp, *it ); |
502 | safeAddProp( email, VCInternetProp ); | 518 | safeAddProp( email, VCInternetProp ); |
503 | } | 519 | } |
504 | 520 | ||
505 | safeAddPropValue( vcard, VCNoteProp, c.notes() ); | 521 | safeAddPropValue( vcard, VCNoteProp, c.notes() ); |
506 | 522 | ||
507 | // Exporting Birthday regarding RFC 2425 (5.8.4) | 523 | // Exporting Birthday regarding RFC 2425 (5.8.4) |
508 | if ( c.birthday().isValid() ){ | 524 | if ( c.birthday().isValid() ){ |
509 | qWarning("Exporting birthday as: %s", convDateToVCardDate( c.birthday() ).latin1() ); | 525 | qWarning("Exporting birthday as: %s", convDateToVCardDate( c.birthday() ).latin1() ); |
510 | safeAddPropValue( vcard, VCBirthDateProp, convDateToVCardDate( c.birthday() ) ); | 526 | safeAddPropValue( vcard, VCBirthDateProp, convDateToVCardDate( c.birthday() ) ); |
511 | } | 527 | } |
512 | 528 | ||
513 | if ( !c.company().isEmpty() || !c.department().isEmpty() || !c.office().isEmpty() ) { | 529 | if ( !c.company().isEmpty() || !c.department().isEmpty() || !c.office().isEmpty() ) { |
514 | VObject *org = safeAddProp( vcard, VCOrgProp ); | 530 | VObject *org = safeAddProp( vcard, VCOrgProp ); |
515 | safeAddPropValue( org, VCOrgNameProp, c.company() ); | 531 | safeAddPropValue( org, VCOrgNameProp, c.company() ); |
516 | safeAddPropValue( org, VCOrgUnitProp, c.department() ); | 532 | safeAddPropValue( org, VCOrgUnitProp, c.department() ); |
517 | safeAddPropValue( org, VCOrgUnit2Prop, c.office() ); | 533 | safeAddPropValue( org, VCOrgUnit2Prop, c.office() ); |
518 | } | 534 | } |
519 | 535 | ||
520 | // some values we have to export as custom fields | 536 | // some values we have to export as custom fields |
521 | safeAddPropValue( vcard, "X-Qtopia-Profession", c.profession() ); | 537 | safeAddPropValue( vcard, "X-Qtopia-Profession", c.profession() ); |
522 | safeAddPropValue( vcard, "X-Qtopia-Manager", c.manager() ); | 538 | safeAddPropValue( vcard, "X-Qtopia-Manager", c.manager() ); |
523 | safeAddPropValue( vcard, "X-Qtopia-Assistant", c.assistant() ); | 539 | safeAddPropValue( vcard, "X-Qtopia-Assistant", c.assistant() ); |
524 | 540 | ||
525 | safeAddPropValue( vcard, "X-Qtopia-Spouse", c.spouse() ); | 541 | safeAddPropValue( vcard, "X-Qtopia-Spouse", c.spouse() ); |
526 | safeAddPropValue( vcard, "X-Qtopia-Gender", c.gender() ); | 542 | safeAddPropValue( vcard, "X-Qtopia-Gender", c.gender() ); |
527 | if ( c.anniversary().isValid() ){ | 543 | if ( c.anniversary().isValid() ){ |
@@ -530,7 +546,7 @@ VObject* OContactAccessBackend_VCard::createVObject( const OContact &c ) | |||
530 | } | 546 | } |
531 | safeAddPropValue( vcard, "X-Qtopia-Nickname", c.nickname() ); | 547 | safeAddPropValue( vcard, "X-Qtopia-Nickname", c.nickname() ); |
532 | safeAddPropValue( vcard, "X-Qtopia-Children", c.children() ); | 548 | safeAddPropValue( vcard, "X-Qtopia-Children", c.children() ); |
533 | 549 | ||
534 | return vcard; | 550 | return vcard; |
535 | } | 551 | } |
536 | 552 | ||
@@ -544,7 +560,7 @@ QString OContactAccessBackend_VCard::convDateToVCardDate( const QDate& d ) const | |||
544 | int pos = 0; | 560 | int pos = 0; |
545 | while ( ( pos = str_rfc2425.find (' ') ) > 0 ) | 561 | while ( ( pos = str_rfc2425.find (' ') ) > 0 ) |
546 | str_rfc2425.replace( pos, 1, "0" ); | 562 | str_rfc2425.replace( pos, 1, "0" ); |
547 | 563 | ||
548 | return str_rfc2425; | 564 | return str_rfc2425; |
549 | } | 565 | } |
550 | 566 | ||
diff --git a/libopie2/opiepim/backend/otodoaccessvcal.cpp b/libopie2/opiepim/backend/otodoaccessvcal.cpp index e96cc3c..309f9e1 100644 --- a/libopie2/opiepim/backend/otodoaccessvcal.cpp +++ b/libopie2/opiepim/backend/otodoaccessvcal.cpp | |||
@@ -58,9 +58,12 @@ namespace { | |||
58 | if( task == 0 ) | 58 | if( task == 0 ) |
59 | return 0l; | 59 | return 0l; |
60 | 60 | ||
61 | if( event.hasDueDate() ) | 61 | if( event.hasDueDate() ) { |
62 | QTime time(0, 0, 0); | ||
63 | QDateTime date(event.dueDate(), time ); | ||
62 | addPropValue( task, VCDueProp, | 64 | addPropValue( task, VCDueProp, |
63 | TimeConversion::toISO8601( event.dueDate() ) ); | 65 | TimeConversion::toISO8601( date ) ); |
66 | } | ||
64 | 67 | ||
65 | if( event.isCompleted() ) | 68 | if( event.isCompleted() ) |
66 | addPropValue( task, VCStatusProp, "COMPLETED"); | 69 | addPropValue( task, VCStatusProp, "COMPLETED"); |