-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 @@ -329,65 +329,65 @@ KABC::AddresseeList CSVImportDialog::contacts() const break; case HomeAddressLabel: addrHome.setLabel( value ); break; case BusinessAddressStreet: addrWork.setStreet( value ); break; case BusinessAddressLocality: addrWork.setLocality( value ); break; case BusinessAddressRegion: addrWork.setRegion( value ); break; case BusinessAddressPostalCode: addrWork.setPostalCode( value ); break; case BusinessAddressCountry: addrWork.setCountry( value ); break; case BusinessAddressLabel: addrWork.setLabel( value ); break; default: KABC::Field::List fields = mAddressBook->fields( KABC::Field::CustomCategory ); KABC::Field::List::Iterator it; int counter = 0; for ( it = fields.begin(); it != fields.end(); ++it ) { if ( counter == (int)( posToType( item->currentItem() ) - mCustomCounter ) ) { (*it)->setValue( a, value ); - continue; + break; } ++counter; } break; } } if ( !addrHome.isEmpty() ) a.insertAddress( addrHome ); if ( !addrWork.isEmpty() ) a.insertAddress( addrWork ); if ( !emptyRow && !a.isEmpty() ) contacts.append( a ); } return contacts; } void CSVImportDialog::initGUI() { QWidget* page = plainPage(); QGridLayout *layout = new QGridLayout( page, 1, 1, marginHintSmall(), spacingHintSmall() ); QHBoxLayout *hbox = new QHBoxLayout(); hbox->setSpacing( spacingHint() ); QLabel *label = new QLabel( i18n( "File to import:" ), page ); hbox->addWidget( label ); mUrlRequester = new KURLRequester( page ); @@ -512,65 +512,65 @@ void CSVImportDialog::fillTable() inputStream.setEncoding( QTextStream::UnicodeUTF8 ); } else if ( mComboCodec->currentItem () == 1 ) { inputStream.setEncoding( QTextStream::Latin1 ); } else { inputStream.setEncoding( QTextStream::Locale ); } int maxColumn = 0; while ( !inputStream.atEnd() ) { inputStream >> x; // read one char if ( x == '\r' ) inputStream >> x; // eat '\r', to handle DOS/LOSEDOWS files correctly switch ( state ) { case S_START : if ( x == mTextQuote ) { state = S_QUOTED_FIELD; } else if ( x == mDelimiter ) { if ( ( ignoreDups == false ) || ( lastCharDelimiter == false ) ) ++column; lastCharDelimiter = true; } else if ( x == '\n' ) { ++row; column = 1; } else { field += x; state = S_MAYBE_NORMAL_FIELD; } break; case S_QUOTED_FIELD : if ( x == mTextQuote ) { state = S_MAYBE_END_OF_QUOTED_FIELD; - } else if ( x == '\n' ) { + } else if ( x == '\n' && mTextQuote.isNull() ) { setText( row - mStartLine + 1, column, field ); field = ""; if ( x == '\n' ) { ++row; column = 1; } else { if ( ( ignoreDups == false ) || ( lastCharDelimiter == false ) ) ++column; lastCharDelimiter = true; } state = S_START; } else { field += x; } break; case S_MAYBE_END_OF_QUOTED_FIELD : if ( x == mTextQuote ) { field += x; state = S_QUOTED_FIELD; } else if ( x == mDelimiter || x == '\n' ) { setText( row - mStartLine + 1, column, field ); field = ""; if ( x == '\n' ) { ++row; column = 1; } else { if ( ( ignoreDups == false ) || ( lastCharDelimiter == false ) ) ++column; lastCharDelimiter = true; } state = S_START; } else { |