-rw-r--r-- | libopie/pim/ocontactaccessbackend_vcard.cpp | 82 | ||||
-rw-r--r-- | libopie/pim/otodoaccessvcal.cpp | 7 |
2 files changed, 54 insertions, 35 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 @@ -18,4 +18,19 @@ * History: * $Log$ + * Revision 1.7 2003/02/16 22:25:46 zecke + * 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 + * * Revision 1.6 2003/01/13 15:49:31 eilers * Fixing crash when businesscard.vcf is missing.. @@ -54,8 +69,8 @@ OContactAccessBackend_VCard::OContactAccessBackend_VCard ( QString , QString fil bool OContactAccessBackend_VCard::load () -{ +{ m_map.clear(); m_dirty = false; - + VObject* obj = 0l; @@ -82,5 +97,5 @@ bool OContactAccessBackend_VCard::load () m_map.insert( con.uid(), con ); - + VObject *t = obj; obj = nextVObjectInList(obj); @@ -96,5 +111,5 @@ bool OContactAccessBackend_VCard::reload() } bool OContactAccessBackend_VCard::save() -{ +{ if (!m_dirty ) return true; @@ -118,5 +133,5 @@ bool OContactAccessBackend_VCard::save() m_dirty = false; return true; - + } @@ -138,5 +153,5 @@ bool OContactAccessBackend_VCard::remove ( int uid ) m_map.remove( uid ); m_dirty = true; - return true; + return true; } @@ -147,5 +162,5 @@ bool OContactAccessBackend_VCard::replace ( const OContact &contact ) return true; } - + OContact OContactAccessBackend_VCard::find ( int uid ) const { @@ -207,5 +222,5 @@ OContact OContactAccessBackend_VCard::parseVObject( VObject *obj ) { OContact c; - + VObjectIterator it; initPropIterator( &it, obj ); @@ -240,5 +255,5 @@ OContact OContactAccessBackend_VCard::parseVObject( VObject *obj ) QString postal; QString country; - + VObjectIterator nit; initPropIterator( &nit, o ); @@ -287,5 +302,5 @@ OContact OContactAccessBackend_VCard::parseVObject( VObject *obj ) }; int type = 0; - + VObjectIterator nit; initPropIterator( &nit, o ); @@ -315,6 +330,7 @@ OContact OContactAccessBackend_VCard::parseVObject( VObject *obj ) if ( ( type & (VOICE|CELL|FAX|PAGER) ) == 0 ) // default type |= VOICE; - - if ( (type & (VOICE|HOME) ) == (VOICE|HOME) ) + + qWarning("value %s %d", value.data(), type ); + if ( (type & (VOICE|HOME) ) == (VOICE|HOME) && (type & (CELL|HOME) ) != (CELL|HOME) ) c.setHomePhone( value ); if ( ( type & (FAX|HOME) ) == (FAX|HOME) ) @@ -322,5 +338,5 @@ OContact OContactAccessBackend_VCard::parseVObject( VObject *obj ) if ( ( type & (CELL|HOME) ) == (CELL|HOME) ) c.setHomeMobile( value ); - if ( ( type & (VOICE|WORK) ) == (VOICE|WORK) ) + if ( ( type & (VOICE|WORK) ) == (VOICE|WORK) && (type & (CELL|WORK) ) != (CELL|WORK) ) c.setBusinessPhone( value ); if ( ( type & (FAX|WORK) ) == (FAX|WORK) ) @@ -407,7 +423,7 @@ OContact OContactAccessBackend_VCard::parseVObject( VObject *obj ) // Reading Birthdate regarding RFC 2425 (5.8.4) c.setBirthday( convVCardDateToDate( value ) ); - + } - + #if 0 else { @@ -435,8 +451,8 @@ VObject* OContactAccessBackend_VCard::createVObject( const OContact &c ) safeAddPropValue( vcard, VCLastRevisedProp, TimeConversion::toISO8601( QDateTime::currentDateTime() ) ); safeAddPropValue( vcard, VCUniqueStringProp, QString::number(c.uid()) ); - + // full name safeAddPropValue( vcard, VCFullNameProp, c.fullName() ); - + // name properties VObject *name = safeAddProp( vcard, VCNameProp ); @@ -446,5 +462,5 @@ VObject* OContactAccessBackend_VCard::createVObject( const OContact &c ) safeAddPropValue( name, VCNamePrefixesProp, c.title() ); safeAddPropValue( name, VCNameSuffixesProp, c.suffix() ); - + // home properties VObject *home_adr= safeAddProp( vcard, VCAdrProp ); @@ -455,5 +471,5 @@ VObject* OContactAccessBackend_VCard::createVObject( const OContact &c ) safeAddPropValue( home_adr, VCPostalCodeProp, c.homeZip() ); safeAddPropValue( home_adr, VCCountryNameProp, c.homeCountry() ); - + VObject *home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homePhone() ); safeAddProp( home_phone, VCHomeProp ); @@ -464,8 +480,8 @@ VObject* OContactAccessBackend_VCard::createVObject( const OContact &c ) safeAddProp( home_phone, VCHomeProp ); safeAddProp( home_phone, VCFaxProp ); - + VObject *url = safeAddPropValue( vcard, VCURLProp, c.homeWebpage() ); safeAddProp( url, VCHomeProp ); - + // work properties VObject *work_adr= safeAddProp( vcard, VCAdrProp ); @@ -476,5 +492,5 @@ VObject* OContactAccessBackend_VCard::createVObject( const OContact &c ) safeAddPropValue( work_adr, VCPostalCodeProp, c.businessZip() ); safeAddPropValue( work_adr, VCCountryNameProp, c.businessCountry() ); - + VObject *work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPhone() ); safeAddProp( work_phone, VCWorkProp ); @@ -488,12 +504,12 @@ VObject* OContactAccessBackend_VCard::createVObject( const OContact &c ) safeAddProp( work_phone, VCWorkProp ); safeAddProp( work_phone, VCPagerProp ); - + url = safeAddPropValue( vcard, VCURLProp, c.businessWebpage() ); safeAddProp( url, VCWorkProp ); - + VObject *title = safeAddPropValue( vcard, VCTitleProp, c.jobTitle() ); safeAddProp( title, VCWorkProp ); - - + + QStringList emails = c.emailList(); emails.prepend( c.defaultEmail() ); @@ -502,7 +518,7 @@ VObject* OContactAccessBackend_VCard::createVObject( const OContact &c ) safeAddProp( email, VCInternetProp ); } - + safeAddPropValue( vcard, VCNoteProp, c.notes() ); - + // Exporting Birthday regarding RFC 2425 (5.8.4) if ( c.birthday().isValid() ){ @@ -510,5 +526,5 @@ VObject* OContactAccessBackend_VCard::createVObject( const OContact &c ) safeAddPropValue( vcard, VCBirthDateProp, convDateToVCardDate( c.birthday() ) ); } - + if ( !c.company().isEmpty() || !c.department().isEmpty() || !c.office().isEmpty() ) { VObject *org = safeAddProp( vcard, VCOrgProp ); @@ -517,10 +533,10 @@ VObject* OContactAccessBackend_VCard::createVObject( const OContact &c ) safeAddPropValue( org, VCOrgUnit2Prop, c.office() ); } - + // some values we have to export as custom fields safeAddPropValue( vcard, "X-Qtopia-Profession", c.profession() ); safeAddPropValue( vcard, "X-Qtopia-Manager", c.manager() ); safeAddPropValue( vcard, "X-Qtopia-Assistant", c.assistant() ); - + safeAddPropValue( vcard, "X-Qtopia-Spouse", c.spouse() ); safeAddPropValue( vcard, "X-Qtopia-Gender", c.gender() ); @@ -531,5 +547,5 @@ VObject* OContactAccessBackend_VCard::createVObject( const OContact &c ) safeAddPropValue( vcard, "X-Qtopia-Nickname", c.nickname() ); safeAddPropValue( vcard, "X-Qtopia-Children", c.children() ); - + return vcard; } @@ -545,5 +561,5 @@ QString OContactAccessBackend_VCard::convDateToVCardDate( const QDate& d ) const while ( ( pos = str_rfc2425.find (' ') ) > 0 ) str_rfc2425.replace( pos, 1, "0" ); - + return str_rfc2425; } 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 @@ -59,7 +59,10 @@ namespace { return 0l; - if( event.hasDueDate() ) + if( event.hasDueDate() ) { + QTime time(0, 0, 0); + QDateTime date(event.dueDate(), time ); addPropValue( task, VCDueProp, - TimeConversion::toISO8601( event.dueDate() ) ); + TimeConversion::toISO8601( date ) ); + } if( event.isCompleted() ) |