Diffstat (limited to 'libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp index af77a05..43e530a 100644 --- a/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp +++ b/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp | |||
@@ -158,63 +158,40 @@ OPimContact OPimContactAccessBackend_VCard::find ( int uid ) const | |||
158 | QArray<int> OPimContactAccessBackend_VCard::allRecords() const | 158 | QArray<int> OPimContactAccessBackend_VCard::allRecords() const |
159 | { | 159 | { |
160 | QArray<int> ar( m_map.count() ); | 160 | QArray<int> ar( m_map.count() ); |
161 | QMap<int, OPimContact>::ConstIterator it; | 161 | QMap<int, OPimContact>::ConstIterator it; |
162 | int i = 0; | 162 | int i = 0; |
163 | for ( it = m_map.begin(); it != m_map.end(); ++it ) { | 163 | for ( it = m_map.begin(); it != m_map.end(); ++it ) { |
164 | ar[i] = it.key(); | 164 | ar[i] = it.key(); |
165 | i++; | 165 | i++; |
166 | } | 166 | } |
167 | return ar; | 167 | return ar; |
168 | } | 168 | } |
169 | 169 | ||
170 | // Not implemented | ||
171 | QArray<int> OPimContactAccessBackend_VCard::queryByExample ( const OPimContact&, int, const QDateTime& ) | ||
172 | { | ||
173 | QArray<int> ar(0); | ||
174 | return ar; | ||
175 | } | ||
176 | |||
177 | // Not implemented | ||
178 | QArray<int> OPimContactAccessBackend_VCard::matchRegexp( const QRegExp& ) const | ||
179 | { | ||
180 | QArray<int> ar(0); | ||
181 | return ar; | ||
182 | } | ||
183 | |||
184 | const uint OPimContactAccessBackend_VCard::querySettings() | 170 | const uint OPimContactAccessBackend_VCard::querySettings() |
185 | { | 171 | { |
186 | return 0; // No search possible | 172 | return 0; // No search possible |
187 | } | 173 | } |
188 | 174 | ||
189 | bool OPimContactAccessBackend_VCard::hasQuerySettings (uint ) const | 175 | bool OPimContactAccessBackend_VCard::hasQuerySettings (uint ) const |
190 | { | 176 | { |
191 | return false; // No search possible, therefore all settings invalid ;) | 177 | return false; // No search possible, therefore all settings invalid ;) |
192 | } | 178 | } |
193 | 179 | ||
194 | bool OPimContactAccessBackend_VCard::wasChangedExternally() | 180 | bool OPimContactAccessBackend_VCard::wasChangedExternally() |
195 | { | 181 | { |
196 | return false; // Don't expect concurrent access | 182 | return false; // Don't expect concurrent access |
197 | } | 183 | } |
198 | 184 | ||
199 | // Not implemented | ||
200 | QArray<int> OPimContactAccessBackend_VCard::sorted( bool , int, int, int ) | ||
201 | { | ||
202 | QArray<int> ar(0); | ||
203 | return ar; | ||
204 | } | ||
205 | |||
206 | // *** Private stuff *** | 185 | // *** Private stuff *** |
207 | |||
208 | |||
209 | OPimContact OPimContactAccessBackend_VCard::parseVObject( VObject *obj ) | 186 | OPimContact OPimContactAccessBackend_VCard::parseVObject( VObject *obj ) |
210 | { | 187 | { |
211 | OPimContact c; | 188 | OPimContact c; |
212 | 189 | ||
213 | VObjectIterator it; | 190 | VObjectIterator it; |
214 | initPropIterator( &it, obj ); | 191 | initPropIterator( &it, obj ); |
215 | while( moreIteration( &it ) ) { | 192 | while( moreIteration( &it ) ) { |
216 | VObject *o = nextVObject( &it ); | 193 | VObject *o = nextVObject( &it ); |
217 | QCString name = vObjectName( o ); | 194 | QCString name = vObjectName( o ); |
218 | QString value = QString::fromUtf8( vObjectStringZValue( o ) ); | 195 | QString value = QString::fromUtf8( vObjectStringZValue( o ) ); |
219 | odebug << "(1)Read: %s" << QString( value ).latin1() << oendl; | 196 | odebug << "(1)Read: %s" << QString( value ).latin1() << oendl; |
220 | if ( name == VCNameProp ) { | 197 | if ( name == VCNameProp ) { |
@@ -311,25 +288,24 @@ OPimContact OPimContactAccessBackend_VCard::parseVObject( VObject *obj ) | |||
311 | type |= PAGER; | 288 | type |= PAGER; |
312 | else if ( name == VCPreferredProp ) | 289 | else if ( name == VCPreferredProp ) |
313 | ; | 290 | ; |
314 | else | 291 | else |
315 | type |= UNKNOWN; | 292 | type |= UNKNOWN; |
316 | } | 293 | } |
317 | if ( (type & UNKNOWN) != UNKNOWN ) { | 294 | if ( (type & UNKNOWN) != UNKNOWN ) { |
318 | if ( ( type & (HOME|WORK) ) == 0 ) // default | 295 | if ( ( type & (HOME|WORK) ) == 0 ) // default |
319 | type |= HOME; | 296 | type |= HOME; |
320 | if ( ( type & (VOICE|CELL|FAX|PAGER) ) == 0 ) // default | 297 | if ( ( type & (VOICE|CELL|FAX|PAGER) ) == 0 ) // default |
321 | type |= VOICE; | 298 | type |= VOICE; |
322 | 299 | ||
323 | owarn << "value %s %d" << value.data() << type << oendl; | ||
324 | if ( (type & (VOICE|HOME) ) == (VOICE|HOME) && (type & (CELL|HOME) ) != (CELL|HOME) ) | 300 | if ( (type & (VOICE|HOME) ) == (VOICE|HOME) && (type & (CELL|HOME) ) != (CELL|HOME) ) |
325 | c.setHomePhone( value ); | 301 | c.setHomePhone( value ); |
326 | if ( ( type & (FAX|HOME) ) == (FAX|HOME) ) | 302 | if ( ( type & (FAX|HOME) ) == (FAX|HOME) ) |
327 | c.setHomeFax( value ); | 303 | c.setHomeFax( value ); |
328 | if ( ( type & (CELL|HOME) ) == (CELL|HOME) ) | 304 | if ( ( type & (CELL|HOME) ) == (CELL|HOME) ) |
329 | c.setHomeMobile( value ); | 305 | c.setHomeMobile( value ); |
330 | if ( ( type & (VOICE|WORK) ) == (VOICE|WORK) && (type & (CELL|WORK) ) != (CELL|WORK) ) | 306 | if ( ( type & (VOICE|WORK) ) == (VOICE|WORK) && (type & (CELL|WORK) ) != (CELL|WORK) ) |
331 | c.setBusinessPhone( value ); | 307 | c.setBusinessPhone( value ); |
332 | if ( ( type & (FAX|WORK) ) == (FAX|WORK) ) | 308 | if ( ( type & (FAX|WORK) ) == (FAX|WORK) ) |
333 | c.setBusinessFax( value ); | 309 | c.setBusinessFax( value ); |
334 | if ( ( type & (CELL|WORK) ) == (CELL|WORK) ) | 310 | if ( ( type & (CELL|WORK) ) == (CELL|WORK) ) |
335 | c.setBusinessMobile( value ); | 311 | c.setBusinessMobile( value ); |
@@ -516,44 +492,42 @@ VObject* OPimContactAccessBackend_VCard::createVObject( const OPimContact &c ) | |||
516 | 492 | ||
517 | QStringList emails = c.emailList(); | 493 | QStringList emails = c.emailList(); |
518 | // emails.prepend( c.defaultEmail() ); Fix for bugreport #1045 | 494 | // emails.prepend( c.defaultEmail() ); Fix for bugreport #1045 |
519 | for( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) { | 495 | for( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) { |
520 | VObject *email = safeAddPropValue( vcard, VCEmailAddressProp, *it ); | 496 | VObject *email = safeAddPropValue( vcard, VCEmailAddressProp, *it ); |
521 | safeAddProp( email, VCInternetProp ); | 497 | safeAddProp( email, VCInternetProp ); |
522 | } | 498 | } |
523 | 499 | ||
524 | safeAddPropValue( vcard, VCNoteProp, c.notes() ); | 500 | safeAddPropValue( vcard, VCNoteProp, c.notes() ); |
525 | 501 | ||
526 | // Exporting Birthday regarding RFC 2425 (5.8.4) | 502 | // Exporting Birthday regarding RFC 2425 (5.8.4) |
527 | if ( c.birthday().isValid() ){ | 503 | if ( c.birthday().isValid() ){ |
528 | owarn << "Exporting birthday as: " << convDateToVCardDate( c.birthday() ) << "" << oendl; | ||
529 | safeAddPropValue( vcard, VCBirthDateProp, convDateToVCardDate( c.birthday() ) ); | 504 | safeAddPropValue( vcard, VCBirthDateProp, convDateToVCardDate( c.birthday() ) ); |
530 | } | 505 | } |
531 | 506 | ||
532 | if ( !c.company().isEmpty() || !c.department().isEmpty() || !c.office().isEmpty() ) { | 507 | if ( !c.company().isEmpty() || !c.department().isEmpty() || !c.office().isEmpty() ) { |
533 | VObject *org = safeAddProp( vcard, VCOrgProp ); | 508 | VObject *org = safeAddProp( vcard, VCOrgProp ); |
534 | safeAddPropValue( org, VCOrgNameProp, c.company() ); | 509 | safeAddPropValue( org, VCOrgNameProp, c.company() ); |
535 | safeAddPropValue( org, VCOrgUnitProp, c.department() ); | 510 | safeAddPropValue( org, VCOrgUnitProp, c.department() ); |
536 | safeAddPropValue( org, VCOrgUnit2Prop, c.office() ); | 511 | safeAddPropValue( org, VCOrgUnit2Prop, c.office() ); |
537 | } | 512 | } |
538 | 513 | ||
539 | // some values we have to export as custom fields | 514 | // some values we have to export as custom fields |
540 | safeAddPropValue( vcard, "X-Qtopia-Profession", c.profession() ); | 515 | safeAddPropValue( vcard, "X-Qtopia-Profession", c.profession() ); |
541 | safeAddPropValue( vcard, "X-Qtopia-Manager", c.manager() ); | 516 | safeAddPropValue( vcard, "X-Qtopia-Manager", c.manager() ); |
542 | safeAddPropValue( vcard, "X-Qtopia-Assistant", c.assistant() ); | 517 | safeAddPropValue( vcard, "X-Qtopia-Assistant", c.assistant() ); |
543 | 518 | ||
544 | safeAddPropValue( vcard, "X-Qtopia-Spouse", c.spouse() ); | 519 | safeAddPropValue( vcard, "X-Qtopia-Spouse", c.spouse() ); |
545 | safeAddPropValue( vcard, "X-Qtopia-Gender", c.gender() ); | 520 | safeAddPropValue( vcard, "X-Qtopia-Gender", c.gender() ); |
546 | if ( c.anniversary().isValid() ){ | 521 | if ( c.anniversary().isValid() ){ |
547 | owarn << "Exporting anniversary as: " << convDateToVCardDate( c.anniversary() ) << "" << oendl; | ||
548 | safeAddPropValue( vcard, "X-Qtopia-Anniversary", convDateToVCardDate( c.anniversary() ) ); | 522 | safeAddPropValue( vcard, "X-Qtopia-Anniversary", convDateToVCardDate( c.anniversary() ) ); |
549 | } | 523 | } |
550 | safeAddPropValue( vcard, "X-Qtopia-Nickname", c.nickname() ); | 524 | safeAddPropValue( vcard, "X-Qtopia-Nickname", c.nickname() ); |
551 | safeAddPropValue( vcard, "X-Qtopia-Children", c.children() ); | 525 | safeAddPropValue( vcard, "X-Qtopia-Children", c.children() ); |
552 | 526 | ||
553 | return vcard; | 527 | return vcard; |
554 | } | 528 | } |
555 | 529 | ||
556 | QString OPimContactAccessBackend_VCard::convDateToVCardDate( const QDate& d ) const | 530 | QString OPimContactAccessBackend_VCard::convDateToVCardDate( const QDate& d ) const |
557 | { | 531 | { |
558 | QString str_rfc2425 = QString("%1-%2-%3") | 532 | QString str_rfc2425 = QString("%1-%2-%3") |
559 | .arg( d.year() ) | 533 | .arg( d.year() ) |