author | eilers <eilers> | 2004-06-27 17:34:44 (UTC) |
---|---|---|
committer | eilers <eilers> | 2004-06-27 17:34:44 (UTC) |
commit | 0ef75ca5409d290df36d1c0bbf0413e37bfd4124 (patch) (unidiff) | |
tree | a89d266f6ce2a6b90aff542d6c305c3fc5dde5b1 /libopie2 | |
parent | e211aea3b9201920f442b36f6726d10c09b63154 (diff) | |
download | opie-0ef75ca5409d290df36d1c0bbf0413e37bfd4124.zip opie-0ef75ca5409d290df36d1c0bbf0413e37bfd4124.tar.gz opie-0ef75ca5409d290df36d1c0bbf0413e37bfd4124.tar.bz2 |
Argh.. Sorry for making problems !
CVS committed stuff which had merging conflicts... :(
-rw-r--r-- | libopie2/opiedb/osqlitedriver.cpp | 2 | ||||
-rw-r--r-- | libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp | 219 |
2 files changed, 5 insertions, 216 deletions
diff --git a/libopie2/opiedb/osqlitedriver.cpp b/libopie2/opiedb/osqlitedriver.cpp index b9a491e..92f89cf 100644 --- a/libopie2/opiedb/osqlitedriver.cpp +++ b/libopie2/opiedb/osqlitedriver.cpp | |||
@@ -170,7 +170,7 @@ OSQLResult OSQLiteDriver::query( OSQLQuery* qu) { | |||
170 | char *err; | 170 | char *err; |
171 | /* SQLITE_OK 0 if return code > 0 == failure */ | 171 | /* SQLITE_OK 0 if return code > 0 == failure */ |
172 | if ( sqlite_exec(m_sqlite, qu->query().utf8(),&call_back, &query, &err) > 0 ) { | 172 | if ( sqlite_exec(m_sqlite, qu->query().utf8(),&call_back, &query, &err) > 0 ) { |
173 | qWarning("OSQLiteDriver::query: Error while executing %s",err); | 173 | owarn << "OSQLiteDriver::query: Error while executing " << err << "" << oendl; |
174 | free(err ); | 174 | free(err ); |
175 | // FixMe Errors | 175 | // FixMe Errors |
176 | } | 176 | } |
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp index caf3c6e..6b66814 100644 --- a/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp +++ b/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp | |||
@@ -66,7 +66,7 @@ bool OPimContactAccessBackend_VCard::load () | |||
66 | if ( !obj ) | 66 | if ( !obj ) |
67 | return false; | 67 | return false; |
68 | }else{ | 68 | }else{ |
69 | owarn << "File \"" << m_file << "\" not found !" << oendl; | 69 | odebug << "File \"" << m_file << "\" not found !" << oendl; |
70 | return false; | 70 | return false; |
71 | } | 71 | } |
72 | 72 | ||
@@ -210,14 +210,13 @@ OPimContact OPimContactAccessBackend_VCard::parseVObject( VObject *obj ) | |||
210 | { | 210 | { |
211 | OPimContact c; | 211 | OPimContact c; |
212 | 212 | ||
213 | <<<<<<< ocontactaccessbackend_vcard.cpp | ||
214 | VObjectIterator it; | 213 | VObjectIterator it; |
215 | initPropIterator( &it, obj ); | 214 | initPropIterator( &it, obj ); |
216 | while( moreIteration( &it ) ) { | 215 | while( moreIteration( &it ) ) { |
217 | VObject *o = nextVObject( &it ); | 216 | VObject *o = nextVObject( &it ); |
218 | QCString name = vObjectName( o ); | 217 | QCString name = vObjectName( o ); |
219 | QString value = QString::fromUtf8( vObjectStringZValue( o ) ); | 218 | QString value = QString::fromUtf8( vObjectStringZValue( o ) ); |
220 | qDebug( "(1)Read: %s", QString( value ).latin1() ); | 219 | odebug << "(1)Read: %s" << QString( value ).latin1() << oendl; |
221 | if ( name == VCNameProp ) { | 220 | if ( name == VCNameProp ) { |
222 | VObjectIterator nit; | 221 | VObjectIterator nit; |
223 | initPropIterator( &nit, o ); | 222 | initPropIterator( &nit, o ); |
@@ -225,7 +224,7 @@ OPimContact OPimContactAccessBackend_VCard::parseVObject( VObject *obj ) | |||
225 | VObject *o = nextVObject( &nit ); | 224 | VObject *o = nextVObject( &nit ); |
226 | QCString name = vObjectTypeInfo( o ); | 225 | QCString name = vObjectTypeInfo( o ); |
227 | QString value = QString::fromUtf8( vObjectStringZValue( o ) ); | 226 | QString value = QString::fromUtf8( vObjectStringZValue( o ) ); |
228 | qDebug( "(2)Read: %s", value.latin1() ); | 227 | odebug << "(2)Read: %s" << value.latin1() << oendl; |
229 | if ( name == VCNamePrefixesProp ) | 228 | if ( name == VCNamePrefixesProp ) |
230 | c.setTitle( value ); | 229 | c.setTitle( value ); |
231 | else if ( name == VCNameSuffixesProp ) | 230 | else if ( name == VCNameSuffixesProp ) |
@@ -321,7 +320,7 @@ OPimContact OPimContactAccessBackend_VCard::parseVObject( VObject *obj ) | |||
321 | if ( ( type & (VOICE|CELL|FAX|PAGER) ) == 0 ) // default | 320 | if ( ( type & (VOICE|CELL|FAX|PAGER) ) == 0 ) // default |
322 | type |= VOICE; | 321 | type |= VOICE; |
323 | 322 | ||
324 | qWarning("value %s %d", value.data(), type ); | 323 | owarn << "value %s %d" << value.data() << type << oendl; |
325 | if ( (type & (VOICE|HOME) ) == (VOICE|HOME) && (type & (CELL|HOME) ) != (CELL|HOME) ) | 324 | if ( (type & (VOICE|HOME) ) == (VOICE|HOME) && (type & (CELL|HOME) ) != (CELL|HOME) ) |
326 | c.setHomePhone( value ); | 325 | c.setHomePhone( value ); |
327 | if ( ( type & (FAX|HOME) ) == (FAX|HOME) ) | 326 | if ( ( type & (FAX|HOME) ) == (FAX|HOME) ) |
@@ -418,215 +417,7 @@ OPimContact OPimContactAccessBackend_VCard::parseVObject( VObject *obj ) | |||
418 | else if ( name == VCCommentProp ) { | 417 | else if ( name == VCCommentProp ) { |
419 | c.setNotes( value ); | 418 | c.setNotes( value ); |
420 | } | 419 | } |
421 | ======= | ||
422 | VObjectIterator it; | ||
423 | initPropIterator( &it, obj ); | ||
424 | while( moreIteration( &it ) ) { | ||
425 | VObject *o = nextVObject( &it ); | ||
426 | QCString name = vObjectName( o ); | ||
427 | QCString value = vObjectStringZValue( o ); | ||
428 | if ( name == VCNameProp ) { | ||
429 | VObjectIterator nit; | ||
430 | initPropIterator( &nit, o ); | ||
431 | while( moreIteration( &nit ) ) { | ||
432 | VObject *o = nextVObject( &nit ); | ||
433 | QCString name = vObjectTypeInfo( o ); | ||
434 | QString value = vObjectStringZValue( o ); | ||
435 | if ( name == VCNamePrefixesProp ) | ||
436 | c.setTitle( value ); | ||
437 | else if ( name == VCNameSuffixesProp ) | ||
438 | c.setSuffix( value ); | ||
439 | else if ( name == VCFamilyNameProp ) | ||
440 | c.setLastName( value ); | ||
441 | else if ( name == VCGivenNameProp ) | ||
442 | c.setFirstName( value ); | ||
443 | else if ( name == VCAdditionalNamesProp ) | ||
444 | c.setMiddleName( value ); | ||
445 | } | ||
446 | } | ||
447 | else if ( name == VCAdrProp ) { | ||
448 | bool work = TRUE; // default address is work address | ||
449 | QString street; | ||
450 | QString city; | ||
451 | QString region; | ||
452 | QString postal; | ||
453 | QString country; | ||
454 | |||
455 | VObjectIterator nit; | ||
456 | initPropIterator( &nit, o ); | ||
457 | while( moreIteration( &nit ) ) { | ||
458 | VObject *o = nextVObject( &nit ); | ||
459 | QCString name = vObjectName( o ); | ||
460 | QString value = vObjectStringZValue( o ); | ||
461 | if ( name == VCHomeProp ) | ||
462 | work = FALSE; | ||
463 | else if ( name == VCWorkProp ) | ||
464 | work = TRUE; | ||
465 | else if ( name == VCStreetAddressProp ) | ||
466 | street = value; | ||
467 | else if ( name == VCCityProp ) | ||
468 | city = value; | ||
469 | else if ( name == VCRegionProp ) | ||
470 | region = value; | ||
471 | else if ( name == VCPostalCodeProp ) | ||
472 | postal = value; | ||
473 | else if ( name == VCCountryNameProp ) | ||
474 | country = value; | ||
475 | } | ||
476 | if ( work ) { | ||
477 | c.setBusinessStreet( street ); | ||
478 | c.setBusinessCity( city ); | ||
479 | c.setBusinessCountry( country ); | ||
480 | c.setBusinessZip( postal ); | ||
481 | c.setBusinessState( region ); | ||
482 | } else { | ||
483 | c.setHomeStreet( street ); | ||
484 | c.setHomeCity( city ); | ||
485 | c.setHomeCountry( country ); | ||
486 | c.setHomeZip( postal ); | ||
487 | c.setHomeState( region ); | ||
488 | } | ||
489 | } | ||
490 | else if ( name == VCTelephoneProp ) { | ||
491 | enum { | ||
492 | HOME = 0x01, | ||
493 | WORK = 0x02, | ||
494 | VOICE = 0x04, | ||
495 | CELL = 0x08, | ||
496 | FAX = 0x10, | ||
497 | PAGER = 0x20, | ||
498 | UNKNOWN = 0x80 | ||
499 | }; | ||
500 | int type = 0; | ||
501 | |||
502 | VObjectIterator nit; | ||
503 | initPropIterator( &nit, o ); | ||
504 | while( moreIteration( &nit ) ) { | ||
505 | VObject *o = nextVObject( &nit ); | ||
506 | QCString name = vObjectTypeInfo( o ); | ||
507 | if ( name == VCHomeProp ) | ||
508 | type |= HOME; | ||
509 | else if ( name == VCWorkProp ) | ||
510 | type |= WORK; | ||
511 | else if ( name == VCVoiceProp ) | ||
512 | type |= VOICE; | ||
513 | else if ( name == VCCellularProp ) | ||
514 | type |= CELL; | ||
515 | else if ( name == VCFaxProp ) | ||
516 | type |= FAX; | ||
517 | else if ( name == VCPagerProp ) | ||
518 | type |= PAGER; | ||
519 | else if ( name == VCPreferredProp ) | ||
520 | ; | ||
521 | else | ||
522 | type |= UNKNOWN; | ||
523 | } | ||
524 | if ( (type & UNKNOWN) != UNKNOWN ) { | ||
525 | if ( ( type & (HOME|WORK) ) == 0 ) // default | ||
526 | type |= HOME; | ||
527 | if ( ( type & (VOICE|CELL|FAX|PAGER) ) == 0 ) // default | ||
528 | type |= VOICE; | ||
529 | |||
530 | owarn << "value " << value.data() << " " << type << "" << oendl; | ||
531 | if ( (type & (VOICE|HOME) ) == (VOICE|HOME) && (type & (CELL|HOME) ) != (CELL|HOME) ) | ||
532 | c.setHomePhone( value ); | ||
533 | if ( ( type & (FAX|HOME) ) == (FAX|HOME) ) | ||
534 | c.setHomeFax( value ); | ||
535 | if ( ( type & (CELL|HOME) ) == (CELL|HOME) ) | ||
536 | c.setHomeMobile( value ); | ||
537 | if ( ( type & (VOICE|WORK) ) == (VOICE|WORK) && (type & (CELL|WORK) ) != (CELL|WORK) ) | ||
538 | c.setBusinessPhone( value ); | ||
539 | if ( ( type & (FAX|WORK) ) == (FAX|WORK) ) | ||
540 | c.setBusinessFax( value ); | ||
541 | if ( ( type & (CELL|WORK) ) == (CELL|WORK) ) | ||
542 | c.setBusinessMobile( value ); | ||
543 | if ( ( type & (PAGER|WORK) ) == (PAGER|WORK) ) | ||
544 | c.setBusinessPager( value ); | ||
545 | } | ||
546 | } | ||
547 | else if ( name == VCEmailAddressProp ) { | ||
548 | QString email = vObjectStringZValue( o ); | ||
549 | bool valid = TRUE; | ||
550 | VObjectIterator nit; | ||
551 | initPropIterator( &nit, o ); | ||
552 | while( moreIteration( &nit ) ) { | ||
553 | VObject *o = nextVObject( &nit ); | ||
554 | QCString name = vObjectTypeInfo( o ); | ||
555 | if ( name != VCInternetProp && name != VCHomeProp && | ||
556 | name != VCWorkProp && | ||
557 | name != VCPreferredProp ) | ||
558 | // ### preffered should map to default email | ||
559 | valid = FALSE; | ||
560 | } | ||
561 | if ( valid ) { | ||
562 | c.insertEmail( email ); | ||
563 | } | ||
564 | } | ||
565 | else if ( name == VCURLProp ) { | ||
566 | VObjectIterator nit; | ||
567 | initPropIterator( &nit, o ); | ||
568 | while( moreIteration( &nit ) ) { | ||
569 | VObject *o = nextVObject( &nit ); | ||
570 | QCString name = vObjectTypeInfo( o ); | ||
571 | if ( name == VCHomeProp ) | ||
572 | c.setHomeWebpage( value ); | ||
573 | else if ( name == VCWorkProp ) | ||
574 | c.setBusinessWebpage( value ); | ||
575 | } | ||
576 | } | ||
577 | else if ( name == VCOrgProp ) { | ||
578 | VObjectIterator nit; | ||
579 | initPropIterator( &nit, o ); | ||
580 | while( moreIteration( &nit ) ) { | ||
581 | VObject *o = nextVObject( &nit ); | ||
582 | QCString name = vObjectName( o ); | ||
583 | QString value = vObjectStringZValue( o ); | ||
584 | if ( name == VCOrgNameProp ) | ||
585 | c.setCompany( value ); | ||
586 | else if ( name == VCOrgUnitProp ) | ||
587 | c.setDepartment( value ); | ||
588 | else if ( name == VCOrgUnit2Prop ) | ||
589 | c.setOffice( value ); | ||
590 | } | ||
591 | } | ||
592 | else if ( name == VCTitleProp ) { | ||
593 | c.setJobTitle( value ); | ||
594 | } | ||
595 | else if ( name == "X-Qtopia-Profession" ) { | ||
596 | c.setProfession( value ); | ||
597 | } | ||
598 | else if ( name == "X-Qtopia-Manager" ) { | ||
599 | c.setManager( value ); | ||
600 | } | ||
601 | else if ( name == "X-Qtopia-Assistant" ) { | ||
602 | c.setAssistant( value ); | ||
603 | } | ||
604 | else if ( name == "X-Qtopia-Spouse" ) { | ||
605 | c.setSpouse( value ); | ||
606 | } | ||
607 | else if ( name == "X-Qtopia-Gender" ) { | ||
608 | c.setGender( value ); | ||
609 | } | ||
610 | else if ( name == "X-Qtopia-Anniversary" ) { | ||
611 | c.setAnniversary( convVCardDateToDate( value ) ); | ||
612 | } | ||
613 | else if ( name == "X-Qtopia-Nickname" ) { | ||
614 | c.setNickname( value ); | ||
615 | } | ||
616 | else if ( name == "X-Qtopia-Children" ) { | ||
617 | c.setChildren( value ); | ||
618 | } | ||
619 | else if ( name == VCBirthDateProp ) { | ||
620 | // Reading Birthdate regarding RFC 2425 (5.8.4) | ||
621 | c.setBirthday( convVCardDateToDate( value ) ); | ||
622 | |||
623 | } | ||
624 | else if ( name == VCCommentProp ) { | ||
625 | c.setNotes( value ); | ||
626 | } | ||
627 | >>>>>>> 1.15 | ||
628 | #if 0 | 420 | #if 0 |
629 | <<<<<<< ocontactaccessbackend_vcard.cpp | ||
630 | else { | 421 | else { |
631 | printf("Name: %s, value=%s\n", name.data(), QString::fromUtf8( vObjectStringZValue( o ) ) ); | 422 | printf("Name: %s, value=%s\n", name.data(), QString::fromUtf8( vObjectStringZValue( o ) ) ); |
632 | VObjectIterator nit; | 423 | VObjectIterator nit; |
@@ -638,7 +429,6 @@ OPimContact OPimContactAccessBackend_VCard::parseVObject( VObject *obj ) | |||
638 | printf(" subprop: %s = %s\n", name.data(), value.latin1() ); | 429 | printf(" subprop: %s = %s\n", name.data(), value.latin1() ); |
639 | } | 430 | } |
640 | } | 431 | } |
641 | ======= | ||
642 | else { | 432 | else { |
643 | printf("Name: %s, value=%s\n", name.data(), vObjectStringZValue( o ) ); | 433 | printf("Name: %s, value=%s\n", name.data(), vObjectStringZValue( o ) ); |
644 | VObjectIterator nit; | 434 | VObjectIterator nit; |
@@ -650,7 +440,6 @@ OPimContact OPimContactAccessBackend_VCard::parseVObject( VObject *obj ) | |||
650 | printf(" subprop: %s = %s\n", name.data(), value.latin1() ); | 440 | printf(" subprop: %s = %s\n", name.data(), value.latin1() ); |
651 | } | 441 | } |
652 | } | 442 | } |
653 | >>>>>>> 1.15 | ||
654 | #endif | 443 | #endif |
655 | } | 444 | } |
656 | c.setFileAs(); | 445 | c.setFileAs(); |