summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Unidiff
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/xxport/vcard_xxport.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/kaddressbook/xxport/vcard_xxport.cpp b/kaddressbook/xxport/vcard_xxport.cpp
index 91df96d..9a8fa68 100644
--- a/kaddressbook/xxport/vcard_xxport.cpp
+++ b/kaddressbook/xxport/vcard_xxport.cpp
@@ -190,49 +190,55 @@ KABC::AddresseeList VCardXXPort::importContacts( const QString& ) const
190 else 190 else
191 { 191 {
192 //US url = XXPortManager::importURL; 192 //US url = XXPortManager::importURL;
193 qDebug("VCardXXPort::importContacts Urls at the moment not supported"); 193 qDebug("VCardXXPort::importContacts Urls at the moment not supported");
194 if ( url.isEmpty() ) 194 if ( url.isEmpty() )
195 return addrList; 195 return addrList;
196 196
197 } 197 }
198 QFile file( fileName ); 198 QFile file( fileName );
199 if ( file.open( IO_ReadOnly ) ) { 199 if ( file.open( IO_ReadOnly ) ) {
200 QCString rawData ( file.readAll().data(),file.size()+1); 200 QCString rawData ( file.readAll().data(),file.size()+1);
201 file.close(); 201 file.close();
202 int start = 0; 202 int start = 0;
203#ifndef DESKTOP_VERSION 203#ifndef DESKTOP_VERSION
204 while ( start < rawData.size()-2 ) { 204 while ( start < rawData.size()-2 ) {
205 if ( rawData.at( start ) == '\r' ) 205 if ( rawData.at( start ) == '\r' )
206 if ( rawData.at( start+1 ) == '\n' ) 206 if ( rawData.at( start+1 ) == '\n' )
207 if ( rawData.at( start+2 ) == ' ' ) { 207 if ( rawData.at( start+2 ) == ' ' ) {
208 rawData.remove(start,3); 208 rawData.remove(start,3);
209 --start; 209 --start;
210 } 210 }
211 ++start; 211 ++start;
212 } 212 }
213#endif 213#endif
214 addrList = parseVCard( QString::fromUtf8( rawData.data() ) ); 214 int ret = KMessageBox::warningYesNoCancel( 0, i18n("Select import format!\nDefault and standard is Utf8.\nLatin1 may be the right\nfor some West Europian languages."), i18n("Import Format"), i18n("Utf8"), i18n("Latin1") );
215 if ( ret == KMessageBox::Cancel )
216 return addrList;
217 if ( ret == KMessageBox::Yes )
218 addrList = parseVCard( QString::fromUtf8( rawData.data() ) );
219 else
220 addrList = parseVCard( QString::fromLatin1( rawData.data() ) );
215 } 221 }
216 222
217 } 223 }
218#endif //KAB_EMBEDDED 224#endif //KAB_EMBEDDED
219 225
220 return addrList; 226 return addrList;
221} 227}
222 228
223KABC::AddresseeList VCardXXPort::parseVCard( const QString &data ) const 229KABC::AddresseeList VCardXXPort::parseVCard( const QString &data ) const
224{ 230{
225 231
226 KABC::VCardTool tool; 232 KABC::VCardTool tool;
227 KABC::AddresseeList addrList; 233 KABC::AddresseeList addrList;
228 addrList = tool.parseVCards( data ); 234 addrList = tool.parseVCards( data );
229 // LR : I switched to the code, which is in current cvs HEAD 235 // LR : I switched to the code, which is in current cvs HEAD
230 /* 236 /*
231 uint numVCards = data.contains( "BEGIN:VCARD", false ); 237 uint numVCards = data.contains( "BEGIN:VCARD", false );
232 QStringList dataList = QStringList::split( "\r\n\r\n", data ); 238 QStringList dataList = QStringList::split( "\r\n\r\n", data );
233 239
234 for ( uint i = 0; i < numVCards && i < dataList.count(); ++i ) { 240 for ( uint i = 0; i < numVCards && i < dataList.count(); ++i ) {
235 KABC::Addressee addr; 241 KABC::Addressee addr;
236 bool ok = false; 242 bool ok = false;
237 243
238 if ( dataList[ i ].contains( "VERSION:3.0" ) ) 244 if ( dataList[ i ].contains( "VERSION:3.0" ) )