summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/xxport/csvimportdialog.cpp4
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
@@ -265,376 +265,376 @@ KABC::AddresseeList CSVImportDialog::contacts() const
265 if ( !value.isEmpty() ) { 265 if ( !value.isEmpty() ) {
266 KABC::PhoneNumber number( value, KABC::PhoneNumber::Home ); 266 KABC::PhoneNumber number( value, KABC::PhoneNumber::Home );
267 a.insertPhoneNumber( number ); 267 a.insertPhoneNumber( number );
268 } 268 }
269 break; 269 break;
270 case BusinessPhone: 270 case BusinessPhone:
271 if ( !value.isEmpty() ) { 271 if ( !value.isEmpty() ) {
272 KABC::PhoneNumber number( value, KABC::PhoneNumber::Work ); 272 KABC::PhoneNumber number( value, KABC::PhoneNumber::Work );
273 a.insertPhoneNumber( number ); 273 a.insertPhoneNumber( number );
274 } 274 }
275 break; 275 break;
276 case MobilePhone: 276 case MobilePhone:
277 if ( !value.isEmpty() ) { 277 if ( !value.isEmpty() ) {
278 KABC::PhoneNumber number( value, KABC::PhoneNumber::Cell ); 278 KABC::PhoneNumber number( value, KABC::PhoneNumber::Cell );
279 a.insertPhoneNumber( number ); 279 a.insertPhoneNumber( number );
280 } 280 }
281 break; 281 break;
282 case HomeFax: 282 case HomeFax:
283 if ( !value.isEmpty() ) { 283 if ( !value.isEmpty() ) {
284 KABC::PhoneNumber number( value, KABC::PhoneNumber::Home | 284 KABC::PhoneNumber number( value, KABC::PhoneNumber::Home |
285 KABC::PhoneNumber::Fax ); 285 KABC::PhoneNumber::Fax );
286 a.insertPhoneNumber( number ); 286 a.insertPhoneNumber( number );
287 } 287 }
288 break; 288 break;
289 case BusinessFax: 289 case BusinessFax:
290 if ( !value.isEmpty() ) { 290 if ( !value.isEmpty() ) {
291 KABC::PhoneNumber number( value, KABC::PhoneNumber::Work | 291 KABC::PhoneNumber number( value, KABC::PhoneNumber::Work |
292 KABC::PhoneNumber::Fax ); 292 KABC::PhoneNumber::Fax );
293 a.insertPhoneNumber( number ); 293 a.insertPhoneNumber( number );
294 } 294 }
295 break; 295 break;
296 case CarPhone: 296 case CarPhone:
297 if ( !value.isEmpty() ) { 297 if ( !value.isEmpty() ) {
298 KABC::PhoneNumber number( value, KABC::PhoneNumber::Car ); 298 KABC::PhoneNumber number( value, KABC::PhoneNumber::Car );
299 a.insertPhoneNumber( number ); 299 a.insertPhoneNumber( number );
300 } 300 }
301 break; 301 break;
302 case Isdn: 302 case Isdn:
303 if ( !value.isEmpty() ) { 303 if ( !value.isEmpty() ) {
304 KABC::PhoneNumber number( value, KABC::PhoneNumber::Isdn ); 304 KABC::PhoneNumber number( value, KABC::PhoneNumber::Isdn );
305 a.insertPhoneNumber( number ); 305 a.insertPhoneNumber( number );
306 } 306 }
307 break; 307 break;
308 case Pager: 308 case Pager:
309 if ( !value.isEmpty() ) { 309 if ( !value.isEmpty() ) {
310 KABC::PhoneNumber number( value, KABC::PhoneNumber::Pager ); 310 KABC::PhoneNumber number( value, KABC::PhoneNumber::Pager );
311 a.insertPhoneNumber( number ); 311 a.insertPhoneNumber( number );
312 } 312 }
313 break; 313 break;
314 314
315 case HomeAddressStreet: 315 case HomeAddressStreet:
316 addrHome.setStreet( value ); 316 addrHome.setStreet( value );
317 break; 317 break;
318 case HomeAddressLocality: 318 case HomeAddressLocality:
319 addrHome.setLocality( value ); 319 addrHome.setLocality( value );
320 break; 320 break;
321 case HomeAddressRegion: 321 case HomeAddressRegion:
322 addrHome.setRegion( value ); 322 addrHome.setRegion( value );
323 break; 323 break;
324 case HomeAddressPostalCode: 324 case HomeAddressPostalCode:
325 addrHome.setPostalCode( value ); 325 addrHome.setPostalCode( value );
326 break; 326 break;
327 case HomeAddressCountry: 327 case HomeAddressCountry:
328 addrHome.setCountry( value ); 328 addrHome.setCountry( value );
329 break; 329 break;
330 case HomeAddressLabel: 330 case HomeAddressLabel:
331 addrHome.setLabel( value ); 331 addrHome.setLabel( value );
332 break; 332 break;
333 333
334 case BusinessAddressStreet: 334 case BusinessAddressStreet:
335 addrWork.setStreet( value ); 335 addrWork.setStreet( value );
336 break; 336 break;
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
381void CSVImportDialog::initGUI() 381void 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(),
386 spacingHintSmall() ); 386 spacingHintSmall() );
387 QHBoxLayout *hbox = new QHBoxLayout(); 387 QHBoxLayout *hbox = new QHBoxLayout();
388 hbox->setSpacing( spacingHint() ); 388 hbox->setSpacing( spacingHint() );
389 389
390 QLabel *label = new QLabel( i18n( "File to import:" ), page ); 390 QLabel *label = new QLabel( i18n( "File to import:" ), page );
391 hbox->addWidget( label ); 391 hbox->addWidget( label );
392 392
393 mUrlRequester = new KURLRequester( page ); 393 mUrlRequester = new KURLRequester( page );
394 mUrlRequester->setFilter( "*.csv" ); 394 mUrlRequester->setFilter( "*.csv" );
395 hbox->addWidget( mUrlRequester ); 395 hbox->addWidget( mUrlRequester );
396 396
397 layout->addMultiCellLayout( hbox, 0, 0, 0, 2 ); 397 layout->addMultiCellLayout( hbox, 0, 0, 0, 2 );
398 398
399 // Delimiter: comma, semicolon, tab, space, other 399 // Delimiter: comma, semicolon, tab, space, other
400 mDelimiterBox = new QButtonGroup( i18n( "Delimiter" ), page ); 400 mDelimiterBox = new QButtonGroup( i18n( "Delimiter" ), page );
401 mDelimiterBox->setColumnLayout( 0, Qt::Vertical ); 401 mDelimiterBox->setColumnLayout( 0, Qt::Vertical );
402 mDelimiterBox->layout()->setSpacing( spacingHint() ); 402 mDelimiterBox->layout()->setSpacing( spacingHint() );
403 mDelimiterBox->layout()->setMargin( marginHint() ); 403 mDelimiterBox->layout()->setMargin( marginHint() );
404 QGridLayout *delimiterLayout = new QGridLayout( mDelimiterBox->layout() ); 404 QGridLayout *delimiterLayout = new QGridLayout( mDelimiterBox->layout() );
405 delimiterLayout->setAlignment( Qt::AlignTop ); 405 delimiterLayout->setAlignment( Qt::AlignTop );
406 layout->addMultiCellWidget( mDelimiterBox, 1, 1, 0, 2 ); 406 layout->addMultiCellWidget( mDelimiterBox, 1, 1, 0, 2 );
407 407
408 mRadioComma = new QRadioButton( i18n( "Comma" ), mDelimiterBox ); 408 mRadioComma = new QRadioButton( i18n( "Comma" ), mDelimiterBox );
409 mRadioComma->setChecked( true ); 409 mRadioComma->setChecked( true );
410 delimiterLayout->addWidget( mRadioComma, 0, 0 ); 410 delimiterLayout->addWidget( mRadioComma, 0, 0 );
411 411
412 mRadioSemicolon = new QRadioButton( i18n( "Semicolon" ), mDelimiterBox ); 412 mRadioSemicolon = new QRadioButton( i18n( "Semicolon" ), mDelimiterBox );
413 delimiterLayout->addWidget( mRadioSemicolon, 0, 1 ); 413 delimiterLayout->addWidget( mRadioSemicolon, 0, 1 );
414 414
415 mRadioTab = new QRadioButton( i18n( "Tabulator" ), mDelimiterBox ); 415 mRadioTab = new QRadioButton( i18n( "Tabulator" ), mDelimiterBox );
416 delimiterLayout->addWidget( mRadioTab, 1, 0 ); 416 delimiterLayout->addWidget( mRadioTab, 1, 0 );
417 417
418 mRadioSpace = new QRadioButton( i18n( "Space" ), mDelimiterBox ); 418 mRadioSpace = new QRadioButton( i18n( "Space" ), mDelimiterBox );
419 delimiterLayout->addWidget( mRadioSpace, 1, 1 ); 419 delimiterLayout->addWidget( mRadioSpace, 1, 1 );
420 420
421 mRadioOther = new QRadioButton( i18n( "Other" ), mDelimiterBox ); 421 mRadioOther = new QRadioButton( i18n( "Other" ), mDelimiterBox );
422 delimiterLayout->addWidget( mRadioOther, 0, 2 ); 422 delimiterLayout->addWidget( mRadioOther, 0, 2 );
423 423
424 mDelimiterEdit = new QLineEdit( mDelimiterBox ); 424 mDelimiterEdit = new QLineEdit( mDelimiterBox );
425 delimiterLayout->addWidget( mDelimiterEdit, 1, 2 ); 425 delimiterLayout->addWidget( mDelimiterEdit, 1, 2 );
426 426
427 mComboLine = new QComboBox( false, page ); 427 mComboLine = new QComboBox( false, page );
428 mComboLine->insertItem( i18n( "1" ) ); 428 mComboLine->insertItem( i18n( "1" ) );
429 layout->addWidget( mComboLine, 3, 1 ); 429 layout->addWidget( mComboLine, 3, 1 );
430 430
431 mComboQuote = new QComboBox( false, page ); 431 mComboQuote = new QComboBox( false, page );
432 mComboQuote->insertItem( i18n( "\"" ), 0 ); 432 mComboQuote->insertItem( i18n( "\"" ), 0 );
433 mComboQuote->insertItem( i18n( "'" ), 1 ); 433 mComboQuote->insertItem( i18n( "'" ), 1 );
434 mComboQuote->insertItem( i18n( "None" ), 2 ); 434 mComboQuote->insertItem( i18n( "None" ), 2 );
435 layout->addWidget( mComboQuote, 3, 0 ); 435 layout->addWidget( mComboQuote, 3, 0 );
436 mComboCodec = new QComboBox( false, page ); 436 mComboCodec = new QComboBox( false, page );
437 mComboCodec->insertItem( i18n( "UTF8" ), 0 ); 437 mComboCodec->insertItem( i18n( "UTF8" ), 0 );
438 mComboCodec->insertItem( i18n( "LATIN1" ), 1 ); 438 mComboCodec->insertItem( i18n( "LATIN1" ), 1 );
439 mComboCodec->insertItem( i18n( "LOCALE" ), 2 ); 439 mComboCodec->insertItem( i18n( "LOCALE" ), 2 );
440 layout->addWidget( mComboCodec, 3, 2 ); 440 layout->addWidget( mComboCodec, 3, 2 );
441 label = new QLabel( i18n( "Start at line:" ), page ); 441 label = new QLabel( i18n( "Start at line:" ), page );
442 layout->addWidget( label, 2, 1 ); 442 layout->addWidget( label, 2, 1 );
443 443
444 label = new QLabel( i18n( "Textquote:" ), page ); 444 label = new QLabel( i18n( "Textquote:" ), page );
445 layout->addWidget( label, 2, 0 ); 445 layout->addWidget( label, 2, 0 );
446 label = new QLabel( i18n( "Codec:" ), page ); 446 label = new QLabel( i18n( "Codec:" ), page );
447 layout->addWidget( label, 2, 2 ); 447 layout->addWidget( label, 2, 2 );
448 448
449 mIgnoreDuplicates = new QCheckBox( page ); 449 mIgnoreDuplicates = new QCheckBox( page );
450 mIgnoreDuplicates->setText( i18n( "Ignore duplicate delimiters" ) ); 450 mIgnoreDuplicates->setText( i18n( "Ignore duplicate delimiters" ) );
451 layout->addMultiCellWidget( mIgnoreDuplicates, 4, 4, 0, 2 ); 451 layout->addMultiCellWidget( mIgnoreDuplicates, 4, 4, 0, 2 );
452 452
453 mTable = new QTable( 0, 0, page ); 453 mTable = new QTable( 0, 0, page );
454 mTable->setSelectionMode( QTable::NoSelection ); 454 mTable->setSelectionMode( QTable::NoSelection );
455 //mTable->horizontalHeader()->hide(); 455 //mTable->horizontalHeader()->hide();
456 layout->addMultiCellWidget( mTable, 5, 5, 0, 2 ); 456 layout->addMultiCellWidget( mTable, 5, 5, 0, 2 );
457/*US 457/*US
458 setButtonText( User1, i18n( "Apply Template" ) ); 458 setButtonText( User1, i18n( "Apply Template" ) );
459 setButtonText( User2, i18n( "Save Template" ) ); 459 setButtonText( User2, i18n( "Save Template" ) );
460*/ 460*/
461 461
462 enableButtonOK( false ); 462 enableButtonOK( false );
463 463
464 findButton( User1 )->setEnabled( false ); 464 findButton( User1 )->setEnabled( false );
465 findButton( User2 )->setEnabled( false ); 465 findButton( User2 )->setEnabled( false );
466 466
467#ifdef DESKTOP_VERSION 467#ifdef DESKTOP_VERSION
468 resize( 640, 480 ); 468 resize( 640, 480 );
469#else 469#else
470 showMaximized(); 470 showMaximized();
471#endif 471#endif
472} 472}
473 473
474void CSVImportDialog::fillTable() 474void CSVImportDialog::fillTable()
475{ 475{
476 int row, column; 476 int row, column;
477 bool lastCharDelimiter = false; 477 bool lastCharDelimiter = false;
478 bool ignoreDups = mIgnoreDuplicates->isChecked(); 478 bool ignoreDups = mIgnoreDuplicates->isChecked();
479 enum { S_START, S_QUOTED_FIELD, S_MAYBE_END_OF_QUOTED_FIELD, S_END_OF_QUOTED_FIELD, 479 enum { S_START, S_QUOTED_FIELD, S_MAYBE_END_OF_QUOTED_FIELD, S_END_OF_QUOTED_FIELD,
480 S_MAYBE_NORMAL_FIELD, S_NORMAL_FIELD } state = S_START; 480 S_MAYBE_NORMAL_FIELD, S_NORMAL_FIELD } state = S_START;
481 481
482 QChar x; 482 QChar x;
483 QString field = ""; 483 QString field = "";
484 484
485 // store previous assignment 485 // store previous assignment
486 QValueList<int> mTypeOld = mTypeStore; 486 QValueList<int> mTypeOld = mTypeStore;
487 487
488 mTypeStore.clear(); 488 mTypeStore.clear();
489 for ( column = 0; column < mTable->numCols(); ++column ) { 489 for ( column = 0; column < mTable->numCols(); ++column ) {
490 QComboTableItem *item = static_cast<QComboTableItem*>( mTable->item( 0, column ) ); 490 QComboTableItem *item = static_cast<QComboTableItem*>( mTable->item( 0, column ) );
491 491
492 if ( !item || mClearTypeStore ) 492 if ( !item || mClearTypeStore )
493 mTypeStore.append( typeToPos( Undefined ) ); 493 mTypeStore.append( typeToPos( Undefined ) );
494 else if ( item ) 494 else if ( item )
495 mTypeStore.append( item->currentItem() ); 495 mTypeStore.append( item->currentItem() );
496 } 496 }
497 497
498 clearTable(); 498 clearTable();
499 499
500 row = column = 1; 500 row = column = 1;
501 if ( mComboCodec->currentItem () == 0 ) { 501 if ( mComboCodec->currentItem () == 0 ) {
502 mData = QString::fromUtf8( mFileArray.data() ); 502 mData = QString::fromUtf8( mFileArray.data() );
503 } else if ( mComboCodec->currentItem () == 1 ) { 503 } else if ( mComboCodec->currentItem () == 1 ) {
504 mData = QString::fromLatin1( mFileArray.data() ); 504 mData = QString::fromLatin1( mFileArray.data() );
505 } else { 505 } else {
506 mData = QString::fromLocal8Bit( mFileArray.data() ); 506 mData = QString::fromLocal8Bit( mFileArray.data() );
507 } 507 }
508 508
509 QTextStream inputStream( mData, IO_ReadOnly ); 509 QTextStream inputStream( mData, IO_ReadOnly );
510 510
511 if ( mComboCodec->currentItem () == 0 ) { 511 if ( mComboCodec->currentItem () == 0 ) {
512 inputStream.setEncoding( QTextStream::UnicodeUTF8 ); 512 inputStream.setEncoding( QTextStream::UnicodeUTF8 );
513 } else if ( mComboCodec->currentItem () == 1 ) { 513 } else if ( mComboCodec->currentItem () == 1 ) {
514 inputStream.setEncoding( QTextStream::Latin1 ); 514 inputStream.setEncoding( QTextStream::Latin1 );
515 } else { 515 } else {
516 inputStream.setEncoding( QTextStream::Locale ); 516 inputStream.setEncoding( QTextStream::Locale );
517 } 517 }
518 518
519 int maxColumn = 0; 519 int maxColumn = 0;
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;
569 column = 1; 569 column = 1;
570 } else { 570 } else {
571 if ( ( ignoreDups == false ) || ( lastCharDelimiter == false ) ) 571 if ( ( ignoreDups == false ) || ( lastCharDelimiter == false ) )
572 ++column; 572 ++column;
573 lastCharDelimiter = true; 573 lastCharDelimiter = true;
574 } 574 }
575 state = S_START; 575 state = S_START;
576 } else { 576 } else {
577 state = S_END_OF_QUOTED_FIELD; 577 state = S_END_OF_QUOTED_FIELD;
578 } 578 }
579 break; 579 break;
580 case S_END_OF_QUOTED_FIELD : 580 case S_END_OF_QUOTED_FIELD :
581 if ( x == mDelimiter || x == '\n' ) { 581 if ( x == mDelimiter || x == '\n' ) {
582 setText( row - mStartLine + 1, column, field ); 582 setText( row - mStartLine + 1, column, field );
583 field = ""; 583 field = "";
584 if ( x == '\n' ) { 584 if ( x == '\n' ) {
585 ++row; 585 ++row;
586 column = 1; 586 column = 1;
587 } else { 587 } else {
588 if ( ( ignoreDups == false ) || ( lastCharDelimiter == false ) ) 588 if ( ( ignoreDups == false ) || ( lastCharDelimiter == false ) )
589 ++column; 589 ++column;
590 lastCharDelimiter = true; 590 lastCharDelimiter = true;
591 } 591 }
592 state = S_START; 592 state = S_START;
593 } else { 593 } else {
594 state = S_END_OF_QUOTED_FIELD; 594 state = S_END_OF_QUOTED_FIELD;
595 } 595 }
596 break; 596 break;
597 case S_MAYBE_NORMAL_FIELD : 597 case S_MAYBE_NORMAL_FIELD :
598 if ( x == mTextQuote ) { 598 if ( x == mTextQuote ) {
599 field = ""; 599 field = "";
600 state = S_QUOTED_FIELD; 600 state = S_QUOTED_FIELD;
601 break; 601 break;
602 } 602 }
603 case S_NORMAL_FIELD : 603 case S_NORMAL_FIELD :
604 if ( x == mDelimiter || x == '\n' ) { 604 if ( x == mDelimiter || x == '\n' ) {
605 setText( row - mStartLine + 1, column, field ); 605 setText( row - mStartLine + 1, column, field );
606 field = ""; 606 field = "";
607 if ( x == '\n' ) { 607 if ( x == '\n' ) {
608 ++row; 608 ++row;
609 column = 1; 609 column = 1;
610 } else { 610 } else {
611 if ( ( ignoreDups == false ) || ( lastCharDelimiter == false ) ) 611 if ( ( ignoreDups == false ) || ( lastCharDelimiter == false ) )
612 ++column; 612 ++column;
613 lastCharDelimiter = true; 613 lastCharDelimiter = true;
614 } 614 }
615 state = S_START; 615 state = S_START;
616 } else { 616 } else {
617 field += x; 617 field += x;
618 } 618 }
619 } 619 }
620 if ( x != mDelimiter ) 620 if ( x != mDelimiter )
621 lastCharDelimiter = false; 621 lastCharDelimiter = false;
622 622
623 if ( column > maxColumn ) 623 if ( column > maxColumn )
624 maxColumn = column; 624 maxColumn = column;
625 } 625 }
626 626
627 // file with only one line without '\n' 627 // file with only one line without '\n'
628 if ( field.length() > 0 ) { 628 if ( field.length() > 0 ) {
629 setText( row - mStartLine + 1, column, field ); 629 setText( row - mStartLine + 1, column, field );
630 ++row; 630 ++row;
631 field = ""; 631 field = "";
632 } 632 }
633 633
634 adjustRows( row - mStartLine ); 634 adjustRows( row - mStartLine );
635 mTable->setNumCols( maxColumn ); 635 mTable->setNumCols( maxColumn );
636 636
637//US begin 637//US begin
638 QStringList keys; 638 QStringList keys;
639 uint iii = 0, count = mTypeMap.count(); 639 uint iii = 0, count = mTypeMap.count();
640 while ( iii < count ) { 640 while ( iii < count ) {