equal
deleted
inserted
replaced
41 #include <s32buf.h> |
41 #include <s32buf.h> |
42 |
42 |
43 #include <VPbkStoreUriLiterals.h> |
43 #include <VPbkStoreUriLiterals.h> |
44 _LIT8( KPropXSelf, "X-SELF" ); |
44 _LIT8( KPropXSelf, "X-SELF" ); |
45 _LIT8( KPropXCategories, "X-CATEGORIES"); |
45 _LIT8( KPropXCategories, "X-CATEGORIES"); |
|
46 _LIT8( KPropXIMPP, "X-IMPP"); |
|
47 _LIT(KColon, ":"); |
46 |
48 |
47 CVPbkVCardImporter* CVPbkVCardImporter::NewL( |
49 CVPbkVCardImporter* CVPbkVCardImporter::NewL( |
48 RPointerArray<MVPbkStoreContact>& aImportedContacts, |
50 RPointerArray<MVPbkStoreContact>& aImportedContacts, |
49 RReadStream& aSourceStream, |
51 RReadStream& aSourceStream, |
50 MVPbkContactStore& aTargetStore, |
52 MVPbkContactStore& aTargetStore, |
201 MVPbkImportOperationObserver& aObserver ) |
203 MVPbkImportOperationObserver& aObserver ) |
202 { |
204 { |
203 iObserver = &aObserver; |
205 iObserver = &aObserver; |
204 } |
206 } |
205 |
207 |
|
208 CParserProperty* CVPbkVCardImporter::GetCurrentProperty() |
|
209 { |
|
210 // Get current property from parser array |
|
211 CParserProperty* property = NULL; |
|
212 TInt elementCount = iParser->ArrayOfProperties( EFalse )->Count(); |
|
213 if ( iArrayElementIndex < elementCount ) |
|
214 { |
|
215 property = |
|
216 iParser->ArrayOfProperties( EFalse )->At( iArrayElementIndex ); |
|
217 } |
|
218 return property; |
|
219 } |
|
220 |
206 CParserProperty* CVPbkVCardImporter::NextProperty() |
221 CParserProperty* CVPbkVCardImporter::NextProperty() |
207 { |
222 { |
208 // Get next property from parser array |
223 // Get next property from parser array |
209 CParserProperty* property = NULL; |
224 CParserProperty* property = NULL; |
210 TInt elementCount = iParser->ArrayOfProperties( EFalse )->Count(); |
225 TInt elementCount = iParser->ArrayOfProperties( EFalse )->Count(); |
329 TVPbkVCardDataConverter converter; |
344 TVPbkVCardDataConverter converter; |
330 if ( aData.Uid() == TUid::Uid( KVersitPropertyHBufCUid ) || |
345 if ( aData.Uid() == TUid::Uid( KVersitPropertyHBufCUid ) || |
331 aData.Uid() == TUid::Uid( KVersitPropertyCDesCArrayUid ) ) |
346 aData.Uid() == TUid::Uid( KVersitPropertyCDesCArrayUid ) ) |
332 { |
347 { |
333 const TDesC& value = converter.GetDesCData( aData ); |
348 const TDesC& value = converter.GetDesCData( aData ); |
334 SaveL( aData, value ); |
349 TInt pos = value.Find(KColon); |
|
350 if( 0 == pos && 0 == GetCurrentProperty()->Name().Compare(KPropXIMPP()) ) |
|
351 { |
|
352 // If the service name is NULL and it's a IMPP field, don't save the data. |
|
353 // e.g.: |
|
354 // (1) If the value is YAHOO:peterpan@yahoo.com, YAHOO is the service name |
|
355 // (2) If the value is :peterpan@yahoo.com, the service name is NULL |
|
356 isSaved = EFalse; |
|
357 } |
|
358 else |
|
359 { |
|
360 SaveL( aData, value ); |
|
361 } |
335 } |
362 } |
336 else if ( aData.Uid() == TUid::Uid( KVersitPropertyBinaryUid ) ) |
363 else if ( aData.Uid() == TUid::Uid( KVersitPropertyBinaryUid ) ) |
337 { |
364 { |
338 const TDesC8& value = converter.GetBinaryData( aData ); |
365 const TDesC8& value = converter.GetBinaryData( aData ); |
339 if ( value.Length() > 0 ) |
366 if ( value.Length() > 0 ) |