summaryrefslogtreecommitdiff
path: root/libopie2
authorzecke <zecke>2003-02-16 22:25:46 (UTC)
committer zecke <zecke>2003-02-16 22:25:46 (UTC)
commit4d0e8ffd8518fe24ed94cfcf92eeff666b014094 (patch) (unidiff)
tree86a0bec752418c409cbc9ad95d6479997dfaf909 /libopie2
parent8ecc375c803dc57b160bd0335891fcaf4f6de1df (diff)
downloadopie-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
Diffstat (limited to 'libopie2') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp82
-rw-r--r--libopie2/opiepim/backend/otodoaccessvcal.cpp7
2 files changed, 54 insertions, 35 deletions
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
@@ -18,4 +18,19 @@
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..
@@ -54,8 +69,8 @@ OContactAccessBackend_VCard::OContactAccessBackend_VCard ( QString , QString fil
54 69
55bool OContactAccessBackend_VCard::load () 70bool 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
@@ -82,5 +97,5 @@ bool OContactAccessBackend_VCard::load ()
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);
@@ -96,5 +111,5 @@ bool OContactAccessBackend_VCard::reload()
96} 111}
97bool OContactAccessBackend_VCard::save() 112bool OContactAccessBackend_VCard::save()
98{ 113{
99 if (!m_dirty ) 114 if (!m_dirty )
100 return true; 115 return true;
@@ -118,5 +133,5 @@ bool OContactAccessBackend_VCard::save()
118 m_dirty = false; 133 m_dirty = false;
119 return true; 134 return true;
120 135
121 136
122} 137}
@@ -138,5 +153,5 @@ bool OContactAccessBackend_VCard::remove ( int uid )
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
@@ -147,5 +162,5 @@ bool OContactAccessBackend_VCard::replace ( const OContact &contact )
147 return true; 162 return true;
148} 163}
149 164
150OContact OContactAccessBackend_VCard::find ( int uid ) const 165OContact OContactAccessBackend_VCard::find ( int uid ) const
151{ 166{
@@ -207,5 +222,5 @@ 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 );
@@ -240,5 +255,5 @@ OContact OContactAccessBackend_VCard::parseVObject( VObject *obj )
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 );
@@ -287,5 +302,5 @@ OContact OContactAccessBackend_VCard::parseVObject( VObject *obj )
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 );
@@ -315,6 +330,7 @@ OContact OContactAccessBackend_VCard::parseVObject( VObject *obj )
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) )
@@ -322,5 +338,5 @@ OContact OContactAccessBackend_VCard::parseVObject( VObject *obj )
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) )
@@ -407,7 +423,7 @@ OContact OContactAccessBackend_VCard::parseVObject( VObject *obj )
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 {
@@ -435,8 +451,8 @@ VObject* OContactAccessBackend_VCard::createVObject( const OContact &c )
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 );
@@ -446,5 +462,5 @@ VObject* OContactAccessBackend_VCard::createVObject( const OContact &c )
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 );
@@ -455,5 +471,5 @@ VObject* OContactAccessBackend_VCard::createVObject( const OContact &c )
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 );
@@ -464,8 +480,8 @@ VObject* OContactAccessBackend_VCard::createVObject( const OContact &c )
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 );
@@ -476,5 +492,5 @@ VObject* OContactAccessBackend_VCard::createVObject( const OContact &c )
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 );
@@ -488,12 +504,12 @@ VObject* OContactAccessBackend_VCard::createVObject( const OContact &c )
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() );
@@ -502,7 +518,7 @@ VObject* OContactAccessBackend_VCard::createVObject( const OContact &c )
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() ){
@@ -510,5 +526,5 @@ VObject* OContactAccessBackend_VCard::createVObject( const OContact &c )
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 );
@@ -517,10 +533,10 @@ VObject* OContactAccessBackend_VCard::createVObject( const OContact &c )
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() );
@@ -531,5 +547,5 @@ VObject* OContactAccessBackend_VCard::createVObject( const OContact &c )
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}
@@ -545,5 +561,5 @@ QString OContactAccessBackend_VCard::convDateToVCardDate( const QDate& d ) const
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}
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
@@ -59,7 +59,10 @@ namespace {
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() )