diff options
Diffstat (limited to 'kaddressbook/xxport/vcard_xxport.cpp')
| -rw-r--r-- | kaddressbook/xxport/vcard_xxport.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/kaddressbook/xxport/vcard_xxport.cpp b/kaddressbook/xxport/vcard_xxport.cpp index 293879cc..797c31d7 100644 --- a/kaddressbook/xxport/vcard_xxport.cpp +++ b/kaddressbook/xxport/vcard_xxport.cpp @@ -239,9 +239,22 @@ TDEABC::AddresseeList VCardXXPort::importContacts( const TQString& ) const // With version 3.0, vCards are encoded with UTF-8 by default. Otherwise, use fromLatin1() // and hope that are fields are encoded correctly. - if ( TQString::fromLatin1( rawData ).lower().contains( "version:3.0" ) ) { + bool useUtf8; + TQString tmp = TQString::fromLatin1(rawData).lower(); + int ver = tmp.find("version:"); + if (ver == -1) { + // no version info, assume utf8 + useUtf8 = true; + } + else { + float vCardVersion = tmp.mid(ver + 8, tmp.find("\n", ver)).toFloat(); + useUtf8 = (vCardVersion >= 3.0); + } + + if (useUtf8) { vCardText = TQString::fromUtf8( rawData ); - } else { + } + else { vCardText = TQString::fromLatin1( rawData ); } addrList += parseVCard( vCardText ); @@ -251,7 +264,7 @@ TDEABC::AddresseeList VCardXXPort::importContacts( const TQString& ) const } else { TQString text = i18n( "<qt>When trying to read the vCard, there was an error opening the file '%1': %2</qt>" ); text = text.arg( (*it).url() ); - text = text.arg( kapp->translate( "TQFile", + text = text.arg( tdeApp->translate( "TQFile", TQString(file.errorString()).latin1() ) ); KMessageBox::error( parentWidget(), text, caption ); anyFailures = true; |
