author | zautrix <zautrix> | 2005-04-29 12:18:46 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-29 12:18:46 (UTC) |
commit | bdaded2da25b0ccef80d6e638fa12f92a4f8744d (patch) (unidiff) | |
tree | 4ab99ccab5c3610a26df59c6f79204e054c32dd5 /kaddressbook/xxport/csvimportdialog.cpp | |
parent | 8fbdf5d2b0ee1e1496cb856e0ead37c668066353 (diff) | |
download | kdepimpi-bdaded2da25b0ccef80d6e638fa12f92a4f8744d.zip kdepimpi-bdaded2da25b0ccef80d6e638fa12f92a4f8744d.tar.gz kdepimpi-bdaded2da25b0ccef80d6e638fa12f92a4f8744d.tar.bz2 |
another csv import fix
Diffstat (limited to 'kaddressbook/xxport/csvimportdialog.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | kaddressbook/xxport/csvimportdialog.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/kaddressbook/xxport/csvimportdialog.cpp b/kaddressbook/xxport/csvimportdialog.cpp index 41e2612..4044fa8 100644 --- a/kaddressbook/xxport/csvimportdialog.cpp +++ b/kaddressbook/xxport/csvimportdialog.cpp | |||
@@ -337,49 +337,49 @@ KABC::AddresseeList CSVImportDialog::contacts() const | |||
337 | case BusinessAddressLocality: | 337 | case BusinessAddressLocality: |
338 | addrWork.setLocality( value ); | 338 | addrWork.setLocality( value ); |
339 | break; | 339 | break; |
340 | case BusinessAddressRegion: | 340 | case BusinessAddressRegion: |
341 | addrWork.setRegion( value ); | 341 | addrWork.setRegion( value ); |
342 | break; | 342 | break; |
343 | case BusinessAddressPostalCode: | 343 | case BusinessAddressPostalCode: |
344 | addrWork.setPostalCode( value ); | 344 | addrWork.setPostalCode( value ); |
345 | break; | 345 | break; |
346 | case BusinessAddressCountry: | 346 | case BusinessAddressCountry: |
347 | addrWork.setCountry( value ); | 347 | addrWork.setCountry( value ); |
348 | break; | 348 | break; |
349 | case BusinessAddressLabel: | 349 | case BusinessAddressLabel: |
350 | addrWork.setLabel( value ); | 350 | addrWork.setLabel( value ); |
351 | break; | 351 | break; |
352 | default: | 352 | default: |
353 | KABC::Field::List fields = mAddressBook->fields( KABC::Field::CustomCategory ); | 353 | KABC::Field::List fields = mAddressBook->fields( KABC::Field::CustomCategory ); |
354 | KABC::Field::List::Iterator it; | 354 | KABC::Field::List::Iterator it; |
355 | 355 | ||
356 | int counter = 0; | 356 | int counter = 0; |
357 | for ( it = fields.begin(); it != fields.end(); ++it ) { | 357 | for ( it = fields.begin(); it != fields.end(); ++it ) { |
358 | if ( counter == (int)( posToType( item->currentItem() ) - mCustomCounter ) ) | 358 | if ( counter == (int)( posToType( item->currentItem() ) - mCustomCounter ) ) |
359 | { | 359 | { |
360 | (*it)->setValue( a, value ); | 360 | (*it)->setValue( a, value ); |
361 | continue; | 361 | break; |
362 | } | 362 | } |
363 | ++counter; | 363 | ++counter; |
364 | } | 364 | } |
365 | break; | 365 | break; |
366 | } | 366 | } |
367 | } | 367 | } |
368 | 368 | ||
369 | if ( !addrHome.isEmpty() ) | 369 | if ( !addrHome.isEmpty() ) |
370 | a.insertAddress( addrHome ); | 370 | a.insertAddress( addrHome ); |
371 | if ( !addrWork.isEmpty() ) | 371 | if ( !addrWork.isEmpty() ) |
372 | a.insertAddress( addrWork ); | 372 | a.insertAddress( addrWork ); |
373 | 373 | ||
374 | if ( !emptyRow && !a.isEmpty() ) | 374 | if ( !emptyRow && !a.isEmpty() ) |
375 | contacts.append( a ); | 375 | contacts.append( a ); |
376 | } | 376 | } |
377 | 377 | ||
378 | return contacts; | 378 | return contacts; |
379 | } | 379 | } |
380 | 380 | ||
381 | void CSVImportDialog::initGUI() | 381 | void CSVImportDialog::initGUI() |
382 | { | 382 | { |
383 | QWidget* page = plainPage(); | 383 | QWidget* page = plainPage(); |
384 | 384 | ||
385 | QGridLayout *layout = new QGridLayout( page, 1, 1, marginHintSmall(), | 385 | QGridLayout *layout = new QGridLayout( page, 1, 1, marginHintSmall(), |
@@ -520,49 +520,49 @@ void CSVImportDialog::fillTable() | |||
520 | while ( !inputStream.atEnd() ) { | 520 | while ( !inputStream.atEnd() ) { |
521 | inputStream >> x; // read one char | 521 | inputStream >> x; // read one char |
522 | 522 | ||
523 | if ( x == '\r' ) inputStream >> x; // eat '\r', to handle DOS/LOSEDOWS files correctly | 523 | if ( x == '\r' ) inputStream >> x; // eat '\r', to handle DOS/LOSEDOWS files correctly |
524 | 524 | ||
525 | switch ( state ) { | 525 | switch ( state ) { |
526 | case S_START : | 526 | case S_START : |
527 | if ( x == mTextQuote ) { | 527 | if ( x == mTextQuote ) { |
528 | state = S_QUOTED_FIELD; | 528 | state = S_QUOTED_FIELD; |
529 | } else if ( x == mDelimiter ) { | 529 | } else if ( x == mDelimiter ) { |
530 | if ( ( ignoreDups == false ) || ( lastCharDelimiter == false ) ) | 530 | if ( ( ignoreDups == false ) || ( lastCharDelimiter == false ) ) |
531 | ++column; | 531 | ++column; |
532 | lastCharDelimiter = true; | 532 | lastCharDelimiter = true; |
533 | } else if ( x == '\n' ) { | 533 | } else if ( x == '\n' ) { |
534 | ++row; | 534 | ++row; |
535 | column = 1; | 535 | column = 1; |
536 | } else { | 536 | } else { |
537 | field += x; | 537 | field += x; |
538 | state = S_MAYBE_NORMAL_FIELD; | 538 | state = S_MAYBE_NORMAL_FIELD; |
539 | } | 539 | } |
540 | break; | 540 | break; |
541 | case S_QUOTED_FIELD : | 541 | case S_QUOTED_FIELD : |
542 | if ( x == mTextQuote ) { | 542 | if ( x == mTextQuote ) { |
543 | state = S_MAYBE_END_OF_QUOTED_FIELD; | 543 | state = S_MAYBE_END_OF_QUOTED_FIELD; |
544 | } else if ( x == '\n' ) { | 544 | } else if ( x == '\n' && mTextQuote.isNull() ) { |
545 | setText( row - mStartLine + 1, column, field ); | 545 | setText( row - mStartLine + 1, column, field ); |
546 | field = ""; | 546 | field = ""; |
547 | if ( x == '\n' ) { | 547 | if ( x == '\n' ) { |
548 | ++row; | 548 | ++row; |
549 | column = 1; | 549 | column = 1; |
550 | } else { | 550 | } else { |
551 | if ( ( ignoreDups == false ) || ( lastCharDelimiter == false ) ) | 551 | if ( ( ignoreDups == false ) || ( lastCharDelimiter == false ) ) |
552 | ++column; | 552 | ++column; |
553 | lastCharDelimiter = true; | 553 | lastCharDelimiter = true; |
554 | } | 554 | } |
555 | state = S_START; | 555 | state = S_START; |
556 | } else { | 556 | } else { |
557 | field += x; | 557 | field += x; |
558 | } | 558 | } |
559 | break; | 559 | break; |
560 | case S_MAYBE_END_OF_QUOTED_FIELD : | 560 | case S_MAYBE_END_OF_QUOTED_FIELD : |
561 | if ( x == mTextQuote ) { | 561 | if ( x == mTextQuote ) { |
562 | field += x; | 562 | field += x; |
563 | state = S_QUOTED_FIELD; | 563 | state = S_QUOTED_FIELD; |
564 | } else if ( x == mDelimiter || x == '\n' ) { | 564 | } else if ( x == mDelimiter || x == '\n' ) { |
565 | setText( row - mStartLine + 1, column, field ); | 565 | setText( row - mStartLine + 1, column, field ); |
566 | field = ""; | 566 | field = ""; |
567 | if ( x == '\n' ) { | 567 | if ( x == '\n' ) { |
568 | ++row; | 568 | ++row; |