author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /kabc/vcard21parser.cpp | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2 |
initial public commit of qt4 portp1
-rw-r--r-- | kabc/vcard21parser.cpp | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/kabc/vcard21parser.cpp b/kabc/vcard21parser.cpp index 60d02b8..e24a9dc 100644 --- a/kabc/vcard21parser.cpp +++ b/kabc/vcard21parser.cpp | |||
@@ -14,51 +14,53 @@ | |||
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <qmap.h> | 28 | #include <qmap.h> |
29 | #include <qregexp.h> | 29 | #include <qregexp.h> |
30 | //Added by qt3to4: | ||
31 | #include <Q3ValueList> | ||
30 | #include <kmdcodec.h> | 32 | #include <kmdcodec.h> |
31 | 33 | ||
32 | #include "vcard21parser.h" | 34 | #include "vcard21parser.h" |
33 | #include "vcardconverter.h" | 35 | #include "vcardconverter.h" |
34 | 36 | ||
35 | using namespace KABC; | 37 | using namespace KABC; |
36 | 38 | ||
37 | bool VCardLineX::isValid() const | 39 | bool VCardLineX::isValid() const |
38 | { | 40 | { |
39 | // Invalid: if it is "begin:vcard" or "end:vcard" | 41 | // Invalid: if it is "begin:vcard" or "end:vcard" |
40 | if ( name == VCARD_BEGIN_N || name == VCARD_END_N ) | 42 | if ( name == VCARD_BEGIN_N || name == VCARD_END_N ) |
41 | return false; | 43 | return false; |
42 | 44 | ||
43 | if ( name[0] == 'x' && name[1] == '-' ) // A custom x- line | 45 | if ( name[0] == 'x' && name[1] == '-' ) // A custom x- line |
44 | return true; | 46 | return true; |
45 | 47 | ||
46 | // This is long but it makes it a bit faster (and saves me from using | 48 | // This is long but it makes it a bit faster (and saves me from using |
47 | // a tree which is probably the ideal situation, but a bit memory heavy) | 49 | // a tree which is probably the ideal situation, but a bit memory heavy) |
48 | switch( name[0] ) { | 50 | switch( name[0].unicode() ) { |
49 | case 'a': | 51 | case 'a': |
50 | if ( name == VCARD_ADR && qualified && | 52 | if ( name == VCARD_ADR && qualified && |
51 | (qualifiers.contains(VCARD_ADR_DOM) || | 53 | (qualifiers.contains(VCARD_ADR_DOM) || |
52 | qualifiers.contains(VCARD_ADR_INTL) || | 54 | qualifiers.contains(VCARD_ADR_INTL) || |
53 | qualifiers.contains(VCARD_ADR_POSTAL) || | 55 | qualifiers.contains(VCARD_ADR_POSTAL) || |
54 | qualifiers.contains(VCARD_ADR_HOME) || | 56 | qualifiers.contains(VCARD_ADR_HOME) || |
55 | qualifiers.contains(VCARD_ADR_WORK) || | 57 | qualifiers.contains(VCARD_ADR_WORK) || |
56 | qualifiers.contains(VCARD_ADR_PREF) | 58 | qualifiers.contains(VCARD_ADR_PREF) |
57 | ) ) | 59 | ) ) |
58 | return true; | 60 | return true; |
59 | 61 | ||
60 | if ( name == VCARD_AGENT ) | 62 | if ( name == VCARD_AGENT ) |
61 | return true; | 63 | return true; |
62 | break; | 64 | break; |
63 | 65 | ||
64 | case 'b': | 66 | case 'b': |
@@ -256,33 +258,33 @@ KABC::Addressee VCard21Parser::readFromString( const QString &data) | |||
256 | addressee.insertEmail(tmpStr, false); | 258 | addressee.insertEmail(tmpStr, false); |
257 | tmpStr = mVCard->getValue(VCARD_EMAIL,VCARD_EMAIL_PREF); | 259 | tmpStr = mVCard->getValue(VCARD_EMAIL,VCARD_EMAIL_PREF); |
258 | addressee.insertEmail(tmpStr, true); | 260 | addressee.insertEmail(tmpStr, true); |
259 | //set the addressee's url | 261 | //set the addressee's url |
260 | tmpStr = mVCard->getValue(VCARD_URL); | 262 | tmpStr = mVCard->getValue(VCARD_URL); |
261 | if (tmpStr.isEmpty()) tmpStr = mVCard->getValue(VCARD_URL, VCARD_ADR_WORK); | 263 | if (tmpStr.isEmpty()) tmpStr = mVCard->getValue(VCARD_URL, VCARD_ADR_WORK); |
262 | if (tmpStr.isEmpty()) tmpStr = mVCard->getValue(VCARD_URL, VCARD_ADR_HOME); | 264 | if (tmpStr.isEmpty()) tmpStr = mVCard->getValue(VCARD_URL, VCARD_ADR_HOME); |
263 | if (!tmpStr.isEmpty()) { | 265 | if (!tmpStr.isEmpty()) { |
264 | addressee.setUrl(KURL(tmpStr)); | 266 | addressee.setUrl(KURL(tmpStr)); |
265 | } | 267 | } |
266 | 268 | ||
267 | //set the addressee's birthday | 269 | //set the addressee's birthday |
268 | tmpStr = mVCard->getValue(VCARD_BDAY); | 270 | tmpStr = mVCard->getValue(VCARD_BDAY); |
269 | addressee.setBirthday(VCardStringToDate(tmpStr)); | 271 | addressee.setBirthday(VCardStringToDate(tmpStr)); |
270 | 272 | ||
271 | //set the addressee's phone numbers | 273 | //set the addressee's phone numbers |
272 | for ( QValueListIterator<VCardLineX> i = mVCard->_vcdata->begin();i != mVCard->_vcdata->end(); ++i ) { | 274 | for ( Q3ValueListIterator<VCardLineX> i = mVCard->_vcdata->begin();i != mVCard->_vcdata->end(); ++i ) { |
273 | if ( (*i).name == VCARD_TEL ) { | 275 | if ( (*i).name == VCARD_TEL ) { |
274 | int type = 0; | 276 | int type = 0; |
275 | if ( (*i).qualified ) { | 277 | if ( (*i).qualified ) { |
276 | if ( (*i).qualifiers.contains( VCARD_TEL_HOME ) ) | 278 | if ( (*i).qualifiers.contains( VCARD_TEL_HOME ) ) |
277 | type |= PhoneNumber::Home; | 279 | type |= PhoneNumber::Home; |
278 | if ( (*i).qualifiers.contains( VCARD_TEL_WORK ) ) | 280 | if ( (*i).qualifiers.contains( VCARD_TEL_WORK ) ) |
279 | type |= PhoneNumber::Work; | 281 | type |= PhoneNumber::Work; |
280 | if ( (*i).qualifiers.contains( VCARD_TEL_PREF ) ) | 282 | if ( (*i).qualifiers.contains( VCARD_TEL_PREF ) ) |
281 | type |= PhoneNumber::Pref; | 283 | type |= PhoneNumber::Pref; |
282 | if ( (*i).qualifiers.contains( VCARD_TEL_VOICE ) ) | 284 | if ( (*i).qualifiers.contains( VCARD_TEL_VOICE ) ) |
283 | type |= PhoneNumber::Voice; | 285 | type |= PhoneNumber::Voice; |
284 | if ( (*i).qualifiers.contains( VCARD_TEL_FAX ) ) | 286 | if ( (*i).qualifiers.contains( VCARD_TEL_FAX ) ) |
285 | type |= PhoneNumber::Fax; | 287 | type |= PhoneNumber::Fax; |
286 | if ( (*i).qualifiers.contains( VCARD_TEL_MSG ) ) | 288 | if ( (*i).qualifiers.contains( VCARD_TEL_MSG ) ) |
287 | type |= PhoneNumber::Msg; | 289 | type |= PhoneNumber::Msg; |
288 | if ( (*i).qualifiers.contains( VCARD_TEL_CELL ) ) | 290 | if ( (*i).qualifiers.contains( VCARD_TEL_CELL ) ) |
@@ -295,52 +297,55 @@ KABC::Addressee VCard21Parser::readFromString( const QString &data) | |||
295 | type |= PhoneNumber::Modem; | 297 | type |= PhoneNumber::Modem; |
296 | if ( (*i).qualifiers.contains( VCARD_TEL_CAR ) ) | 298 | if ( (*i).qualifiers.contains( VCARD_TEL_CAR ) ) |
297 | type |= PhoneNumber::Car; | 299 | type |= PhoneNumber::Car; |
298 | if ( (*i).qualifiers.contains( VCARD_TEL_ISDN ) ) | 300 | if ( (*i).qualifiers.contains( VCARD_TEL_ISDN ) ) |
299 | type |= PhoneNumber::Isdn; | 301 | type |= PhoneNumber::Isdn; |
300 | if ( (*i).qualifiers.contains( VCARD_TEL_VIDEO ) ) | 302 | if ( (*i).qualifiers.contains( VCARD_TEL_VIDEO ) ) |
301 | type |= PhoneNumber::Video; | 303 | type |= PhoneNumber::Video; |
302 | if ( (*i).qualifiers.contains( VCARD_TEL_PCS ) ) | 304 | if ( (*i).qualifiers.contains( VCARD_TEL_PCS ) ) |
303 | type |= PhoneNumber::Pcs; | 305 | type |= PhoneNumber::Pcs; |
304 | 306 | ||
305 | } | 307 | } |
306 | addressee.insertPhoneNumber( PhoneNumber( (*i).parameters[ 0 ], type ) ); | 308 | addressee.insertPhoneNumber( PhoneNumber( (*i).parameters[ 0 ], type ) ); |
307 | } | 309 | } |
308 | } | 310 | } |
309 | addressee.makePhoneNumbersOLcompatible(); | 311 | addressee.makePhoneNumbersOLcompatible(); |
310 | //set the addressee's addresses | 312 | //set the addressee's addresses |
311 | for ( QValueListIterator<VCardLineX> i = mVCard->_vcdata->begin();i != mVCard->_vcdata->end(); ++i ) { | 313 | for ( Q3ValueListIterator<VCardLineX> i = mVCard->_vcdata->begin();i != mVCard->_vcdata->end(); ++i ) { |
312 | if ( (*i).name == VCARD_ADR ) { | 314 | if ( (*i).name == VCARD_ADR ) { |
313 | int type = 0; | 315 | int type = 0; |
314 | if ( (*i).qualified ) { | 316 | if ( (*i).qualified ) { |
315 | if ( (*i).qualifiers.contains( VCARD_ADR_DOM ) ) | 317 | if ( (*i).qualifiers.contains( VCARD_ADR_DOM ) ) |
316 | type |= Address::Dom; | 318 | type |= Address::Dom; |
317 | if ( (*i).qualifiers.contains( VCARD_ADR_INTL ) ) | 319 | if ( (*i).qualifiers.contains( VCARD_ADR_INTL ) ) |
318 | type |= Address::Intl; | 320 | type |= Address::Intl; |
319 | if ( (*i).qualifiers.contains( VCARD_ADR_POSTAL ) ) | 321 | if ( (*i).qualifiers.contains( VCARD_ADR_POSTAL ) ) |
320 | type |= Address::Postal; | 322 | type |= Address::Postal; |
321 | if ( (*i).qualifiers.contains( VCARD_ADR_PARCEL ) ) | 323 | if ( (*i).qualifiers.contains( VCARD_ADR_PARCEL ) ) |
322 | type |= Address::Parcel; | 324 | type |= Address::Parcel; |
323 | if ( (*i).qualifiers.contains( VCARD_ADR_HOME ) ) | 325 | if ( (*i).qualifiers.contains( VCARD_ADR_HOME ) ) |
324 | type |= Address::Home; | 326 | type |= Address::Home; |
325 | if ( (*i).qualifiers.contains( VCARD_ADR_WORK ) ) | 327 | if ( (*i).qualifiers.contains( VCARD_ADR_WORK ) ) |
326 | type |= Address::Work; | 328 | type |= Address::Work; |
327 | if ( (*i).qualifiers.contains( VCARD_ADR_PREF ) ) | 329 | if ( (*i).qualifiers.contains( VCARD_ADR_PREF ) ) |
328 | type |= Address::Pref; | 330 | type |= Address::Pref; |
329 | } | 331 | } |
330 | addressee.insertAddress( readAddressFromQStringList( (*i).parameters, type ) ); | 332 | QStringList tmp; |
333 | for(Q3ValueList<QString>::const_iterator ii=(*i).parameters.begin();ii!=(*i).parameters.end();++ii) | ||
334 | tmp.push_back(*ii); | ||
335 | addressee.insertAddress( readAddressFromQStringList( tmp, type ) ); | ||
331 | } | 336 | } |
332 | } | 337 | } |
333 | 338 | ||
334 | //set the addressee's delivery label | 339 | //set the addressee's delivery label |
335 | tmpStr = mVCard->getValue(VCARD_LABEL); | 340 | tmpStr = mVCard->getValue(VCARD_LABEL); |
336 | if (!tmpStr.isEmpty()) { | 341 | if (!tmpStr.isEmpty()) { |
337 | qDebug("VCard21Parser::readFromString please verify if replace is correct"); | 342 | qDebug("VCard21Parser::readFromString please verify if replace is correct"); |
338 | //US tmpStr.replace("\r\n","\n"); | 343 | //US tmpStr.replace("\r\n","\n"); |
339 | tmpStr.replace( QRegExp("\r\n"), "\n" ); | 344 | tmpStr.replace( QRegExp("\r\n"), "\n" ); |
340 | Address tmpAddress; | 345 | Address tmpAddress; |
341 | tmpAddress.setLabel(tmpStr); | 346 | tmpAddress.setLabel(tmpStr); |
342 | addressee.insertAddress(tmpAddress); | 347 | addressee.insertAddress(tmpAddress); |
343 | } | 348 | } |
344 | 349 | ||
345 | //set the addressee's notes | 350 | //set the addressee's notes |
346 | tmpStr = mVCard->getValue(VCARD_NOTE); | 351 | tmpStr = mVCard->getValue(VCARD_NOTE); |
@@ -395,36 +400,36 @@ KABC::Address VCard21Parser::readAddressFromQStringList ( const QStringList &dat | |||
395 | if ( data.count() > 4 ) | 400 | if ( data.count() > 4 ) |
396 | mAddress.setRegion( data[4] ); | 401 | mAddress.setRegion( data[4] ); |
397 | if ( data.count() > 5 ) | 402 | if ( data.count() > 5 ) |
398 | mAddress.setPostalCode( data[5] ); | 403 | mAddress.setPostalCode( data[5] ); |
399 | if ( data.count() > 6 ) | 404 | if ( data.count() > 6 ) |
400 | mAddress.setCountry( data[6] ); | 405 | mAddress.setCountry( data[6] ); |
401 | 406 | ||
402 | return mAddress; | 407 | return mAddress; |
403 | } | 408 | } |
404 | 409 | ||
405 | 410 | ||
406 | VCard21ParserImpl *VCard21ParserImpl::parseVCard( const QString& vc, int *err ) | 411 | VCard21ParserImpl *VCard21ParserImpl::parseVCard( const QString& vc, int *err ) |
407 | { | 412 | { |
408 | int _err = 0; | 413 | int _err = 0; |
409 | int _state = VC_STATE_BEGIN; | 414 | int _state = VC_STATE_BEGIN; |
410 | 415 | ||
411 | QValueList<VCardLineX> *_vcdata; | 416 | Q3ValueList<VCardLineX> *_vcdata; |
412 | QValueList<QString> lines; | 417 | QStringList lines; |
413 | 418 | ||
414 | _vcdata = new QValueList<VCardLineX>; | 419 | _vcdata = new Q3ValueList<VCardLineX>; |
415 | 420 | ||
416 | lines = QStringList::split( QRegExp( "[\x0d\x0a]" ), vc ); | 421 | lines = QStringList::split( QRegExp( "[\x0d\x0a]" ), vc ); |
417 | 422 | ||
418 | // for each line in the vCard | 423 | // for each line in the vCard |
419 | for ( QStringList::Iterator j = lines.begin(); j != lines.end(); ++j ) { | 424 | for ( QStringList::Iterator j = lines.begin(); j != lines.end(); ++j ) { |
420 | VCardLineX _vcl; | 425 | VCardLineX _vcl; |
421 | 426 | ||
422 | // take spaces off the end - ugly but necessary hack | 427 | // take spaces off the end - ugly but necessary hack |
423 | for ( int g = (*j).length()-1; g > 0 && (*j)[g].isSpace(); --g ) | 428 | for ( int g = (*j).length()-1; g > 0 && (*j)[g].isSpace(); --g ) |
424 | (*j)[g] = 0; | 429 | (*j)[g] = 0; |
425 | 430 | ||
426 | // first token: | 431 | // first token: |
427 | // verify state, update if necessary | 432 | // verify state, update if necessary |
428 | if ( _state & VC_STATE_BEGIN) { | 433 | if ( _state & VC_STATE_BEGIN) { |
429 | if ( !qstricmp( (*j).latin1(), VCARD_BEGIN ) ) { | 434 | if ( !qstricmp( (*j).latin1(), VCARD_BEGIN ) ) { |
430 | _state = VC_STATE_BODY; | 435 | _state = VC_STATE_BODY; |
@@ -488,34 +493,34 @@ VCard21ParserImpl *VCard21ParserImpl::parseVCard( const QString& vc, int *err ) | |||
488 | // split into tokens by ; | 493 | // split into tokens by ; |
489 | // add to parameters vector | 494 | // add to parameters vector |
490 | if ( b64 ) { | 495 | if ( b64 ) { |
491 | if ( value.at( value.length() - 1 ) != '=' ) | 496 | if ( value.at( value.length() - 1 ) != '=' ) |
492 | do { | 497 | do { |
493 | value += *( ++j ); | 498 | value += *( ++j ); |
494 | } while ( (*j).at( (*j).length() - 1 ) != '=' ); | 499 | } while ( (*j).at( (*j).length() - 1 ) != '=' ); |
495 | } else { | 500 | } else { |
496 | if ( qp ) { // join any split lines | 501 | if ( qp ) { // join any split lines |
497 | while ( value.at( value.length() - 1 ) == '=' ) { | 502 | while ( value.at( value.length() - 1 ) == '=' ) { |
498 | value.remove( value.length() - 1, 1 ); | 503 | value.remove( value.length() - 1, 1 ); |
499 | value.append(*( ++j )); | 504 | value.append(*( ++j )); |
500 | } | 505 | } |
501 | } | 506 | } |
502 | _vcl.parameters = QStringList::split( ';', value, true ); | 507 | _vcl.parameters = QStringList::split( ';', value, true ); |
503 | if ( qp ) { // decode the quoted printable | 508 | if ( qp ) { // decode the quoted printable |
504 | for ( QStringList::Iterator z = _vcl.parameters.begin(); z != _vcl.parameters.end(); ++z ) | 509 | for ( QLinkedList<QString>::Iterator z = _vcl.parameters.begin(); z != _vcl.parameters.end(); ++z ) |
505 | *z = KCodecs::quotedPrintableDecode( (*z).latin1() ); | 510 | *z = KCodecs::quotedPrintableDecode( (Q3CString)(*z).latin1() ); |
506 | } | 511 | } |
507 | } | 512 | } |
508 | } else { | 513 | } else { |
509 | _err = VC_ERR_INTERNAL; | 514 | _err = VC_ERR_INTERNAL; |
510 | break; | 515 | break; |
511 | } | 516 | } |
512 | 517 | ||
513 | // validate VCardLineX | 518 | // validate VCardLineX |
514 | if ( !_vcl.isValid() ) { | 519 | if ( !_vcl.isValid() ) { |
515 | _err = VC_ERR_INVALID_LINE; | 520 | _err = VC_ERR_INVALID_LINE; |
516 | break; | 521 | break; |
517 | } | 522 | } |
518 | 523 | ||
519 | // add to vector | 524 | // add to vector |
520 | _vcdata->append( _vcl ); | 525 | _vcdata->append( _vcl ); |
521 | } | 526 | } |
@@ -530,78 +535,79 @@ VCard21ParserImpl *VCard21ParserImpl::parseVCard( const QString& vc, int *err ) | |||
530 | _err = VC_ERR_MISSING_MANDATORY; | 535 | _err = VC_ERR_MISSING_MANDATORY; |
531 | } | 536 | } |
532 | 537 | ||
533 | // set the error message if we can, and only return an object | 538 | // set the error message if we can, and only return an object |
534 | // if the vCard was valid. | 539 | // if the vCard was valid. |
535 | if ( err ) | 540 | if ( err ) |
536 | *err = _err; | 541 | *err = _err; |
537 | 542 | ||
538 | if ( _err != 0 ) { | 543 | if ( _err != 0 ) { |
539 | delete _vcdata; | 544 | delete _vcdata; |
540 | return 0; | 545 | return 0; |
541 | } | 546 | } |
542 | 547 | ||
543 | return new VCard21ParserImpl( _vcdata ); | 548 | return new VCard21ParserImpl( _vcdata ); |
544 | } | 549 | } |
545 | 550 | ||
546 | VCard21ParserImpl::VCard21ParserImpl(QValueList<VCardLineX> *_vcd) : _vcdata(_vcd) | 551 | VCard21ParserImpl::VCard21ParserImpl(Q3ValueList<VCardLineX> *_vcd) : _vcdata(_vcd) |
547 | { | 552 | { |
548 | } | 553 | } |
549 | 554 | ||
550 | 555 | ||
551 | QString VCard21ParserImpl::getValue(const QString& name, const QString& qualifier) | 556 | QString VCard21ParserImpl::getValue(const QString& name, const QString& qualifier) |
552 | { | 557 | { |
553 | QString failed; | 558 | QString failed; |
554 | const QString lowname = name.lower(); | 559 | const QString lowname = name.lower(); |
555 | const QString lowqualifier = qualifier.lower(); | 560 | const QString lowqualifier = qualifier.lower(); |
556 | 561 | ||
557 | for (QValueListIterator<VCardLineX> i = _vcdata->begin();i != _vcdata->end();++i) { | 562 | for (Q3ValueListIterator<VCardLineX> i = _vcdata->begin();i != _vcdata->end();++i) { |
558 | if ((*i).name == lowname && (*i).qualified && (*i).qualifiers.contains(lowqualifier)) { | 563 | if ((*i).name == lowname && (*i).qualified && (*i).qualifiers.contains(lowqualifier)) { |
559 | if ((*i).parameters.count() > 0) | 564 | if ((*i).parameters.count() > 0) |
560 | return (*i).parameters[0]; | 565 | return (*i).parameters[0]; |
561 | else return failed; | 566 | else return failed; |
562 | } | 567 | } |
563 | } | 568 | } |
564 | return failed; | 569 | return failed; |
565 | } | 570 | } |
566 | 571 | ||
567 | 572 | ||
568 | QString VCard21ParserImpl::getValue(const QString& name) | 573 | QString VCard21ParserImpl::getValue(const QString& name) |
569 | { | 574 | { |
570 | QString failed; | 575 | QString failed; |
571 | const QString lowname = name.lower(); | 576 | const QString lowname = name.lower(); |
572 | 577 | ||
573 | for (QValueListIterator<VCardLineX> i = _vcdata->begin();i != _vcdata->end();++i) { | 578 | for (Q3ValueListIterator<VCardLineX> i = _vcdata->begin();i != _vcdata->end();++i) { |
574 | if ((*i).name == lowname && !(*i).qualified) { | 579 | if ((*i).name == lowname && !(*i).qualified) { |
575 | if ((*i).parameters.count() > 0) | 580 | if ((*i).parameters.count() > 0) |
576 | return (*i).parameters[0]; | 581 | return (*i).parameters[0]; |
577 | else return failed; | 582 | else return failed; |
578 | } | 583 | } |
579 | } | 584 | } |
580 | return failed; | 585 | return failed; |
581 | } | 586 | } |
582 | 587 | ||
583 | 588 | ||
584 | QStringList VCard21ParserImpl::getValues(const QString& name) | 589 | QStringList VCard21ParserImpl::getValues(const QString& name) |
585 | { | 590 | { |
586 | const QString lowname = name.lower(); | 591 | const QString lowname = name.lower(); |
587 | for (QValueListIterator<VCardLineX> i = _vcdata->begin();i != _vcdata->end();++i) { | 592 | for (Q3ValueListIterator<VCardLineX> i = _vcdata->begin();i != _vcdata->end();++i) { |
588 | if ((*i).name == lowname && !(*i).qualified) | 593 | if ((*i).name == lowname && !(*i).qualified) { |
589 | return (*i).parameters; | 594 | return QStringList( (*i).parameters ); |
595 | } | ||
590 | } | 596 | } |
591 | // failed. | 597 | // failed. |
592 | return QStringList(); | 598 | return QStringList(); |
593 | } | 599 | } |
594 | 600 | ||
595 | QStringList VCard21ParserImpl::getValues(const QString& name, const QString& qualifier) | 601 | QStringList VCard21ParserImpl::getValues(const QString& name, const QString& qualifier) |
596 | { | 602 | { |
597 | const QString lowname = name.lower(); | 603 | const QString lowname = name.lower(); |
598 | const QString lowqualifier = qualifier.lower(); | 604 | const QString lowqualifier = qualifier.lower(); |
599 | for (QValueListIterator<VCardLineX> i = _vcdata->begin();i != _vcdata->end();++i) { | 605 | for (Q3ValueListIterator<VCardLineX> i = _vcdata->begin();i != _vcdata->end();++i) { |
600 | if ((*i).name == lowname && (*i).qualified && (*i).qualifiers.contains(lowqualifier)) | 606 | if ((*i).name == lowname && (*i).qualified && (*i).qualifiers.contains(lowqualifier)) |
601 | return (*i).parameters; | 607 | return QStringList( (*i).parameters ); |
602 | } | 608 | } |
603 | // failed. | 609 | // failed. |
604 | return QStringList(); | 610 | return QStringList(); |
605 | } | 611 | } |
606 | 612 | ||
607 | 613 | ||