summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/xxport/csv_xxport.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/kaddressbook/xxport/csv_xxport.cpp b/kaddressbook/xxport/csv_xxport.cpp
index 81148d9..7281003 100644
--- a/kaddressbook/xxport/csv_xxport.cpp
+++ b/kaddressbook/xxport/csv_xxport.cpp
@@ -26,16 +26,17 @@ Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (c) 2004 Ulf Schenk
27 27
28$Id$ 28$Id$
29*/ 29*/
30 30
31#include <qfile.h> 31#include <qfile.h>
32#include <qregexp.h> 32#include <qregexp.h>
33#include <qtextstream.h> 33#include <qtextstream.h>
34#include <qtextcodec.h>
34 35
35#include <kfiledialog.h> 36#include <kfiledialog.h>
36#ifndef KAB_EMBEDDED 37#ifndef KAB_EMBEDDED
37#include <kio/netaccess.h> 38#include <kio/netaccess.h>
38#endif //KAB_EMBEDDED 39#endif //KAB_EMBEDDED
39 40
40#include <klocale.h> 41#include <klocale.h>
41#include <kmessagebox.h> 42#include <kmessagebox.h>
@@ -146,16 +147,17 @@ KABC::AddresseeList CSVXXPort::importContacts( const QString& ) const
146 return dlg.contacts(); 147 return dlg.contacts();
147 else 148 else
148 return KABC::AddresseeList(); 149 return KABC::AddresseeList();
149} 150}
150 151
151void CSVXXPort::doExport( QFile *fp, const KABC::AddresseeList &list ) 152void CSVXXPort::doExport( QFile *fp, const KABC::AddresseeList &list )
152{ 153{
153 QTextStream t( fp ); 154 QTextStream t( fp );
155 t.setCodec( QTextCodec::codecForName("utf8") );
154 156
155 KABC::AddresseeList::ConstIterator iter; 157 KABC::AddresseeList::ConstIterator iter;
156 KABC::Field::List fields = addressBook()->fields(); 158 KABC::Field::List fields = addressBook()->fields();
157 KABC::Field::List::Iterator fieldIter; 159 KABC::Field::List::Iterator fieldIter;
158 bool first = true; 160 bool first = true;
159 161
160 // First output the column headings 162 // First output the column headings
161 for ( fieldIter = fields.begin(); fieldIter != fields.end(); ++fieldIter ) { 163 for ( fieldIter = fields.begin(); fieldIter != fields.end(); ++fieldIter ) {
@@ -172,17 +174,17 @@ void CSVXXPort::doExport( QFile *fp, const KABC::AddresseeList &list )
172 for ( iter = list.begin(); iter != list.end(); ++iter ) { 174 for ( iter = list.begin(); iter != list.end(); ++iter ) {
173 addr = *iter; 175 addr = *iter;
174 first = true; 176 first = true;
175 177
176 for ( fieldIter = fields.begin(); fieldIter != fields.end(); ++fieldIter ) { 178 for ( fieldIter = fields.begin(); fieldIter != fields.end(); ++fieldIter ) {
177 if ( !first ) 179 if ( !first )
178 t << ","; 180 t << ",";
179 181
180 t << "\"" << (*fieldIter)->value( addr ).replace( QRegExp("\n"), "\\n" ) << "\""; 182 t << "\"" << (*fieldIter)->value( addr ) << "\"";
181 first = false; 183 first = false;
182 } 184 }
183 185
184 t << "\n"; 186 t << "\n";
185 } 187 }
186} 188}
187 189
188#ifndef KAB_EMBEDDED 190#ifndef KAB_EMBEDDED