summaryrefslogtreecommitdiff
path: root/libopie/pim/ocontactaccessbackend_vcard.cpp
Unidiff
Diffstat (limited to 'libopie/pim/ocontactaccessbackend_vcard.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/ocontactaccessbackend_vcard.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/libopie/pim/ocontactaccessbackend_vcard.cpp b/libopie/pim/ocontactaccessbackend_vcard.cpp
index 270bef3..b60c5be 100644
--- a/libopie/pim/ocontactaccessbackend_vcard.cpp
+++ b/libopie/pim/ocontactaccessbackend_vcard.cpp
@@ -8,24 +8,39 @@
8 *This program is free software; you can redistribute it and/or 8 *This program is free software; you can redistribute it and/or
9 *modify it under the terms of the GNU Library General Public 9 *modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version. 11 * version 2 of the License, or (at your option) any later version.
12 * ===================================================================== 12 * =====================================================================
13 * ToDo: 13 * ToDo:
14 * 14 *
15 * ===================================================================== 15 * =====================================================================
16 * Version: $Id$ 16 * Version: $Id$
17 * ===================================================================== 17 * =====================================================================
18 * History: 18 * History:
19 * $Log$ 19 * $Log$
20 * Revision 1.11 2003/08/01 12:30:16 eilers
21 * Merging changes from BRANCH_1_0 to HEAD
22 *
23 * Revision 1.10.4.3 2003/07/23 08:54:37 eilers
24 * Default email was added to the list of all emails, which already contains
25 * the default email..
26 * This closes bug #1045
27 *
28 * Revision 1.10.4.2 2003/07/23 08:44:45 eilers
29 * Importing of Notes in vcard files wasn't implemented.
30 * Closes bug #1044
31 *
32 * Revision 1.10.4.1 2003/06/02 13:37:49 eilers
33 * Fixing memory leak
34 *
20 * Revision 1.10 2003/04/13 18:07:10 zecke 35 * Revision 1.10 2003/04/13 18:07:10 zecke
21 * More API doc 36 * More API doc
22 * QString -> const QString& 37 * QString -> const QString&
23 * QString = 0l -> QString::null 38 * QString = 0l -> QString::null
24 * 39 *
25 * Revision 1.9 2003/03/21 10:33:09 eilers 40 * Revision 1.9 2003/03/21 10:33:09 eilers
26 * Merged speed optimized xml backend for contacts to main. 41 * Merged speed optimized xml backend for contacts to main.
27 * Added QDateTime to querybyexample. For instance, it is now possible to get 42 * Added QDateTime to querybyexample. For instance, it is now possible to get
28 * all Birthdays/Anniversaries between two dates. This should be used 43 * all Birthdays/Anniversaries between two dates. This should be used
29 * to show all birthdays in the datebook.. 44 * to show all birthdays in the datebook..
30 * This change is sourcecode backward compatible but you have to upgrade 45 * This change is sourcecode backward compatible but you have to upgrade
31 * the binaries for today-addressbook. 46 * the binaries for today-addressbook.
@@ -142,24 +157,25 @@ bool OContactAccessBackend_VCard::save()
142 157
143 VObject *obj; 158 VObject *obj;
144 obj = newVObject( VCCalProp ); 159 obj = newVObject( VCCalProp );
145 addPropValue( obj, VCVersionProp, "1.0" ); 160 addPropValue( obj, VCVersionProp, "1.0" );
146 161
147 VObject *vo; 162 VObject *vo;
148 for(QMap<int, OContact>::ConstIterator it=m_map.begin(); it !=m_map.end(); ++it ){ 163 for(QMap<int, OContact>::ConstIterator it=m_map.begin(); it !=m_map.end(); ++it ){
149 vo = createVObject( *it ); 164 vo = createVObject( *it );
150 writeVObject( file.directHandle() , vo ); 165 writeVObject( file.directHandle() , vo );
151 cleanVObject( vo ); 166 cleanVObject( vo );
152 } 167 }
153 cleanStrTbl(); 168 cleanStrTbl();
169 deleteVObject( obj );
154 170
155 m_dirty = false; 171 m_dirty = false;
156 return true; 172 return true;
157 173
158 174
159} 175}
160void OContactAccessBackend_VCard::clear () 176void OContactAccessBackend_VCard::clear ()
161{ 177{
162 m_map.clear(); 178 m_map.clear();
163 m_dirty = true; // ??? sure ? (se) 179 m_dirty = true; // ??? sure ? (se)
164} 180}
165 181
@@ -437,25 +453,27 @@ OContact OContactAccessBackend_VCard::parseVObject( VObject *obj )
437 } 453 }
438 else if ( name == "X-Qtopia-Nickname" ) { 454 else if ( name == "X-Qtopia-Nickname" ) {
439 c.setNickname( value ); 455 c.setNickname( value );
440 } 456 }
441 else if ( name == "X-Qtopia-Children" ) { 457 else if ( name == "X-Qtopia-Children" ) {
442 c.setChildren( value ); 458 c.setChildren( value );
443 } 459 }
444 else if ( name == VCBirthDateProp ) { 460 else if ( name == VCBirthDateProp ) {
445 // Reading Birthdate regarding RFC 2425 (5.8.4) 461 // Reading Birthdate regarding RFC 2425 (5.8.4)
446 c.setBirthday( convVCardDateToDate( value ) ); 462 c.setBirthday( convVCardDateToDate( value ) );
447 463
448 } 464 }
449 465 else if ( name == VCCommentProp ) {
466 c.setNotes( value );
467 }
450#if 0 468#if 0
451 else { 469 else {
452 printf("Name: %s, value=%s\n", name.data(), vObjectStringZValue( o ) ); 470 printf("Name: %s, value=%s\n", name.data(), vObjectStringZValue( o ) );
453 VObjectIterator nit; 471 VObjectIterator nit;
454 initPropIterator( &nit, o ); 472 initPropIterator( &nit, o );
455 while( moreIteration( &nit ) ) { 473 while( moreIteration( &nit ) ) {
456 VObject *o = nextVObject( &nit ); 474 VObject *o = nextVObject( &nit );
457 QCString name = vObjectName( o ); 475 QCString name = vObjectName( o );
458 QString value = vObjectStringZValue( o ); 476 QString value = vObjectStringZValue( o );
459 printf(" subprop: %s = %s\n", name.data(), value.latin1() ); 477 printf(" subprop: %s = %s\n", name.data(), value.latin1() );
460 } 478 }
461 } 479 }
@@ -525,25 +543,25 @@ VObject* OContactAccessBackend_VCard::createVObject( const OContact &c )
525 work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPager() ); 543 work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPager() );
526 safeAddProp( work_phone, VCWorkProp ); 544 safeAddProp( work_phone, VCWorkProp );
527 safeAddProp( work_phone, VCPagerProp ); 545 safeAddProp( work_phone, VCPagerProp );
528 546
529 url = safeAddPropValue( vcard, VCURLProp, c.businessWebpage() ); 547 url = safeAddPropValue( vcard, VCURLProp, c.businessWebpage() );
530 safeAddProp( url, VCWorkProp ); 548 safeAddProp( url, VCWorkProp );
531 549
532 VObject *title = safeAddPropValue( vcard, VCTitleProp, c.jobTitle() ); 550 VObject *title = safeAddPropValue( vcard, VCTitleProp, c.jobTitle() );
533 safeAddProp( title, VCWorkProp ); 551 safeAddProp( title, VCWorkProp );
534 552
535 553
536 QStringList emails = c.emailList(); 554 QStringList emails = c.emailList();
537 emails.prepend( c.defaultEmail() ); 555 // emails.prepend( c.defaultEmail() ); Fix for bugreport #1045
538 for( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) { 556 for( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) {
539 VObject *email = safeAddPropValue( vcard, VCEmailAddressProp, *it ); 557 VObject *email = safeAddPropValue( vcard, VCEmailAddressProp, *it );
540 safeAddProp( email, VCInternetProp ); 558 safeAddProp( email, VCInternetProp );
541 } 559 }
542 560
543 safeAddPropValue( vcard, VCNoteProp, c.notes() ); 561 safeAddPropValue( vcard, VCNoteProp, c.notes() );
544 562
545 // Exporting Birthday regarding RFC 2425 (5.8.4) 563 // Exporting Birthday regarding RFC 2425 (5.8.4)
546 if ( c.birthday().isValid() ){ 564 if ( c.birthday().isValid() ){
547 qWarning("Exporting birthday as: %s", convDateToVCardDate( c.birthday() ).latin1() ); 565 qWarning("Exporting birthday as: %s", convDateToVCardDate( c.birthday() ).latin1() );
548 safeAddPropValue( vcard, VCBirthDateProp, convDateToVCardDate( c.birthday() ) ); 566 safeAddPropValue( vcard, VCBirthDateProp, convDateToVCardDate( c.birthday() ) );
549 } 567 }