Diffstat (limited to 'libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp | 894 |
1 files changed, 448 insertions, 446 deletions
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp index ffa6a7d..b6ea461 100644 --- a/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp +++ b/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp | |||
@@ -35,6 +35,8 @@ | |||
35 | 35 | ||
36 | /* OPIE */ | 36 | /* OPIE */ |
37 | #include <opie2/ocontactaccessbackend_vcard.h> | 37 | #include <opie2/ocontactaccessbackend_vcard.h> |
38 | #include <opie2/odebug.h> | ||
39 | |||
38 | #include <qpe/timeconversion.h> | 40 | #include <qpe/timeconversion.h> |
39 | 41 | ||
40 | //FIXME: Hack to allow direct access to FILE* fh. Rewrite this! | 42 | //FIXME: Hack to allow direct access to FILE* fh. Rewrite this! |
@@ -45,107 +47,107 @@ | |||
45 | namespace Opie { | 47 | namespace Opie { |
46 | 48 | ||
47 | OPimContactAccessBackend_VCard::OPimContactAccessBackend_VCard ( const QString& , const QString& filename ): | 49 | OPimContactAccessBackend_VCard::OPimContactAccessBackend_VCard ( const QString& , const QString& filename ): |
48 | m_dirty( false ), | 50 | m_dirty( false ), |
49 | m_file( filename ) | 51 | m_file( filename ) |
50 | { | 52 | { |
51 | load(); | 53 | load(); |
52 | } | 54 | } |
53 | 55 | ||
54 | 56 | ||
55 | bool OPimContactAccessBackend_VCard::load () | 57 | bool OPimContactAccessBackend_VCard::load () |
56 | { | 58 | { |
57 | m_map.clear(); | 59 | m_map.clear(); |
58 | m_dirty = false; | 60 | m_dirty = false; |
59 | 61 | ||
60 | VObject* obj = 0l; | 62 | VObject* obj = 0l; |
61 | 63 | ||
62 | if ( QFile::exists(m_file) ){ | 64 | if ( QFile::exists(m_file) ){ |
63 | obj = Parse_MIME_FromFileName( QFile::encodeName(m_file).data() ); | 65 | obj = Parse_MIME_FromFileName( QFile::encodeName(m_file).data() ); |
64 | if ( !obj ) | 66 | if ( !obj ) |
65 | return false; | 67 | return false; |
66 | }else{ | 68 | }else{ |
67 | qWarning("File \"%s\" not found !", m_file.latin1() ); | 69 | owarn << "File \"" << m_file << "\" not found !" << oendl; |
68 | return false; | 70 | return false; |
69 | } | 71 | } |
70 | 72 | ||
71 | while ( obj ) { | 73 | while ( obj ) { |
72 | OPimContact con = parseVObject( obj ); | 74 | OPimContact con = parseVObject( obj ); |
73 | /* | 75 | /* |
74 | * if uid is 0 assign a new one | 76 | * if uid is 0 assign a new one |
75 | * this at least happens on | 77 | * this at least happens on |
76 | * Nokia6210 | 78 | * Nokia6210 |
77 | */ | 79 | */ |
78 | if ( con.uid() == 0 ){ | 80 | if ( con.uid() == 0 ){ |
79 | con.setUid( 1 ); | 81 | con.setUid( 1 ); |
80 | qWarning("assigned new uid %d",con.uid() ); | 82 | owarn << "assigned new uid " << con.uid() << "" << oendl; |
81 | } | 83 | } |
82 | 84 | ||
83 | m_map.insert( con.uid(), con ); | 85 | m_map.insert( con.uid(), con ); |
84 | 86 | ||
85 | VObject *t = obj; | 87 | VObject *t = obj; |
86 | obj = nextVObjectInList(obj); | 88 | obj = nextVObjectInList(obj); |
87 | cleanVObject( t ); | 89 | cleanVObject( t ); |
88 | } | 90 | } |
89 | 91 | ||
90 | return true; | 92 | return true; |
91 | 93 | ||
92 | } | 94 | } |
93 | bool OPimContactAccessBackend_VCard::reload() | 95 | bool OPimContactAccessBackend_VCard::reload() |
94 | { | 96 | { |
95 | return load(); | 97 | return load(); |
96 | } | 98 | } |
97 | bool OPimContactAccessBackend_VCard::save() | 99 | bool OPimContactAccessBackend_VCard::save() |
98 | { | 100 | { |
99 | if (!m_dirty ) | 101 | if (!m_dirty ) |
100 | return true; | 102 | return true; |
101 | 103 | ||
102 | QFile file( m_file ); | 104 | QFile file( m_file ); |
103 | if (!file.open(IO_WriteOnly ) ) | 105 | if (!file.open(IO_WriteOnly ) ) |
104 | return false; | 106 | return false; |
105 | 107 | ||
106 | VObject *obj; | 108 | VObject *obj; |
107 | obj = newVObject( VCCalProp ); | 109 | obj = newVObject( VCCalProp ); |
108 | addPropValue( obj, VCVersionProp, "1.0" ); | 110 | addPropValue( obj, VCVersionProp, "1.0" ); |
109 | 111 | ||
110 | VObject *vo; | 112 | VObject *vo; |
111 | for(QMap<int, OPimContact>::ConstIterator it=m_map.begin(); it !=m_map.end(); ++it ){ | 113 | for(QMap<int, OPimContact>::ConstIterator it=m_map.begin(); it !=m_map.end(); ++it ){ |
112 | vo = createVObject( *it ); | 114 | vo = createVObject( *it ); |
113 | writeVObject( file.fh, vo ); //FIXME: HACK!!! | 115 | writeVObject( file.fh, vo ); //FIXME: HACK!!! |
114 | cleanVObject( vo ); | 116 | cleanVObject( vo ); |
115 | } | 117 | } |
116 | cleanStrTbl(); | 118 | cleanStrTbl(); |
117 | deleteVObject( obj ); | 119 | deleteVObject( obj ); |
118 | 120 | ||
119 | m_dirty = false; | 121 | m_dirty = false; |
120 | return true; | 122 | return true; |
121 | 123 | ||
122 | 124 | ||
123 | } | 125 | } |
124 | void OPimContactAccessBackend_VCard::clear () | 126 | void OPimContactAccessBackend_VCard::clear () |
125 | { | 127 | { |
126 | m_map.clear(); | 128 | m_map.clear(); |
127 | m_dirty = true; // ??? sure ? (se) | 129 | m_dirty = true; // ??? sure ? (se) |
128 | } | 130 | } |
129 | 131 | ||
130 | bool OPimContactAccessBackend_VCard::add ( const OPimContact& newcontact ) | 132 | bool OPimContactAccessBackend_VCard::add ( const OPimContact& newcontact ) |
131 | { | 133 | { |
132 | m_map.insert( newcontact.uid(), newcontact ); | 134 | m_map.insert( newcontact.uid(), newcontact ); |
133 | m_dirty = true; | 135 | m_dirty = true; |
134 | return true; | 136 | return true; |
135 | } | 137 | } |
136 | 138 | ||
137 | bool OPimContactAccessBackend_VCard::remove ( int uid ) | 139 | bool OPimContactAccessBackend_VCard::remove ( int uid ) |
138 | { | 140 | { |
139 | m_map.remove( uid ); | 141 | m_map.remove( uid ); |
140 | m_dirty = true; | 142 | m_dirty = true; |
141 | return true; | 143 | return true; |
142 | } | 144 | } |
143 | 145 | ||
144 | bool OPimContactAccessBackend_VCard::replace ( const OPimContact &contact ) | 146 | bool OPimContactAccessBackend_VCard::replace ( const OPimContact &contact ) |
145 | { | 147 | { |
146 | m_map.replace( contact.uid(), contact ); | 148 | m_map.replace( contact.uid(), contact ); |
147 | m_dirty = true; | 149 | m_dirty = true; |
148 | return true; | 150 | return true; |
149 | } | 151 | } |
150 | 152 | ||
151 | OPimContact OPimContactAccessBackend_VCard::find ( int uid ) const | 153 | OPimContact OPimContactAccessBackend_VCard::find ( int uid ) const |
@@ -155,50 +157,50 @@ OPimContact OPimContactAccessBackend_VCard::find ( int uid ) const | |||
155 | 157 | ||
156 | QArray<int> OPimContactAccessBackend_VCard::allRecords() const | 158 | QArray<int> OPimContactAccessBackend_VCard::allRecords() const |
157 | { | 159 | { |
158 | QArray<int> ar( m_map.count() ); | 160 | QArray<int> ar( m_map.count() ); |
159 | QMap<int, OPimContact>::ConstIterator it; | 161 | QMap<int, OPimContact>::ConstIterator it; |
160 | int i = 0; | 162 | int i = 0; |
161 | for ( it = m_map.begin(); it != m_map.end(); ++it ) { | 163 | for ( it = m_map.begin(); it != m_map.end(); ++it ) { |
162 | ar[i] = it.key(); | 164 | ar[i] = it.key(); |
163 | i++; | 165 | i++; |
164 | } | 166 | } |
165 | return ar; | 167 | return ar; |
166 | } | 168 | } |
167 | 169 | ||
168 | // Not implemented | 170 | // Not implemented |
169 | QArray<int> OPimContactAccessBackend_VCard::queryByExample ( const OPimContact&, int, const QDateTime& ) | 171 | QArray<int> OPimContactAccessBackend_VCard::queryByExample ( const OPimContact&, int, const QDateTime& ) |
170 | { | 172 | { |
171 | QArray<int> ar(0); | 173 | QArray<int> ar(0); |
172 | return ar; | 174 | return ar; |
173 | } | 175 | } |
174 | 176 | ||
175 | // Not implemented | 177 | // Not implemented |
176 | QArray<int> OPimContactAccessBackend_VCard::matchRegexp( const QRegExp& ) const | 178 | QArray<int> OPimContactAccessBackend_VCard::matchRegexp( const QRegExp& ) const |
177 | { | 179 | { |
178 | QArray<int> ar(0); | 180 | QArray<int> ar(0); |
179 | return ar; | 181 | return ar; |
180 | } | 182 | } |
181 | 183 | ||
182 | const uint OPimContactAccessBackend_VCard::querySettings() | 184 | const uint OPimContactAccessBackend_VCard::querySettings() |
183 | { | 185 | { |
184 | return 0; // No search possible | 186 | return 0; // No search possible |
185 | } | 187 | } |
186 | 188 | ||
187 | bool OPimContactAccessBackend_VCard::hasQuerySettings (uint ) const | 189 | bool OPimContactAccessBackend_VCard::hasQuerySettings (uint ) const |
188 | { | 190 | { |
189 | return false; // No search possible, therefore all settings invalid ;) | 191 | return false; // No search possible, therefore all settings invalid ;) |
190 | } | 192 | } |
191 | 193 | ||
192 | bool OPimContactAccessBackend_VCard::wasChangedExternally() | 194 | bool OPimContactAccessBackend_VCard::wasChangedExternally() |
193 | { | 195 | { |
194 | return false; // Don't expect concurrent access | 196 | return false; // Don't expect concurrent access |
195 | } | 197 | } |
196 | 198 | ||
197 | // Not implemented | 199 | // Not implemented |
198 | QArray<int> OPimContactAccessBackend_VCard::sorted( bool , int, int, int ) | 200 | QArray<int> OPimContactAccessBackend_VCard::sorted( bool , int, int, int ) |
199 | { | 201 | { |
200 | QArray<int> ar(0); | 202 | QArray<int> ar(0); |
201 | return ar; | 203 | return ar; |
202 | } | 204 | } |
203 | 205 | ||
204 | // *** Private stuff *** | 206 | // *** Private stuff *** |
@@ -206,391 +208,391 @@ QArray<int> OPimContactAccessBackend_VCard::sorted( bool , int, int, int ) | |||
206 | 208 | ||
207 | OPimContact OPimContactAccessBackend_VCard::parseVObject( VObject *obj ) | 209 | OPimContact OPimContactAccessBackend_VCard::parseVObject( VObject *obj ) |
208 | { | 210 | { |
209 | OPimContact c; | 211 | OPimContact c; |
210 | 212 | ||
211 | VObjectIterator it; | 213 | VObjectIterator it; |
212 | initPropIterator( &it, obj ); | 214 | initPropIterator( &it, obj ); |
213 | while( moreIteration( &it ) ) { | 215 | while( moreIteration( &it ) ) { |
214 | VObject *o = nextVObject( &it ); | 216 | VObject *o = nextVObject( &it ); |
215 | QCString name = vObjectName( o ); | 217 | QCString name = vObjectName( o ); |
216 | QCString value = vObjectStringZValue( o ); | 218 | QCString value = vObjectStringZValue( o ); |
217 | if ( name == VCNameProp ) { | 219 | if ( name == VCNameProp ) { |
218 | VObjectIterator nit; | 220 | VObjectIterator nit; |
219 | initPropIterator( &nit, o ); | 221 | initPropIterator( &nit, o ); |
220 | while( moreIteration( &nit ) ) { | 222 | while( moreIteration( &nit ) ) { |
221 | VObject *o = nextVObject( &nit ); | 223 | VObject *o = nextVObject( &nit ); |
222 | QCString name = vObjectTypeInfo( o ); | 224 | QCString name = vObjectTypeInfo( o ); |
223 | QString value = vObjectStringZValue( o ); | 225 | QString value = vObjectStringZValue( o ); |
224 | if ( name == VCNamePrefixesProp ) | 226 | if ( name == VCNamePrefixesProp ) |
225 | c.setTitle( value ); | 227 | c.setTitle( value ); |
226 | else if ( name == VCNameSuffixesProp ) | 228 | else if ( name == VCNameSuffixesProp ) |
227 | c.setSuffix( value ); | 229 | c.setSuffix( value ); |
228 | else if ( name == VCFamilyNameProp ) | 230 | else if ( name == VCFamilyNameProp ) |
229 | c.setLastName( value ); | 231 | c.setLastName( value ); |
230 | else if ( name == VCGivenNameProp ) | 232 | else if ( name == VCGivenNameProp ) |
231 | c.setFirstName( value ); | 233 | c.setFirstName( value ); |
232 | else if ( name == VCAdditionalNamesProp ) | 234 | else if ( name == VCAdditionalNamesProp ) |
233 | c.setMiddleName( value ); | 235 | c.setMiddleName( value ); |
234 | } | 236 | } |
235 | } | 237 | } |
236 | else if ( name == VCAdrProp ) { | 238 | else if ( name == VCAdrProp ) { |
237 | bool work = TRUE; // default address is work address | 239 | bool work = TRUE; // default address is work address |
238 | QString street; | 240 | QString street; |
239 | QString city; | 241 | QString city; |
240 | QString region; | 242 | QString region; |
241 | QString postal; | 243 | QString postal; |
242 | QString country; | 244 | QString country; |
243 | 245 | ||
244 | VObjectIterator nit; | 246 | VObjectIterator nit; |
245 | initPropIterator( &nit, o ); | 247 | initPropIterator( &nit, o ); |
246 | while( moreIteration( &nit ) ) { | 248 | while( moreIteration( &nit ) ) { |
247 | VObject *o = nextVObject( &nit ); | 249 | VObject *o = nextVObject( &nit ); |
248 | QCString name = vObjectName( o ); | 250 | QCString name = vObjectName( o ); |
249 | QString value = vObjectStringZValue( o ); | 251 | QString value = vObjectStringZValue( o ); |
250 | if ( name == VCHomeProp ) | 252 | if ( name == VCHomeProp ) |
251 | work = FALSE; | 253 | work = FALSE; |
252 | else if ( name == VCWorkProp ) | 254 | else if ( name == VCWorkProp ) |
253 | work = TRUE; | 255 | work = TRUE; |
254 | else if ( name == VCStreetAddressProp ) | 256 | else if ( name == VCStreetAddressProp ) |
255 | street = value; | 257 | street = value; |
256 | else if ( name == VCCityProp ) | 258 | else if ( name == VCCityProp ) |
257 | city = value; | 259 | city = value; |
258 | else if ( name == VCRegionProp ) | 260 | else if ( name == VCRegionProp ) |
259 | region = value; | 261 | region = value; |
260 | else if ( name == VCPostalCodeProp ) | 262 | else if ( name == VCPostalCodeProp ) |
261 | postal = value; | 263 | postal = value; |
262 | else if ( name == VCCountryNameProp ) | 264 | else if ( name == VCCountryNameProp ) |
263 | country = value; | 265 | country = value; |
264 | } | 266 | } |
265 | if ( work ) { | 267 | if ( work ) { |
266 | c.setBusinessStreet( street ); | 268 | c.setBusinessStreet( street ); |
267 | c.setBusinessCity( city ); | 269 | c.setBusinessCity( city ); |
268 | c.setBusinessCountry( country ); | 270 | c.setBusinessCountry( country ); |
269 | c.setBusinessZip( postal ); | 271 | c.setBusinessZip( postal ); |
270 | c.setBusinessState( region ); | 272 | c.setBusinessState( region ); |
271 | } else { | 273 | } else { |
272 | c.setHomeStreet( street ); | 274 | c.setHomeStreet( street ); |
273 | c.setHomeCity( city ); | 275 | c.setHomeCity( city ); |
274 | c.setHomeCountry( country ); | 276 | c.setHomeCountry( country ); |
275 | c.setHomeZip( postal ); | 277 | c.setHomeZip( postal ); |
276 | c.setHomeState( region ); | 278 | c.setHomeState( region ); |
277 | } | 279 | } |
278 | } | 280 | } |
279 | else if ( name == VCTelephoneProp ) { | 281 | else if ( name == VCTelephoneProp ) { |
280 | enum { | 282 | enum { |
281 | HOME = 0x01, | 283 | HOME = 0x01, |
282 | WORK = 0x02, | 284 | WORK = 0x02, |
283 | VOICE = 0x04, | 285 | VOICE = 0x04, |
284 | CELL = 0x08, | 286 | CELL = 0x08, |
285 | FAX = 0x10, | 287 | FAX = 0x10, |
286 | PAGER = 0x20, | 288 | PAGER = 0x20, |
287 | UNKNOWN = 0x80 | 289 | UNKNOWN = 0x80 |
288 | }; | 290 | }; |
289 | int type = 0; | 291 | int type = 0; |
290 | 292 | ||
291 | VObjectIterator nit; | 293 | VObjectIterator nit; |
292 | initPropIterator( &nit, o ); | 294 | initPropIterator( &nit, o ); |
293 | while( moreIteration( &nit ) ) { | 295 | while( moreIteration( &nit ) ) { |
294 | VObject *o = nextVObject( &nit ); | 296 | VObject *o = nextVObject( &nit ); |
295 | QCString name = vObjectTypeInfo( o ); | 297 | QCString name = vObjectTypeInfo( o ); |
296 | if ( name == VCHomeProp ) | 298 | if ( name == VCHomeProp ) |
297 | type |= HOME; | 299 | type |= HOME; |
298 | else if ( name == VCWorkProp ) | 300 | else if ( name == VCWorkProp ) |
299 | type |= WORK; | 301 | type |= WORK; |
300 | else if ( name == VCVoiceProp ) | 302 | else if ( name == VCVoiceProp ) |
301 | type |= VOICE; | 303 | type |= VOICE; |
302 | else if ( name == VCCellularProp ) | 304 | else if ( name == VCCellularProp ) |
303 | type |= CELL; | 305 | type |= CELL; |
304 | else if ( name == VCFaxProp ) | 306 | else if ( name == VCFaxProp ) |
305 | type |= FAX; | 307 | type |= FAX; |
306 | else if ( name == VCPagerProp ) | 308 | else if ( name == VCPagerProp ) |
307 | type |= PAGER; | 309 | type |= PAGER; |
308 | else if ( name == VCPreferredProp ) | 310 | else if ( name == VCPreferredProp ) |
309 | ; | 311 | ; |
310 | else | 312 | else |
311 | type |= UNKNOWN; | 313 | type |= UNKNOWN; |
312 | } | 314 | } |
313 | if ( (type & UNKNOWN) != UNKNOWN ) { | 315 | if ( (type & UNKNOWN) != UNKNOWN ) { |
314 | if ( ( type & (HOME|WORK) ) == 0 ) // default | 316 | if ( ( type & (HOME|WORK) ) == 0 ) // default |
315 | type |= HOME; | 317 | type |= HOME; |
316 | if ( ( type & (VOICE|CELL|FAX|PAGER) ) == 0 ) // default | 318 | if ( ( type & (VOICE|CELL|FAX|PAGER) ) == 0 ) // default |
317 | type |= VOICE; | 319 | type |= VOICE; |
318 | 320 | ||
319 | qWarning("value %s %d", value.data(), type ); | 321 | owarn << "value " << value.data() << " " << type << "" << oendl; |
320 | if ( (type & (VOICE|HOME) ) == (VOICE|HOME) && (type & (CELL|HOME) ) != (CELL|HOME) ) | 322 | if ( (type & (VOICE|HOME) ) == (VOICE|HOME) && (type & (CELL|HOME) ) != (CELL|HOME) ) |
321 | c.setHomePhone( value ); | 323 | c.setHomePhone( value ); |
322 | if ( ( type & (FAX|HOME) ) == (FAX|HOME) ) | 324 | if ( ( type & (FAX|HOME) ) == (FAX|HOME) ) |
323 | c.setHomeFax( value ); | 325 | c.setHomeFax( value ); |
324 | if ( ( type & (CELL|HOME) ) == (CELL|HOME) ) | 326 | if ( ( type & (CELL|HOME) ) == (CELL|HOME) ) |
325 | c.setHomeMobile( value ); | 327 | c.setHomeMobile( value ); |
326 | if ( ( type & (VOICE|WORK) ) == (VOICE|WORK) && (type & (CELL|WORK) ) != (CELL|WORK) ) | 328 | if ( ( type & (VOICE|WORK) ) == (VOICE|WORK) && (type & (CELL|WORK) ) != (CELL|WORK) ) |
327 | c.setBusinessPhone( value ); | 329 | c.setBusinessPhone( value ); |
328 | if ( ( type & (FAX|WORK) ) == (FAX|WORK) ) | 330 | if ( ( type & (FAX|WORK) ) == (FAX|WORK) ) |
329 | c.setBusinessFax( value ); | 331 | c.setBusinessFax( value ); |
330 | if ( ( type & (CELL|WORK) ) == (CELL|WORK) ) | 332 | if ( ( type & (CELL|WORK) ) == (CELL|WORK) ) |
331 | c.setBusinessMobile( value ); | 333 | c.setBusinessMobile( value ); |
332 | if ( ( type & (PAGER|WORK) ) == (PAGER|WORK) ) | 334 | if ( ( type & (PAGER|WORK) ) == (PAGER|WORK) ) |
333 | c.setBusinessPager( value ); | 335 | c.setBusinessPager( value ); |
334 | } | 336 | } |
335 | } | 337 | } |
336 | else if ( name == VCEmailAddressProp ) { | 338 | else if ( name == VCEmailAddressProp ) { |
337 | QString email = vObjectStringZValue( o ); | 339 | QString email = vObjectStringZValue( o ); |
338 | bool valid = TRUE; | 340 | bool valid = TRUE; |
339 | VObjectIterator nit; | 341 | VObjectIterator nit; |
340 | initPropIterator( &nit, o ); | 342 | initPropIterator( &nit, o ); |
341 | while( moreIteration( &nit ) ) { | 343 | while( moreIteration( &nit ) ) { |
342 | VObject *o = nextVObject( &nit ); | 344 | VObject *o = nextVObject( &nit ); |
343 | QCString name = vObjectTypeInfo( o ); | 345 | QCString name = vObjectTypeInfo( o ); |
344 | if ( name != VCInternetProp && name != VCHomeProp && | 346 | if ( name != VCInternetProp && name != VCHomeProp && |
345 | name != VCWorkProp && | 347 | name != VCWorkProp && |
346 | name != VCPreferredProp ) | 348 | name != VCPreferredProp ) |
347 | // ### preffered should map to default email | 349 | // ### preffered should map to default email |
348 | valid = FALSE; | 350 | valid = FALSE; |
349 | } | 351 | } |
350 | if ( valid ) { | 352 | if ( valid ) { |
351 | c.insertEmail( email ); | 353 | c.insertEmail( email ); |
352 | } | 354 | } |
353 | } | 355 | } |
354 | else if ( name == VCURLProp ) { | 356 | else if ( name == VCURLProp ) { |
355 | VObjectIterator nit; | 357 | VObjectIterator nit; |
356 | initPropIterator( &nit, o ); | 358 | initPropIterator( &nit, o ); |
357 | while( moreIteration( &nit ) ) { | 359 | while( moreIteration( &nit ) ) { |
358 | VObject *o = nextVObject( &nit ); | 360 | VObject *o = nextVObject( &nit ); |
359 | QCString name = vObjectTypeInfo( o ); | 361 | QCString name = vObjectTypeInfo( o ); |
360 | if ( name == VCHomeProp ) | 362 | if ( name == VCHomeProp ) |
361 | c.setHomeWebpage( value ); | 363 | c.setHomeWebpage( value ); |
362 | else if ( name == VCWorkProp ) | 364 | else if ( name == VCWorkProp ) |
363 | c.setBusinessWebpage( value ); | 365 | c.setBusinessWebpage( value ); |
364 | } | 366 | } |
365 | } | 367 | } |
366 | else if ( name == VCOrgProp ) { | 368 | else if ( name == VCOrgProp ) { |
367 | VObjectIterator nit; | 369 | VObjectIterator nit; |
368 | initPropIterator( &nit, o ); | 370 | initPropIterator( &nit, o ); |
369 | while( moreIteration( &nit ) ) { | 371 | while( moreIteration( &nit ) ) { |
370 | VObject *o = nextVObject( &nit ); | 372 | VObject *o = nextVObject( &nit ); |
371 | QCString name = vObjectName( o ); | 373 | QCString name = vObjectName( o ); |
372 | QString value = vObjectStringZValue( o ); | 374 | QString value = vObjectStringZValue( o ); |
373 | if ( name == VCOrgNameProp ) | 375 | if ( name == VCOrgNameProp ) |
374 | c.setCompany( value ); | 376 | c.setCompany( value ); |
375 | else if ( name == VCOrgUnitProp ) | 377 | else if ( name == VCOrgUnitProp ) |
376 | c.setDepartment( value ); | 378 | c.setDepartment( value ); |
377 | else if ( name == VCOrgUnit2Prop ) | 379 | else if ( name == VCOrgUnit2Prop ) |
378 | c.setOffice( value ); | 380 | c.setOffice( value ); |
379 | } | 381 | } |
380 | } | 382 | } |
381 | else if ( name == VCTitleProp ) { | 383 | else if ( name == VCTitleProp ) { |
382 | c.setJobTitle( value ); | 384 | c.setJobTitle( value ); |
383 | } | 385 | } |
384 | else if ( name == "X-Qtopia-Profession" ) { | 386 | else if ( name == "X-Qtopia-Profession" ) { |
385 | c.setProfession( value ); | 387 | c.setProfession( value ); |
386 | } | 388 | } |
387 | else if ( name == "X-Qtopia-Manager" ) { | 389 | else if ( name == "X-Qtopia-Manager" ) { |
388 | c.setManager( value ); | 390 | c.setManager( value ); |
389 | } | 391 | } |
390 | else if ( name == "X-Qtopia-Assistant" ) { | 392 | else if ( name == "X-Qtopia-Assistant" ) { |
391 | c.setAssistant( value ); | 393 | c.setAssistant( value ); |
392 | } | 394 | } |
393 | else if ( name == "X-Qtopia-Spouse" ) { | 395 | else if ( name == "X-Qtopia-Spouse" ) { |
394 | c.setSpouse( value ); | 396 | c.setSpouse( value ); |
395 | } | 397 | } |
396 | else if ( name == "X-Qtopia-Gender" ) { | 398 | else if ( name == "X-Qtopia-Gender" ) { |
397 | c.setGender( value ); | 399 | c.setGender( value ); |
398 | } | 400 | } |
399 | else if ( name == "X-Qtopia-Anniversary" ) { | 401 | else if ( name == "X-Qtopia-Anniversary" ) { |
400 | c.setAnniversary( convVCardDateToDate( value ) ); | 402 | c.setAnniversary( convVCardDateToDate( value ) ); |
401 | } | 403 | } |
402 | else if ( name == "X-Qtopia-Nickname" ) { | 404 | else if ( name == "X-Qtopia-Nickname" ) { |
403 | c.setNickname( value ); | 405 | c.setNickname( value ); |
404 | } | 406 | } |
405 | else if ( name == "X-Qtopia-Children" ) { | 407 | else if ( name == "X-Qtopia-Children" ) { |
406 | c.setChildren( value ); | 408 | c.setChildren( value ); |
407 | } | 409 | } |
408 | else if ( name == VCBirthDateProp ) { | 410 | else if ( name == VCBirthDateProp ) { |
409 | // Reading Birthdate regarding RFC 2425 (5.8.4) | 411 | // Reading Birthdate regarding RFC 2425 (5.8.4) |
410 | c.setBirthday( convVCardDateToDate( value ) ); | 412 | c.setBirthday( convVCardDateToDate( value ) ); |
411 | 413 | ||
412 | } | 414 | } |
413 | else if ( name == VCCommentProp ) { | 415 | else if ( name == VCCommentProp ) { |
414 | c.setNotes( value ); | 416 | c.setNotes( value ); |
415 | } | 417 | } |
416 | #if 0 | 418 | #if 0 |
417 | else { | 419 | else { |
418 | printf("Name: %s, value=%s\n", name.data(), vObjectStringZValue( o ) ); | 420 | printf("Name: %s, value=%s\n", name.data(), vObjectStringZValue( o ) ); |
419 | VObjectIterator nit; | 421 | VObjectIterator nit; |
420 | initPropIterator( &nit, o ); | 422 | initPropIterator( &nit, o ); |
421 | while( moreIteration( &nit ) ) { | 423 | while( moreIteration( &nit ) ) { |
422 | VObject *o = nextVObject( &nit ); | 424 | VObject *o = nextVObject( &nit ); |
423 | QCString name = vObjectName( o ); | 425 | QCString name = vObjectName( o ); |
424 | QString value = vObjectStringZValue( o ); | 426 | QString value = vObjectStringZValue( o ); |
425 | printf(" subprop: %s = %s\n", name.data(), value.latin1() ); | 427 | printf(" subprop: %s = %s\n", name.data(), value.latin1() ); |
426 | } | 428 | } |
427 | } | 429 | } |
428 | #endif | 430 | #endif |
429 | } | 431 | } |
430 | c.setFileAs(); | 432 | c.setFileAs(); |
431 | return c; | 433 | return c; |
432 | } | 434 | } |
433 | 435 | ||
434 | 436 | ||
435 | VObject* OPimContactAccessBackend_VCard::createVObject( const OPimContact &c ) | 437 | VObject* OPimContactAccessBackend_VCard::createVObject( const OPimContact &c ) |
436 | { | 438 | { |
437 | VObject *vcard = newVObject( VCCardProp ); | 439 | VObject *vcard = newVObject( VCCardProp ); |
438 | safeAddPropValue( vcard, VCVersionProp, "2.1" ); | 440 | safeAddPropValue( vcard, VCVersionProp, "2.1" ); |
439 | safeAddPropValue( vcard, VCLastRevisedProp, TimeConversion::toISO8601( QDateTime::currentDateTime() ) ); | 441 | safeAddPropValue( vcard, VCLastRevisedProp, TimeConversion::toISO8601( QDateTime::currentDateTime() ) ); |
440 | safeAddPropValue( vcard, VCUniqueStringProp, QString::number(c.uid()) ); | 442 | safeAddPropValue( vcard, VCUniqueStringProp, QString::number(c.uid()) ); |
441 | 443 | ||
442 | // full name | 444 | // full name |
443 | safeAddPropValue( vcard, VCFullNameProp, c.fullName() ); | 445 | safeAddPropValue( vcard, VCFullNameProp, c.fullName() ); |
444 | 446 | ||
445 | // name properties | 447 | // name properties |
446 | VObject *name = safeAddProp( vcard, VCNameProp ); | 448 | VObject *name = safeAddProp( vcard, VCNameProp ); |
447 | safeAddPropValue( name, VCFamilyNameProp, c.lastName() ); | 449 | safeAddPropValue( name, VCFamilyNameProp, c.lastName() ); |
448 | safeAddPropValue( name, VCGivenNameProp, c.firstName() ); | 450 | safeAddPropValue( name, VCGivenNameProp, c.firstName() ); |
449 | safeAddPropValue( name, VCAdditionalNamesProp, c.middleName() ); | 451 | safeAddPropValue( name, VCAdditionalNamesProp, c.middleName() ); |
450 | safeAddPropValue( name, VCNamePrefixesProp, c.title() ); | 452 | safeAddPropValue( name, VCNamePrefixesProp, c.title() ); |
451 | safeAddPropValue( name, VCNameSuffixesProp, c.suffix() ); | 453 | safeAddPropValue( name, VCNameSuffixesProp, c.suffix() ); |
452 | 454 | ||
453 | // home properties | 455 | // home properties |
454 | VObject *home_adr= safeAddProp( vcard, VCAdrProp ); | 456 | VObject *home_adr= safeAddProp( vcard, VCAdrProp ); |
455 | safeAddProp( home_adr, VCHomeProp ); | 457 | safeAddProp( home_adr, VCHomeProp ); |
456 | safeAddPropValue( home_adr, VCStreetAddressProp, c.homeStreet() ); | 458 | safeAddPropValue( home_adr, VCStreetAddressProp, c.homeStreet() ); |
457 | safeAddPropValue( home_adr, VCCityProp, c.homeCity() ); | 459 | safeAddPropValue( home_adr, VCCityProp, c.homeCity() ); |
458 | safeAddPropValue( home_adr, VCRegionProp, c.homeState() ); | 460 | safeAddPropValue( home_adr, VCRegionProp, c.homeState() ); |
459 | safeAddPropValue( home_adr, VCPostalCodeProp, c.homeZip() ); | 461 | safeAddPropValue( home_adr, VCPostalCodeProp, c.homeZip() ); |
460 | safeAddPropValue( home_adr, VCCountryNameProp, c.homeCountry() ); | 462 | safeAddPropValue( home_adr, VCCountryNameProp, c.homeCountry() ); |
461 | 463 | ||
462 | VObject *home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homePhone() ); | 464 | VObject *home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homePhone() ); |
463 | safeAddProp( home_phone, VCHomeProp ); | 465 | safeAddProp( home_phone, VCHomeProp ); |
464 | home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homeMobile() ); | 466 | home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homeMobile() ); |
465 | safeAddProp( home_phone, VCHomeProp ); | 467 | safeAddProp( home_phone, VCHomeProp ); |
466 | safeAddProp( home_phone, VCCellularProp ); | 468 | safeAddProp( home_phone, VCCellularProp ); |
467 | home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homeFax() ); | 469 | home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homeFax() ); |
468 | safeAddProp( home_phone, VCHomeProp ); | 470 | safeAddProp( home_phone, VCHomeProp ); |
469 | safeAddProp( home_phone, VCFaxProp ); | 471 | safeAddProp( home_phone, VCFaxProp ); |
470 | 472 | ||
471 | VObject *url = safeAddPropValue( vcard, VCURLProp, c.homeWebpage() ); | 473 | VObject *url = safeAddPropValue( vcard, VCURLProp, c.homeWebpage() ); |
472 | safeAddProp( url, VCHomeProp ); | 474 | safeAddProp( url, VCHomeProp ); |
473 | 475 | ||
474 | // work properties | 476 | // work properties |
475 | VObject *work_adr= safeAddProp( vcard, VCAdrProp ); | 477 | VObject *work_adr= safeAddProp( vcard, VCAdrProp ); |
476 | safeAddProp( work_adr, VCWorkProp ); | 478 | safeAddProp( work_adr, VCWorkProp ); |
477 | safeAddPropValue( work_adr, VCStreetAddressProp, c.businessStreet() ); | 479 | safeAddPropValue( work_adr, VCStreetAddressProp, c.businessStreet() ); |
478 | safeAddPropValue( work_adr, VCCityProp, c.businessCity() ); | 480 | safeAddPropValue( work_adr, VCCityProp, c.businessCity() ); |
479 | safeAddPropValue( work_adr, VCRegionProp, c.businessState() ); | 481 | safeAddPropValue( work_adr, VCRegionProp, c.businessState() ); |
480 | safeAddPropValue( work_adr, VCPostalCodeProp, c.businessZip() ); | 482 | safeAddPropValue( work_adr, VCPostalCodeProp, c.businessZip() ); |
481 | safeAddPropValue( work_adr, VCCountryNameProp, c.businessCountry() ); | 483 | safeAddPropValue( work_adr, VCCountryNameProp, c.businessCountry() ); |
482 | 484 | ||
483 | VObject *work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPhone() ); | 485 | VObject *work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPhone() ); |
484 | safeAddProp( work_phone, VCWorkProp ); | 486 | safeAddProp( work_phone, VCWorkProp ); |
485 | work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessMobile() ); | 487 | work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessMobile() ); |
486 | safeAddProp( work_phone, VCWorkProp ); | 488 | safeAddProp( work_phone, VCWorkProp ); |
487 | safeAddProp( work_phone, VCCellularProp ); | 489 | safeAddProp( work_phone, VCCellularProp ); |
488 | work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessFax() ); | 490 | work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessFax() ); |
489 | safeAddProp( work_phone, VCWorkProp ); | 491 | safeAddProp( work_phone, VCWorkProp ); |
490 | safeAddProp( work_phone, VCFaxProp ); | 492 | safeAddProp( work_phone, VCFaxProp ); |
491 | work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPager() ); | 493 | work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPager() ); |
492 | safeAddProp( work_phone, VCWorkProp ); | 494 | safeAddProp( work_phone, VCWorkProp ); |
493 | safeAddProp( work_phone, VCPagerProp ); | 495 | safeAddProp( work_phone, VCPagerProp ); |
494 | 496 | ||
495 | url = safeAddPropValue( vcard, VCURLProp, c.businessWebpage() ); | 497 | url = safeAddPropValue( vcard, VCURLProp, c.businessWebpage() ); |
496 | safeAddProp( url, VCWorkProp ); | 498 | safeAddProp( url, VCWorkProp ); |
497 | 499 | ||
498 | VObject *title = safeAddPropValue( vcard, VCTitleProp, c.jobTitle() ); | 500 | VObject *title = safeAddPropValue( vcard, VCTitleProp, c.jobTitle() ); |
499 | safeAddProp( title, VCWorkProp ); | 501 | safeAddProp( title, VCWorkProp ); |
500 | 502 | ||
501 | 503 | ||
502 | QStringList emails = c.emailList(); | 504 | QStringList emails = c.emailList(); |
503 | // emails.prepend( c.defaultEmail() ); Fix for bugreport #1045 | 505 | // emails.prepend( c.defaultEmail() ); Fix for bugreport #1045 |
504 | for( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) { | 506 | for( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) { |
505 | VObject *email = safeAddPropValue( vcard, VCEmailAddressProp, *it ); | 507 | VObject *email = safeAddPropValue( vcard, VCEmailAddressProp, *it ); |
506 | safeAddProp( email, VCInternetProp ); | 508 | safeAddProp( email, VCInternetProp ); |
507 | } | 509 | } |
508 | 510 | ||
509 | safeAddPropValue( vcard, VCNoteProp, c.notes() ); | 511 | safeAddPropValue( vcard, VCNoteProp, c.notes() ); |
510 | 512 | ||
511 | // Exporting Birthday regarding RFC 2425 (5.8.4) | 513 | // Exporting Birthday regarding RFC 2425 (5.8.4) |
512 | if ( c.birthday().isValid() ){ | 514 | if ( c.birthday().isValid() ){ |
513 | qWarning("Exporting birthday as: %s", convDateToVCardDate( c.birthday() ).latin1() ); | 515 | owarn << "Exporting birthday as: " << convDateToVCardDate( c.birthday() ) << "" << oendl; |
514 | safeAddPropValue( vcard, VCBirthDateProp, convDateToVCardDate( c.birthday() ) ); | 516 | safeAddPropValue( vcard, VCBirthDateProp, convDateToVCardDate( c.birthday() ) ); |
515 | } | 517 | } |
516 | 518 | ||
517 | if ( !c.company().isEmpty() || !c.department().isEmpty() || !c.office().isEmpty() ) { | 519 | if ( !c.company().isEmpty() || !c.department().isEmpty() || !c.office().isEmpty() ) { |
518 | VObject *org = safeAddProp( vcard, VCOrgProp ); | 520 | VObject *org = safeAddProp( vcard, VCOrgProp ); |
519 | safeAddPropValue( org, VCOrgNameProp, c.company() ); | 521 | safeAddPropValue( org, VCOrgNameProp, c.company() ); |
520 | safeAddPropValue( org, VCOrgUnitProp, c.department() ); | 522 | safeAddPropValue( org, VCOrgUnitProp, c.department() ); |
521 | safeAddPropValue( org, VCOrgUnit2Prop, c.office() ); | 523 | safeAddPropValue( org, VCOrgUnit2Prop, c.office() ); |
522 | } | 524 | } |
523 | 525 | ||
524 | // some values we have to export as custom fields | 526 | // some values we have to export as custom fields |
525 | safeAddPropValue( vcard, "X-Qtopia-Profession", c.profession() ); | 527 | safeAddPropValue( vcard, "X-Qtopia-Profession", c.profession() ); |
526 | safeAddPropValue( vcard, "X-Qtopia-Manager", c.manager() ); | 528 | safeAddPropValue( vcard, "X-Qtopia-Manager", c.manager() ); |
527 | safeAddPropValue( vcard, "X-Qtopia-Assistant", c.assistant() ); | 529 | safeAddPropValue( vcard, "X-Qtopia-Assistant", c.assistant() ); |
528 | 530 | ||
529 | safeAddPropValue( vcard, "X-Qtopia-Spouse", c.spouse() ); | 531 | safeAddPropValue( vcard, "X-Qtopia-Spouse", c.spouse() ); |
530 | safeAddPropValue( vcard, "X-Qtopia-Gender", c.gender() ); | 532 | safeAddPropValue( vcard, "X-Qtopia-Gender", c.gender() ); |
531 | if ( c.anniversary().isValid() ){ | 533 | if ( c.anniversary().isValid() ){ |
532 | qWarning("Exporting anniversary as: %s", convDateToVCardDate( c.anniversary() ).latin1() ); | 534 | owarn << "Exporting anniversary as: " << convDateToVCardDate( c.anniversary() ) << "" << oendl; |
533 | safeAddPropValue( vcard, "X-Qtopia-Anniversary", convDateToVCardDate( c.anniversary() ) ); | 535 | safeAddPropValue( vcard, "X-Qtopia-Anniversary", convDateToVCardDate( c.anniversary() ) ); |
534 | } | 536 | } |
535 | safeAddPropValue( vcard, "X-Qtopia-Nickname", c.nickname() ); | 537 | safeAddPropValue( vcard, "X-Qtopia-Nickname", c.nickname() ); |
536 | safeAddPropValue( vcard, "X-Qtopia-Children", c.children() ); | 538 | safeAddPropValue( vcard, "X-Qtopia-Children", c.children() ); |
537 | 539 | ||
538 | return vcard; | 540 | return vcard; |
539 | } | 541 | } |
540 | 542 | ||
541 | QString OPimContactAccessBackend_VCard::convDateToVCardDate( const QDate& d ) const | 543 | QString OPimContactAccessBackend_VCard::convDateToVCardDate( const QDate& d ) const |
542 | { | 544 | { |
543 | QString str_rfc2425 = QString("%1-%2-%3") | 545 | QString str_rfc2425 = QString("%1-%2-%3") |
544 | .arg( d.year() ) | 546 | .arg( d.year() ) |
545 | .arg( d.month(), 2 ) | 547 | .arg( d.month(), 2 ) |
546 | .arg( d.day(), 2 ); | 548 | .arg( d.day(), 2 ); |
547 | // Now replace spaces with "0"... | 549 | // Now replace spaces with "0"... |
548 | int pos = 0; | 550 | int pos = 0; |
549 | while ( ( pos = str_rfc2425.find (' ') ) > 0 ) | 551 | while ( ( pos = str_rfc2425.find (' ') ) > 0 ) |
550 | str_rfc2425.replace( pos, 1, "0" ); | 552 | str_rfc2425.replace( pos, 1, "0" ); |
551 | 553 | ||
552 | return str_rfc2425; | 554 | return str_rfc2425; |
553 | } | 555 | } |
554 | 556 | ||
555 | QDate OPimContactAccessBackend_VCard::convVCardDateToDate( const QString& datestr ) | 557 | QDate OPimContactAccessBackend_VCard::convVCardDateToDate( const QString& datestr ) |
556 | { | 558 | { |
557 | int monthPos = datestr.find('-'); | 559 | int monthPos = datestr.find('-'); |
558 | int dayPos = datestr.find('-', monthPos+1 ); | 560 | int dayPos = datestr.find('-', monthPos+1 ); |
559 | int sep_ignore = 1; | 561 | int sep_ignore = 1; |
560 | if ( monthPos == -1 || dayPos == -1 ) { | 562 | if ( monthPos == -1 || dayPos == -1 ) { |
561 | qDebug("fromString didn't find - in str = %s; mpos = %d ypos = %d", datestr.latin1(), monthPos, dayPos ); | 563 | odebug << "fromString didn't find - in str = " << datestr << "; mpos = " << monthPos << " ypos = " << dayPos << "" << oendl; |
562 | // Ok.. No "-" found, therefore we will try to read other format ( YYYYMMDD ) | 564 | // Ok.. No "-" found, therefore we will try to read other format ( YYYYMMDD ) |
563 | if ( datestr.length() == 8 ){ | 565 | if ( datestr.length() == 8 ){ |
564 | monthPos = 4; | 566 | monthPos = 4; |
565 | dayPos = 6; | 567 | dayPos = 6; |
566 | sep_ignore = 0; | 568 | sep_ignore = 0; |
567 | qDebug("Try with follwing positions str = %s; mpos = %d ypos = %d", datestr.latin1(), monthPos, dayPos ); | 569 | odebug << "Try with follwing positions str = " << datestr << "; mpos = " << monthPos << " ypos = " << dayPos << "" << oendl; |
568 | } else { | 570 | } else { |
569 | return QDate(); | 571 | return QDate(); |
570 | } | 572 | } |
571 | } | 573 | } |
572 | int y = datestr.left( monthPos ).toInt(); | 574 | int y = datestr.left( monthPos ).toInt(); |
573 | int m = datestr.mid( monthPos + sep_ignore, dayPos - monthPos - sep_ignore ).toInt(); | 575 | int m = datestr.mid( monthPos + sep_ignore, dayPos - monthPos - sep_ignore ).toInt(); |
574 | int d = datestr.mid( dayPos + sep_ignore ).toInt(); | 576 | int d = datestr.mid( dayPos + sep_ignore ).toInt(); |
575 | qDebug("TimeConversion::fromString ymd = %s => %d %d %d; mpos = %d ypos = %d", datestr.latin1(), y, m, d, monthPos, dayPos); | 577 | odebug << "TimeConversion::fromString ymd = " << datestr << " => " << y << " " << m << " " << d << "; mpos = " << monthPos << " ypos = " << dayPos << "" << oendl; |
576 | QDate date ( y,m,d ); | 578 | QDate date ( y,m,d ); |
577 | return date; | 579 | return date; |
578 | } | 580 | } |
579 | 581 | ||
580 | VObject* OPimContactAccessBackend_VCard::safeAddPropValue( VObject *o, const char *prop, const QString &value ) | 582 | VObject* OPimContactAccessBackend_VCard::safeAddPropValue( VObject *o, const char *prop, const QString &value ) |
581 | { | 583 | { |
582 | VObject *ret = 0; | 584 | VObject *ret = 0; |
583 | if ( o && !value.isEmpty() ) | 585 | if ( o && !value.isEmpty() ) |
584 | ret = addPropValue( o, prop, value.latin1() ); | 586 | ret = addPropValue( o, prop, value.latin1() ); |
585 | return ret; | 587 | return ret; |
586 | } | 588 | } |
587 | 589 | ||
588 | VObject* OPimContactAccessBackend_VCard::safeAddProp( VObject *o, const char *prop) | 590 | VObject* OPimContactAccessBackend_VCard::safeAddProp( VObject *o, const char *prop) |
589 | { | 591 | { |
590 | VObject *ret = 0; | 592 | VObject *ret = 0; |
591 | if ( o ) | 593 | if ( o ) |
592 | ret = addProp( o, prop ); | 594 | ret = addProp( o, prop ); |
593 | return ret; | 595 | return ret; |
594 | } | 596 | } |
595 | 597 | ||
596 | } | 598 | } |