summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Side-by-side diff
Diffstat (limited to 'kaddressbook') (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/xxport/vcard_xxport.cpp15
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 );
+ }