author | zecke <zecke> | 2003-02-16 22:25:46 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-02-16 22:25:46 (UTC) |
commit | 4d0e8ffd8518fe24ed94cfcf92eeff666b014094 (patch) (side-by-side diff) | |
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 @@ -14,12 +14,27 @@ * * ===================================================================== * Version: $Id$ * ===================================================================== * 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.. * * Revision 1.5 2002/12/07 13:26:22 eilers * Fixing bug in storing anniversary.. * @@ -50,16 +65,16 @@ OContactAccessBackend_VCard::OContactAccessBackend_VCard ( QString , QString fil { load(); } bool OContactAccessBackend_VCard::load () -{ +{ m_map.clear(); m_dirty = false; - + VObject* obj = 0l; if ( QFile( m_file ).exists() ){ obj = Parse_MIME_FromFileName( QFile::encodeName(m_file).data() ); if ( !obj ) return false; @@ -78,13 +93,13 @@ bool OContactAccessBackend_VCard::load () if ( con.uid() == 0 ){ con.setUid( 1 ); qWarning("assigned new uid %d",con.uid() ); } m_map.insert( con.uid(), con ); - + VObject *t = obj; obj = nextVObjectInList(obj); cleanVObject( t ); } return true; @@ -92,13 +107,13 @@ bool OContactAccessBackend_VCard::load () } bool OContactAccessBackend_VCard::reload() { return load(); } bool OContactAccessBackend_VCard::save() -{ +{ if (!m_dirty ) return true; QFileDirect file( m_file ); if (!file.open(IO_WriteOnly ) ) return false; @@ -114,13 +129,13 @@ bool OContactAccessBackend_VCard::save() cleanVObject( vo ); } cleanStrTbl(); m_dirty = false; return true; - + } void OContactAccessBackend_VCard::clear () { m_map.clear(); m_dirty = true; // ??? sure ? (se) @@ -134,22 +149,22 @@ bool OContactAccessBackend_VCard::add ( const OContact& newcontact ) } bool OContactAccessBackend_VCard::remove ( int uid ) { m_map.remove( uid ); m_dirty = true; - return true; + return true; } bool OContactAccessBackend_VCard::replace ( const OContact &contact ) { m_map.replace( contact.uid(), contact ); m_dirty = true; return true; } - + OContact OContactAccessBackend_VCard::find ( int uid ) const { return m_map[uid]; } QArray<int> OContactAccessBackend_VCard::allRecords() const @@ -203,13 +218,13 @@ QArray<int> OContactAccessBackend_VCard::sorted( bool , int, int, int ) // *** Private stuff *** OContact OContactAccessBackend_VCard::parseVObject( VObject *obj ) { OContact c; - + VObjectIterator it; initPropIterator( &it, obj ); while( moreIteration( &it ) ) { VObject *o = nextVObject( &it ); QCString name = vObjectName( o ); QCString value = vObjectStringZValue( o ); @@ -236,13 +251,13 @@ OContact OContactAccessBackend_VCard::parseVObject( VObject *obj ) bool work = TRUE; // default address is work address QString street; QString city; QString region; QString postal; QString country; - + VObjectIterator nit; initPropIterator( &nit, o ); while( moreIteration( &nit ) ) { VObject *o = nextVObject( &nit ); QCString name = vObjectName( o ); QString value = vObjectStringZValue( o ); @@ -283,13 +298,13 @@ OContact OContactAccessBackend_VCard::parseVObject( VObject *obj ) CELL = 0x08, FAX = 0x10, PAGER = 0x20, UNKNOWN = 0x80 }; int type = 0; - + VObjectIterator nit; initPropIterator( &nit, o ); while( moreIteration( &nit ) ) { VObject *o = nextVObject( &nit ); QCString name = vObjectTypeInfo( o ); if ( name == VCHomeProp ) @@ -311,20 +326,21 @@ OContact OContactAccessBackend_VCard::parseVObject( VObject *obj ) } if ( (type & UNKNOWN) != UNKNOWN ) { if ( ( type & (HOME|WORK) ) == 0 ) // default type |= HOME; 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) ) c.setHomeFax( value ); 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) ) c.setBusinessFax( value ); if ( ( type & (CELL|WORK) ) == (CELL|WORK) ) c.setBusinessMobile( value ); if ( ( type & (PAGER|WORK) ) == (PAGER|WORK) ) @@ -403,15 +419,15 @@ OContact OContactAccessBackend_VCard::parseVObject( VObject *obj ) else if ( name == "X-Qtopia-Children" ) { c.setChildren( value ); } else if ( name == VCBirthDateProp ) { // Reading Birthdate regarding RFC 2425 (5.8.4) c.setBirthday( convVCardDateToDate( value ) ); - + } - + #if 0 else { printf("Name: %s, value=%s\n", name.data(), vObjectStringZValue( o ) ); VObjectIterator nit; initPropIterator( &nit, o ); while( moreIteration( &nit ) ) { @@ -431,109 +447,109 @@ OContact OContactAccessBackend_VCard::parseVObject( VObject *obj ) VObject* OContactAccessBackend_VCard::createVObject( const OContact &c ) { VObject *vcard = newVObject( VCCardProp ); safeAddPropValue( vcard, VCVersionProp, "2.1" ); 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 ); safeAddPropValue( name, VCFamilyNameProp, c.lastName() ); safeAddPropValue( name, VCGivenNameProp, c.firstName() ); safeAddPropValue( name, VCAdditionalNamesProp, c.middleName() ); safeAddPropValue( name, VCNamePrefixesProp, c.title() ); safeAddPropValue( name, VCNameSuffixesProp, c.suffix() ); - + // home properties VObject *home_adr= safeAddProp( vcard, VCAdrProp ); safeAddProp( home_adr, VCHomeProp ); safeAddPropValue( home_adr, VCStreetAddressProp, c.homeStreet() ); safeAddPropValue( home_adr, VCCityProp, c.homeCity() ); safeAddPropValue( home_adr, VCRegionProp, c.homeState() ); safeAddPropValue( home_adr, VCPostalCodeProp, c.homeZip() ); safeAddPropValue( home_adr, VCCountryNameProp, c.homeCountry() ); - + VObject *home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homePhone() ); safeAddProp( home_phone, VCHomeProp ); home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homeMobile() ); safeAddProp( home_phone, VCHomeProp ); safeAddProp( home_phone, VCCellularProp ); home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homeFax() ); 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 ); safeAddProp( work_adr, VCWorkProp ); safeAddPropValue( work_adr, VCStreetAddressProp, c.businessStreet() ); safeAddPropValue( work_adr, VCCityProp, c.businessCity() ); safeAddPropValue( work_adr, VCRegionProp, c.businessState() ); safeAddPropValue( work_adr, VCPostalCodeProp, c.businessZip() ); safeAddPropValue( work_adr, VCCountryNameProp, c.businessCountry() ); - + VObject *work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPhone() ); safeAddProp( work_phone, VCWorkProp ); work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessMobile() ); safeAddProp( work_phone, VCWorkProp ); safeAddProp( work_phone, VCCellularProp ); work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessFax() ); safeAddProp( work_phone, VCWorkProp ); safeAddProp( work_phone, VCFaxProp ); work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPager() ); 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() ); for( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) { VObject *email = safeAddPropValue( vcard, VCEmailAddressProp, *it ); safeAddProp( email, VCInternetProp ); } - + safeAddPropValue( vcard, VCNoteProp, c.notes() ); - + // Exporting Birthday regarding RFC 2425 (5.8.4) if ( c.birthday().isValid() ){ qWarning("Exporting birthday as: %s", convDateToVCardDate( c.birthday() ).latin1() ); safeAddPropValue( vcard, VCBirthDateProp, convDateToVCardDate( c.birthday() ) ); } - + if ( !c.company().isEmpty() || !c.department().isEmpty() || !c.office().isEmpty() ) { VObject *org = safeAddProp( vcard, VCOrgProp ); safeAddPropValue( org, VCOrgNameProp, c.company() ); safeAddPropValue( org, VCOrgUnitProp, c.department() ); 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() ); if ( c.anniversary().isValid() ){ qWarning("Exporting anniversary as: %s", convDateToVCardDate( c.anniversary() ).latin1() ); safeAddPropValue( vcard, "X-Qtopia-Anniversary", convDateToVCardDate( c.anniversary() ) ); } safeAddPropValue( vcard, "X-Qtopia-Nickname", c.nickname() ); safeAddPropValue( vcard, "X-Qtopia-Children", c.children() ); - + return vcard; } QString OContactAccessBackend_VCard::convDateToVCardDate( const QDate& d ) const { QString str_rfc2425 = QString("%1-%2-%3") @@ -541,13 +557,13 @@ QString OContactAccessBackend_VCard::convDateToVCardDate( const QDate& d ) const .arg( d.month(), 2 ) .arg( d.day(), 2 ); // Now replace spaces with "0"... int pos = 0; while ( ( pos = str_rfc2425.find (' ') ) > 0 ) str_rfc2425.replace( pos, 1, "0" ); - + return str_rfc2425; } QDate OContactAccessBackend_VCard::convVCardDateToDate( const QString& datestr ) { int monthPos = datestr.find('-'); 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 @@ -55,15 +55,18 @@ namespace { }; static VObject *vobjByEvent( const OTodo &event ) { VObject *task = newVObject( VCTodoProp ); if( task == 0 ) 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() ) addPropValue( task, VCStatusProp, "COMPLETED"); QString string = QString::number(event.priority() ); addPropValue( task, VCPriorityProp, string.local8Bit() ); 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 @@ -14,12 +14,27 @@ * * ===================================================================== * Version: $Id$ * ===================================================================== * 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.. * * Revision 1.5 2002/12/07 13:26:22 eilers * Fixing bug in storing anniversary.. * @@ -50,16 +65,16 @@ OContactAccessBackend_VCard::OContactAccessBackend_VCard ( QString , QString fil { load(); } bool OContactAccessBackend_VCard::load () -{ +{ m_map.clear(); m_dirty = false; - + VObject* obj = 0l; if ( QFile( m_file ).exists() ){ obj = Parse_MIME_FromFileName( QFile::encodeName(m_file).data() ); if ( !obj ) return false; @@ -78,13 +93,13 @@ bool OContactAccessBackend_VCard::load () if ( con.uid() == 0 ){ con.setUid( 1 ); qWarning("assigned new uid %d",con.uid() ); } m_map.insert( con.uid(), con ); - + VObject *t = obj; obj = nextVObjectInList(obj); cleanVObject( t ); } return true; @@ -92,13 +107,13 @@ bool OContactAccessBackend_VCard::load () } bool OContactAccessBackend_VCard::reload() { return load(); } bool OContactAccessBackend_VCard::save() -{ +{ if (!m_dirty ) return true; QFileDirect file( m_file ); if (!file.open(IO_WriteOnly ) ) return false; @@ -114,13 +129,13 @@ bool OContactAccessBackend_VCard::save() cleanVObject( vo ); } cleanStrTbl(); m_dirty = false; return true; - + } void OContactAccessBackend_VCard::clear () { m_map.clear(); m_dirty = true; // ??? sure ? (se) @@ -134,22 +149,22 @@ bool OContactAccessBackend_VCard::add ( const OContact& newcontact ) } bool OContactAccessBackend_VCard::remove ( int uid ) { m_map.remove( uid ); m_dirty = true; - return true; + return true; } bool OContactAccessBackend_VCard::replace ( const OContact &contact ) { m_map.replace( contact.uid(), contact ); m_dirty = true; return true; } - + OContact OContactAccessBackend_VCard::find ( int uid ) const { return m_map[uid]; } QArray<int> OContactAccessBackend_VCard::allRecords() const @@ -203,13 +218,13 @@ QArray<int> OContactAccessBackend_VCard::sorted( bool , int, int, int ) // *** Private stuff *** OContact OContactAccessBackend_VCard::parseVObject( VObject *obj ) { OContact c; - + VObjectIterator it; initPropIterator( &it, obj ); while( moreIteration( &it ) ) { VObject *o = nextVObject( &it ); QCString name = vObjectName( o ); QCString value = vObjectStringZValue( o ); @@ -236,13 +251,13 @@ OContact OContactAccessBackend_VCard::parseVObject( VObject *obj ) bool work = TRUE; // default address is work address QString street; QString city; QString region; QString postal; QString country; - + VObjectIterator nit; initPropIterator( &nit, o ); while( moreIteration( &nit ) ) { VObject *o = nextVObject( &nit ); QCString name = vObjectName( o ); QString value = vObjectStringZValue( o ); @@ -283,13 +298,13 @@ OContact OContactAccessBackend_VCard::parseVObject( VObject *obj ) CELL = 0x08, FAX = 0x10, PAGER = 0x20, UNKNOWN = 0x80 }; int type = 0; - + VObjectIterator nit; initPropIterator( &nit, o ); while( moreIteration( &nit ) ) { VObject *o = nextVObject( &nit ); QCString name = vObjectTypeInfo( o ); if ( name == VCHomeProp ) @@ -311,20 +326,21 @@ OContact OContactAccessBackend_VCard::parseVObject( VObject *obj ) } if ( (type & UNKNOWN) != UNKNOWN ) { if ( ( type & (HOME|WORK) ) == 0 ) // default type |= HOME; 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) ) c.setHomeFax( value ); 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) ) c.setBusinessFax( value ); if ( ( type & (CELL|WORK) ) == (CELL|WORK) ) c.setBusinessMobile( value ); if ( ( type & (PAGER|WORK) ) == (PAGER|WORK) ) @@ -403,15 +419,15 @@ OContact OContactAccessBackend_VCard::parseVObject( VObject *obj ) else if ( name == "X-Qtopia-Children" ) { c.setChildren( value ); } else if ( name == VCBirthDateProp ) { // Reading Birthdate regarding RFC 2425 (5.8.4) c.setBirthday( convVCardDateToDate( value ) ); - + } - + #if 0 else { printf("Name: %s, value=%s\n", name.data(), vObjectStringZValue( o ) ); VObjectIterator nit; initPropIterator( &nit, o ); while( moreIteration( &nit ) ) { @@ -431,109 +447,109 @@ OContact OContactAccessBackend_VCard::parseVObject( VObject *obj ) VObject* OContactAccessBackend_VCard::createVObject( const OContact &c ) { VObject *vcard = newVObject( VCCardProp ); safeAddPropValue( vcard, VCVersionProp, "2.1" ); 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 ); safeAddPropValue( name, VCFamilyNameProp, c.lastName() ); safeAddPropValue( name, VCGivenNameProp, c.firstName() ); safeAddPropValue( name, VCAdditionalNamesProp, c.middleName() ); safeAddPropValue( name, VCNamePrefixesProp, c.title() ); safeAddPropValue( name, VCNameSuffixesProp, c.suffix() ); - + // home properties VObject *home_adr= safeAddProp( vcard, VCAdrProp ); safeAddProp( home_adr, VCHomeProp ); safeAddPropValue( home_adr, VCStreetAddressProp, c.homeStreet() ); safeAddPropValue( home_adr, VCCityProp, c.homeCity() ); safeAddPropValue( home_adr, VCRegionProp, c.homeState() ); safeAddPropValue( home_adr, VCPostalCodeProp, c.homeZip() ); safeAddPropValue( home_adr, VCCountryNameProp, c.homeCountry() ); - + VObject *home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homePhone() ); safeAddProp( home_phone, VCHomeProp ); home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homeMobile() ); safeAddProp( home_phone, VCHomeProp ); safeAddProp( home_phone, VCCellularProp ); home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homeFax() ); 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 ); safeAddProp( work_adr, VCWorkProp ); safeAddPropValue( work_adr, VCStreetAddressProp, c.businessStreet() ); safeAddPropValue( work_adr, VCCityProp, c.businessCity() ); safeAddPropValue( work_adr, VCRegionProp, c.businessState() ); safeAddPropValue( work_adr, VCPostalCodeProp, c.businessZip() ); safeAddPropValue( work_adr, VCCountryNameProp, c.businessCountry() ); - + VObject *work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPhone() ); safeAddProp( work_phone, VCWorkProp ); work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessMobile() ); safeAddProp( work_phone, VCWorkProp ); safeAddProp( work_phone, VCCellularProp ); work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessFax() ); safeAddProp( work_phone, VCWorkProp ); safeAddProp( work_phone, VCFaxProp ); work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPager() ); 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() ); for( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) { VObject *email = safeAddPropValue( vcard, VCEmailAddressProp, *it ); safeAddProp( email, VCInternetProp ); } - + safeAddPropValue( vcard, VCNoteProp, c.notes() ); - + // Exporting Birthday regarding RFC 2425 (5.8.4) if ( c.birthday().isValid() ){ qWarning("Exporting birthday as: %s", convDateToVCardDate( c.birthday() ).latin1() ); safeAddPropValue( vcard, VCBirthDateProp, convDateToVCardDate( c.birthday() ) ); } - + if ( !c.company().isEmpty() || !c.department().isEmpty() || !c.office().isEmpty() ) { VObject *org = safeAddProp( vcard, VCOrgProp ); safeAddPropValue( org, VCOrgNameProp, c.company() ); safeAddPropValue( org, VCOrgUnitProp, c.department() ); 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() ); if ( c.anniversary().isValid() ){ qWarning("Exporting anniversary as: %s", convDateToVCardDate( c.anniversary() ).latin1() ); safeAddPropValue( vcard, "X-Qtopia-Anniversary", convDateToVCardDate( c.anniversary() ) ); } safeAddPropValue( vcard, "X-Qtopia-Nickname", c.nickname() ); safeAddPropValue( vcard, "X-Qtopia-Children", c.children() ); - + return vcard; } QString OContactAccessBackend_VCard::convDateToVCardDate( const QDate& d ) const { QString str_rfc2425 = QString("%1-%2-%3") @@ -541,13 +557,13 @@ QString OContactAccessBackend_VCard::convDateToVCardDate( const QDate& d ) const .arg( d.month(), 2 ) .arg( d.day(), 2 ); // Now replace spaces with "0"... int pos = 0; while ( ( pos = str_rfc2425.find (' ') ) > 0 ) str_rfc2425.replace( pos, 1, "0" ); - + return str_rfc2425; } QDate OContactAccessBackend_VCard::convVCardDateToDate( const QString& datestr ) { int monthPos = datestr.find('-'); 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 @@ -55,15 +55,18 @@ namespace { }; static VObject *vobjByEvent( const OTodo &event ) { VObject *task = newVObject( VCTodoProp ); if( task == 0 ) 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() ) addPropValue( task, VCStatusProp, "COMPLETED"); QString string = QString::number(event.priority() ); addPropValue( task, VCPriorityProp, string.local8Bit() ); |