summaryrefslogtreecommitdiff
authoreilers <eilers>2003-01-13 15:49:31 (UTC)
committer eilers <eilers>2003-01-13 15:49:31 (UTC)
commit6bae3504f8eacd604bc6d543d3eb09f996221dcc (patch) (unidiff)
tree14032f862c724319b7b538e054cd53c11994bb4d
parent01f7b3b512bbb729ac44808748365699748f3d4c (diff)
downloadopie-6bae3504f8eacd604bc6d543d3eb09f996221dcc.zip
opie-6bae3504f8eacd604bc6d543d3eb09f996221dcc.tar.gz
opie-6bae3504f8eacd604bc6d543d3eb09f996221dcc.tar.bz2
Fixing crash when businesscard.vcf is missing..
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/ocontactaccessbackend_vcard.cpp13
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp13
2 files changed, 22 insertions, 4 deletions
diff --git a/libopie/pim/ocontactaccessbackend_vcard.cpp b/libopie/pim/ocontactaccessbackend_vcard.cpp
index ca9e410..1dc6b48 100644
--- a/libopie/pim/ocontactaccessbackend_vcard.cpp
+++ b/libopie/pim/ocontactaccessbackend_vcard.cpp
@@ -14,12 +14,15 @@
14 * 14 *
15 * ===================================================================== 15 * =====================================================================
16 * Version: $Id$ 16 * Version: $Id$
17 * ===================================================================== 17 * =====================================================================
18 * History: 18 * History:
19 * $Log$ 19 * $Log$
20 * Revision 1.6 2003/01/13 15:49:31 eilers
21 * Fixing crash when businesscard.vcf is missing..
22 *
20 * Revision 1.5 2002/12/07 13:26:22 eilers 23 * Revision 1.5 2002/12/07 13:26:22 eilers
21 * Fixing bug in storing anniversary.. 24 * Fixing bug in storing anniversary..
22 * 25 *
23 * Revision 1.4 2002/11/13 14:14:51 eilers 26 * Revision 1.4 2002/11/13 14:14:51 eilers
24 * Added sorted for Contacts.. 27 * Added sorted for Contacts..
25 * 28 *
@@ -52,15 +55,21 @@ OContactAccessBackend_VCard::OContactAccessBackend_VCard ( QString , QString fil
52bool OContactAccessBackend_VCard::load () 55bool OContactAccessBackend_VCard::load ()
53{ 56{
54 m_map.clear(); 57 m_map.clear();
55 m_dirty = false; 58 m_dirty = false;
56 59
57 VObject* obj = 0l; 60 VObject* obj = 0l;
58 obj = Parse_MIME_FromFileName( QFile::encodeName(m_file).data() ); 61
59 if ( !obj ) 62 if ( QFile( m_file ).exists() ){
63 obj = Parse_MIME_FromFileName( QFile::encodeName(m_file).data() );
64 if ( !obj )
65 return false;
66 }else{
67 qWarning("File \"%s\" not found !", m_file.latin1() );
60 return false; 68 return false;
69 }
61 70
62 while ( obj ) { 71 while ( obj ) {
63 OContact con = parseVObject( obj ); 72 OContact con = parseVObject( obj );
64 /* 73 /*
65 * if uid is 0 assign a new one 74 * if uid is 0 assign a new one
66 * this at least happens on 75 * this at least happens on
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp
index ca9e410..1dc6b48 100644
--- a/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp
+++ b/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp
@@ -14,12 +14,15 @@
14 * 14 *
15 * ===================================================================== 15 * =====================================================================
16 * Version: $Id$ 16 * Version: $Id$
17 * ===================================================================== 17 * =====================================================================
18 * History: 18 * History:
19 * $Log$ 19 * $Log$
20 * Revision 1.6 2003/01/13 15:49:31 eilers
21 * Fixing crash when businesscard.vcf is missing..
22 *
20 * Revision 1.5 2002/12/07 13:26:22 eilers 23 * Revision 1.5 2002/12/07 13:26:22 eilers
21 * Fixing bug in storing anniversary.. 24 * Fixing bug in storing anniversary..
22 * 25 *
23 * Revision 1.4 2002/11/13 14:14:51 eilers 26 * Revision 1.4 2002/11/13 14:14:51 eilers
24 * Added sorted for Contacts.. 27 * Added sorted for Contacts..
25 * 28 *
@@ -52,15 +55,21 @@ OContactAccessBackend_VCard::OContactAccessBackend_VCard ( QString , QString fil
52bool OContactAccessBackend_VCard::load () 55bool OContactAccessBackend_VCard::load ()
53{ 56{
54 m_map.clear(); 57 m_map.clear();
55 m_dirty = false; 58 m_dirty = false;
56 59
57 VObject* obj = 0l; 60 VObject* obj = 0l;
58 obj = Parse_MIME_FromFileName( QFile::encodeName(m_file).data() ); 61
59 if ( !obj ) 62 if ( QFile( m_file ).exists() ){
63 obj = Parse_MIME_FromFileName( QFile::encodeName(m_file).data() );
64 if ( !obj )
65 return false;
66 }else{
67 qWarning("File \"%s\" not found !", m_file.latin1() );
60 return false; 68 return false;
69 }
61 70
62 while ( obj ) { 71 while ( obj ) {
63 OContact con = parseVObject( obj ); 72 OContact con = parseVObject( obj );
64 /* 73 /*
65 * if uid is 0 assign a new one 74 * if uid is 0 assign a new one
66 * this at least happens on 75 * this at least happens on