author | zautrix <zautrix> | 2005-01-18 22:46:53 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-18 22:46:53 (UTC) |
commit | bfb2947510c52f9c6b35c35786490f261adf30e3 (patch) (side-by-side diff) | |
tree | 63b0efc7fcfb7715cf99cf8d8594ec5278926a77 /kaddressbook | |
parent | 7200aeadd415cf88b909c00d1414f212cf85b3df (diff) | |
download | kdepimpi-bfb2947510c52f9c6b35c35786490f261adf30e3.zip kdepimpi-bfb2947510c52f9c6b35c35786490f261adf30e3.tar.gz kdepimpi-bfb2947510c52f9c6b35c35786490f261adf30e3.tar.bz2 |
another fix
-rw-r--r-- | kaddressbook/xxport/vcard_xxport.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/kaddressbook/xxport/vcard_xxport.cpp b/kaddressbook/xxport/vcard_xxport.cpp index acf6419..c56be8b 100644 --- a/kaddressbook/xxport/vcard_xxport.cpp +++ b/kaddressbook/xxport/vcard_xxport.cpp @@ -32,2 +32,3 @@ $Id$ #include <qtextstream.h> +#include <qfileinfo.h> @@ -148,6 +149,4 @@ KABC::AddresseeList VCardXXPort::importContacts( const QString& ) const url = XXPortManager::importURL; - if ( url.isEmpty() ) return addrList; - QString caption( i18n( "vCard Import Failed" ) ); @@ -183,5 +182,8 @@ KABC::AddresseeList VCardXXPort::importContacts( const QString& ) const fileName = KFileDialog::getOpenFileName( QString::null, i18n("Select vCard to Import"), parentWidget() ); + if ( fileName.isEmpty() ) return addrList; - + QFileInfo fi ( fileName ); + if ( !fi.isFile() ) + return addrList; } @@ -195,12 +197,9 @@ KABC::AddresseeList VCardXXPort::importContacts( const QString& ) const } - - QFile file( fileName ); - - file.open( IO_ReadOnly ); + if ( file.open( IO_ReadOnly ) ) { QByteArray rawData = file.readAll(); file.close(); - QString data = QString::fromUtf8( rawData.data(), rawData.size() + 1 ); addrList = parseVCard( data ); + } |