|
1 /* |
|
2 * Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Importing the CParserProperty field from CParserVCard to |
|
15 * contact field. |
|
16 * |
|
17 */ |
|
18 |
|
19 #include "CVPbkVCardImporter.h" |
|
20 #include "CVPbkVCardPropertyParser.h" |
|
21 #include "CVPbkVCardAttributeHandler.h" |
|
22 #include "CVPbkVCardFieldTypeProperty.h" |
|
23 #include "CVPbkVCardContactFieldIterator.h" |
|
24 #include "CVPbkVCardData.h" |
|
25 #include "TVPbkVCardDataConverter.h" |
|
26 #include "CVPbkVCardContactFieldData.h" |
|
27 |
|
28 #include <MVPbkStoreContact.h> |
|
29 #include <MVPbkContactStore.h> |
|
30 #include <MVPbkContactCopyPolicy.h> |
|
31 #include <MVPbkContactFieldData.h> |
|
32 #include <MVPbkContactStoreProperties.h> |
|
33 #include <MVPbkContactAttribute.h> |
|
34 #include <MVPbkContactOperationBase.h> |
|
35 #include <CVPbkContactManager.h> |
|
36 #include <MVPbkStoreContactFieldCollection.h> |
|
37 |
|
38 // System includes |
|
39 #include <vcard.h> |
|
40 #include <bldvariant.hrh> |
|
41 #include <s32buf.h> |
|
42 |
|
43 #include <VPbkStoreUriLiterals.h> |
|
44 _LIT8( KPropXSelf, "X-SELF" ); |
|
45 _LIT8( KPropXCategories, "X-CATEGORIES"); |
|
46 |
|
47 CVPbkVCardImporter* CVPbkVCardImporter::NewL( |
|
48 RPointerArray<MVPbkStoreContact>& aImportedContacts, |
|
49 RReadStream& aSourceStream, |
|
50 MVPbkContactStore& aTargetStore, |
|
51 CVPbkVCardData& aData ) |
|
52 { |
|
53 CVPbkVCardImporter* self = new (ELeave) CVPbkVCardImporter( |
|
54 aImportedContacts, aTargetStore, aData); |
|
55 CleanupStack::PushL( self ); |
|
56 self->ConstructL(aSourceStream); |
|
57 CleanupStack::Pop( self ); |
|
58 return self; |
|
59 } |
|
60 |
|
61 CVPbkVCardImporter::CVPbkVCardImporter( |
|
62 RPointerArray<MVPbkStoreContact>& aImportedContacts, |
|
63 MVPbkContactStore& aTargetStore, |
|
64 CVPbkVCardData& aData ) : |
|
65 CActive( EPriorityStandard ), |
|
66 iImportedContacts( aImportedContacts ), |
|
67 iTargetStore( aTargetStore ), |
|
68 iData( aData ) |
|
69 { |
|
70 CActiveScheduler::Add( this ); |
|
71 } |
|
72 |
|
73 CVPbkVCardImporter::~CVPbkVCardImporter() |
|
74 { |
|
75 Cancel(); |
|
76 delete iAddCntContactFieldOperation; |
|
77 delete iCntContact; |
|
78 if (iCntModelStore) |
|
79 { |
|
80 iCntModelStore->Close(*this); |
|
81 } |
|
82 iSourceStream.Close(); |
|
83 delete iStreamBuffer; |
|
84 delete iAddFieldOperation; |
|
85 delete iAttributeHandler; |
|
86 delete iContactFieldIterator; |
|
87 delete iCurContact; |
|
88 delete iPropertyParser; |
|
89 delete iParser; |
|
90 delete iGroupCardValue; |
|
91 |
|
92 iErasableFields.Close(); |
|
93 } |
|
94 |
|
95 void CVPbkVCardImporter::ConstructL(RReadStream& aSourceStream) |
|
96 { |
|
97 |
|
98 // Get the source stream size |
|
99 MStreamBuf* buf = aSourceStream.Source(); |
|
100 TInt streamSize = buf->SizeL(); |
|
101 |
|
102 // Read the source contents |
|
103 iStreamBuffer = HBufC8::NewL(streamSize); |
|
104 TPtr8 ptr(iStreamBuffer->Des()); |
|
105 aSourceStream.ReadL(ptr, streamSize); |
|
106 |
|
107 // Create a new local stream |
|
108 iSourceStream.Open(*iStreamBuffer); |
|
109 |
|
110 iParser = CParserVCard::NewL(); |
|
111 |
|
112 |
|
113 iAttributeHandler = CVPbkVCardAttributeHandler::NewL(); |
|
114 iPropertyParser = |
|
115 CVPbkVCardPropertyParser::NewL( iData, *iAttributeHandler ); |
|
116 iCopyPolicy = &iData.CopyPolicyL( iTargetStore.StoreProperties().Uri() ); |
|
117 if ( iTargetStore.StoreProperties().Uri().UriDes().CompareC( |
|
118 KVPbkSimGlobalAdnURI()) == 0 ) |
|
119 { |
|
120 iCntCopyPolicy = &iData.CopyPolicyL( iData.GetCntModelStoreL().StoreProperties().Uri() ); |
|
121 } |
|
122 iOwnCard = EFalse; |
|
123 // Construct an empty string to ensure that iGroupCardValue always exists |
|
124 // See also GetGroupcardvalue() |
|
125 iGroupCardValue = HBufC::NewL(0); |
|
126 } |
|
127 |
|
128 void CVPbkVCardImporter::StartL() |
|
129 { |
|
130 iOwnCard = EFalse; |
|
131 TRAPD( err, iParser->InternalizeL( iSourceStream ) ); |
|
132 |
|
133 if ( err != KErrEof ) // allow partial vcard data |
|
134 { |
|
135 User::LeaveIfError( err ); |
|
136 } |
|
137 |
|
138 if ( !iParser->ArrayOfProperties( EFalse ) ) |
|
139 { |
|
140 User::Leave( KErrNotFound ); |
|
141 } |
|
142 |
|
143 // This function just starts the process asynchronously. |
|
144 (KErrEof == err) ? StartAsync( EStop ) : StartAsync( EParseNext ); |
|
145 } |
|
146 |
|
147 void CVPbkVCardImporter::RunL() |
|
148 { |
|
149 if ( iStatus.Int() == KErrNone ) |
|
150 { |
|
151 switch( iState ) |
|
152 { |
|
153 case EParseNext: |
|
154 { |
|
155 if ( !iCurContact ) |
|
156 { |
|
157 // If contact haven't not been created, create new one. |
|
158 iCurContact = iTargetStore.CreateNewContactLC(); |
|
159 CleanupStack::Pop(); // iCurContact |
|
160 if ( iCntCopyPolicy ) |
|
161 { |
|
162 iCntModelStore = &iData.GetCntModelStoreL(); |
|
163 iCntModelStore->OpenL(*this); |
|
164 break; |
|
165 } |
|
166 } |
|
167 ParseNextL(); |
|
168 break; |
|
169 } |
|
170 case ESaveField: |
|
171 { |
|
172 SaveFieldL(); |
|
173 break; |
|
174 } |
|
175 case ESaveContact: |
|
176 { |
|
177 SaveContactL(); |
|
178 break; |
|
179 } |
|
180 case EStop: |
|
181 { |
|
182 iObserver->ContactsImportingCompleted(); |
|
183 break; |
|
184 } |
|
185 default:; |
|
186 } |
|
187 } |
|
188 } |
|
189 |
|
190 TInt CVPbkVCardImporter::RunError( TInt aError ) |
|
191 { |
|
192 HandleError( aError ); |
|
193 return KErrNone; |
|
194 } |
|
195 |
|
196 void CVPbkVCardImporter::DoCancel() |
|
197 { |
|
198 } |
|
199 |
|
200 void CVPbkVCardImporter::SetObserver( |
|
201 MVPbkImportOperationObserver& aObserver ) |
|
202 { |
|
203 iObserver = &aObserver; |
|
204 } |
|
205 |
|
206 CParserProperty* CVPbkVCardImporter::NextProperty() |
|
207 { |
|
208 // Get next property from parser array |
|
209 CParserProperty* property = NULL; |
|
210 TInt elementCount = iParser->ArrayOfProperties( EFalse )->Count(); |
|
211 if ( iArrayElementIndex < elementCount ) |
|
212 { |
|
213 property = |
|
214 iParser->ArrayOfProperties( EFalse )->At( iArrayElementIndex ); |
|
215 ++iArrayElementIndex; |
|
216 } |
|
217 return property; |
|
218 } |
|
219 |
|
220 void CVPbkVCardImporter::ParseNextL() |
|
221 { |
|
222 delete iContactFieldIterator; |
|
223 iContactFieldIterator = NULL; |
|
224 |
|
225 CParserProperty* property = NextProperty(); |
|
226 if ( property ) |
|
227 { |
|
228 if(property->Name().Compare(KPropXSelf())==0) |
|
229 { |
|
230 iOwnCard = ETrue; |
|
231 } |
|
232 |
|
233 if( property->Name().Compare(KPropXCategories())==0) |
|
234 { |
|
235 iGroupCard = ETrue; |
|
236 CParserPropertyValue* value = property->Value(); |
|
237 // Get the HBufC property |
|
238 CParserPropertyValueHBufC* hbufVal = |
|
239 static_cast<CParserPropertyValueHBufC*>(value); |
|
240 TPtrC normalVal = hbufVal->Value(); |
|
241 // Create a modifiable descriptor |
|
242 if( iGroupCardValue ) |
|
243 { |
|
244 delete iGroupCardValue; |
|
245 iGroupCardValue = NULL; |
|
246 } |
|
247 iGroupCardValue = normalVal.AllocL(); |
|
248 } |
|
249 // property is owned by iParser->ArrayOfProperties(), we are not |
|
250 // responsible of deleting it. |
|
251 iContactFieldIterator = iPropertyParser->ParseNextL( property ); |
|
252 iState = ESaveField; |
|
253 } |
|
254 else |
|
255 { |
|
256 // No properties anymore, all fields are added. Save contact. |
|
257 iState = ESaveContact; |
|
258 } |
|
259 StartAsync( iState ); |
|
260 } |
|
261 |
|
262 TInt CVPbkVCardImporter::FindContactFieldL( |
|
263 MVPbkStoreContact* aContact, |
|
264 TInt aFieldTypeResId ) |
|
265 { |
|
266 if ( aContact ) |
|
267 { |
|
268 const MVPbkStoreContactFieldCollection& fields = aContact->Fields(); |
|
269 const TInt fieldCount = fields.FieldCount(); |
|
270 |
|
271 const TInt maxMatchPriority = 0; |
|
272 iData.GetContactManager().FieldTypes().MaxMatchPriority(); |
|
273 |
|
274 for ( TInt matchPriority = 0; |
|
275 matchPriority <= maxMatchPriority; ++matchPriority ) |
|
276 { |
|
277 for ( TInt i = 0; i < fieldCount; ++i ) |
|
278 { |
|
279 const MVPbkFieldType* fieldType = |
|
280 fields.FieldAt(i).MatchFieldType(matchPriority); |
|
281 if ( fieldType->FieldTypeResId() == aFieldTypeResId ) |
|
282 { |
|
283 return i; |
|
284 } |
|
285 } |
|
286 } |
|
287 } |
|
288 |
|
289 return KErrNotFound; |
|
290 } |
|
291 |
|
292 void CVPbkVCardImporter::SaveFieldL() |
|
293 { |
|
294 if ( iContactFieldIterator->HasNext() ) |
|
295 { |
|
296 // Get next field data |
|
297 CVPbkVCardContactFieldData* data = iContactFieldIterator->NextLC(); |
|
298 // Save data asynchronously, if data is not saved e.g. empty field |
|
299 // this is treated as synchronous function. |
|
300 TBool saved = EFalse; |
|
301 // SaveDataL may leave when constructing add field operation |
|
302 // (e.g. for valid but unsupported in the current build field type) |
|
303 // leave should be trapped and saving continue |
|
304 TRAPD(err, saved = SaveDataL( *data )); |
|
305 CleanupStack::PopAndDestroy( data ); |
|
306 if ( !saved ) |
|
307 { |
|
308 // If data was not saved try to move next field. |
|
309 if ( err == KErrNone ) |
|
310 { |
|
311 StartAsync( ESaveField ); |
|
312 } |
|
313 else |
|
314 { |
|
315 HandleFailedFieldAdditionL( err ); |
|
316 } |
|
317 } |
|
318 } |
|
319 else |
|
320 { |
|
321 StartAsync( EParseNext ); |
|
322 } |
|
323 } |
|
324 |
|
325 TBool CVPbkVCardImporter::SaveDataL( CVPbkVCardContactFieldData& aData ) |
|
326 { |
|
327 // Data value type should be asked from aData |
|
328 TBool isSaved ( ETrue ); |
|
329 TVPbkVCardDataConverter converter; |
|
330 if ( aData.Uid() == TUid::Uid( KVersitPropertyHBufCUid ) || |
|
331 aData.Uid() == TUid::Uid( KVersitPropertyCDesCArrayUid ) ) |
|
332 { |
|
333 const TDesC& value = converter.GetDesCData( aData ); |
|
334 SaveL( aData, value ); |
|
335 } |
|
336 else if ( aData.Uid() == TUid::Uid( KVersitPropertyBinaryUid ) ) |
|
337 { |
|
338 const TDesC8& value = converter.GetBinaryData( aData ); |
|
339 if ( value.Length() > 0 ) |
|
340 { |
|
341 SaveL( aData, value ); |
|
342 } |
|
343 else |
|
344 { |
|
345 isSaved = EFalse; |
|
346 } |
|
347 } |
|
348 else if ( aData.Uid() == TUid::Uid( KVersitPropertyDateUid ) ) |
|
349 { |
|
350 const TVersitDateTime* value = converter.GetDateTimeData( aData ); |
|
351 if ( value ) |
|
352 { |
|
353 SaveL( aData, *value ); |
|
354 } |
|
355 else |
|
356 { |
|
357 isSaved = EFalse; |
|
358 } |
|
359 } |
|
360 else |
|
361 { |
|
362 // In case the UID is something else. Should not happen ever, because |
|
363 // uids are defined by us. |
|
364 isSaved = EFalse; |
|
365 } |
|
366 |
|
367 return isSaved; |
|
368 } |
|
369 |
|
370 void CVPbkVCardImporter::SaveL( |
|
371 CVPbkVCardContactFieldData& aData, const TVersitDateTime& aValue ) |
|
372 { |
|
373 iAddFieldOperation = iCopyPolicy->AddFieldToContactL( |
|
374 *iCurContact, |
|
375 aData.FieldType(), |
|
376 aValue.iDateTime, |
|
377 NULL, |
|
378 aData.Attribute(), |
|
379 *this ); |
|
380 } |
|
381 |
|
382 void CVPbkVCardImporter::SaveL( |
|
383 CVPbkVCardContactFieldData& aData, const TDesC& aValue ) |
|
384 { |
|
385 if( iCntContact ) |
|
386 { |
|
387 iAddCntContactFieldOperation = iCntCopyPolicy->AddFieldToContactL( |
|
388 *iCntContact, |
|
389 aData.FieldType(), |
|
390 aValue, |
|
391 NULL, |
|
392 aData.Attribute(), |
|
393 *this ); |
|
394 } |
|
395 |
|
396 // If it is 'FN' vcard field, |
|
397 // it can be overwriten by lastname subfield of 'N' vcard field |
|
398 TInt fieldTypeResId = iContactFieldIterator->FindVCardFieldL( |
|
399 EVPbkVersitNameFN, |
|
400 EVPbkVersitSubFieldNone ); |
|
401 if ( fieldTypeResId != KErrNotFound ) |
|
402 { |
|
403 if ( FindContactFieldL( iCurContact, fieldTypeResId ) == |
|
404 KErrNotFound ) |
|
405 { |
|
406 iErasableFields.Append( fieldTypeResId ); |
|
407 } |
|
408 } |
|
409 else |
|
410 { |
|
411 fieldTypeResId = aData.FieldType().FieldTypeResId(); |
|
412 TInt id = iErasableFields.Find( fieldTypeResId ); |
|
413 if ( id != KErrNotFound ) |
|
414 { |
|
415 TInt field = FindContactFieldL( iCurContact, fieldTypeResId ); |
|
416 if ( field != KErrNotFound ) |
|
417 { |
|
418 iCurContact->RemoveField( field ); |
|
419 } |
|
420 iErasableFields.Remove( id ); |
|
421 } |
|
422 } |
|
423 |
|
424 iAddFieldOperation = iCopyPolicy->AddFieldToContactL( |
|
425 *iCurContact, |
|
426 aData.FieldType(), |
|
427 aValue, |
|
428 NULL, |
|
429 aData.Attribute(), |
|
430 *this ); |
|
431 } |
|
432 |
|
433 void CVPbkVCardImporter::SaveL( |
|
434 CVPbkVCardContactFieldData& aData, const TDesC8& aValue ) |
|
435 { |
|
436 iAddFieldOperation = iCopyPolicy->AddFieldToContactL( |
|
437 *iCurContact, |
|
438 aData.FieldType(), |
|
439 aValue, |
|
440 NULL, |
|
441 aData.Attribute(), |
|
442 *this ); |
|
443 } |
|
444 |
|
445 void CVPbkVCardImporter::FieldAddedToContact( |
|
446 MVPbkContactOperationBase& aOperation) |
|
447 { |
|
448 if (&aOperation == iAddFieldOperation) |
|
449 { |
|
450 delete iAddFieldOperation; |
|
451 iAddFieldOperation = NULL; |
|
452 StartAsync( ESaveField ); |
|
453 } |
|
454 if (&aOperation == iAddCntContactFieldOperation) |
|
455 { |
|
456 delete iAddCntContactFieldOperation; |
|
457 iAddCntContactFieldOperation = NULL; |
|
458 } |
|
459 } |
|
460 |
|
461 void CVPbkVCardImporter::FieldAddingFailed( |
|
462 MVPbkContactOperationBase& aOperation, |
|
463 TInt aError) |
|
464 { |
|
465 if (&aOperation == iAddFieldOperation) |
|
466 { |
|
467 delete iAddFieldOperation; |
|
468 iAddFieldOperation = NULL; |
|
469 TRAPD( error, HandleFailedFieldAdditionL( aError ) ); |
|
470 HandleError( error ); |
|
471 } |
|
472 if (&aOperation == iAddCntContactFieldOperation) |
|
473 { |
|
474 delete iAddCntContactFieldOperation; |
|
475 iAddCntContactFieldOperation = NULL; |
|
476 } |
|
477 } |
|
478 |
|
479 void CVPbkVCardImporter::FieldsCopiedToContact( |
|
480 MVPbkContactOperationBase& aOperation) |
|
481 { |
|
482 if (&aOperation == iAddFieldOperation) |
|
483 { |
|
484 delete iAddFieldOperation; |
|
485 iAddFieldOperation = NULL; |
|
486 |
|
487 TRAPD( res, ContinueCopyingToNewContactL() ); |
|
488 HandleError( res ); |
|
489 } |
|
490 if (&aOperation == iAddCntContactFieldOperation) |
|
491 { |
|
492 delete iAddCntContactFieldOperation; |
|
493 iAddCntContactFieldOperation = NULL; |
|
494 } |
|
495 } |
|
496 |
|
497 void CVPbkVCardImporter::FieldsCopyFailed( |
|
498 MVPbkContactOperationBase& aOperation, |
|
499 TInt aError) |
|
500 { |
|
501 if (&aOperation == iAddFieldOperation) |
|
502 { |
|
503 delete iAddFieldOperation; |
|
504 iAddFieldOperation = NULL; |
|
505 |
|
506 HandleError( aError ); |
|
507 } |
|
508 if (&aOperation == iAddCntContactFieldOperation) |
|
509 { |
|
510 delete iAddCntContactFieldOperation; |
|
511 iAddCntContactFieldOperation = NULL; |
|
512 } |
|
513 } |
|
514 |
|
515 void CVPbkVCardImporter::SaveContactL() |
|
516 { |
|
517 if( iCntContact && iImportedContacts.Count() == 0 ) |
|
518 { |
|
519 iAddCntContactFieldOperation = iCopyPolicy->CopyTitleFieldsL( |
|
520 *iCntContact, |
|
521 *iCurContact, |
|
522 *this ); |
|
523 } |
|
524 |
|
525 // We have looped through property array with all match priorities |
|
526 // ==> all fields have been added |
|
527 iImportedContacts.AppendL( iCurContact ); |
|
528 iCurContact = NULL; |
|
529 |
|
530 // Remove empty fields and empty contacts |
|
531 RemoveEmptyFieldsAndContacts(); |
|
532 iObserver->ContactsImported(); |
|
533 } |
|
534 |
|
535 void CVPbkVCardImporter::ContinueCopyingToNewContactL() |
|
536 { |
|
537 // Save same field again to the new contact |
|
538 CVPbkVCardContactFieldData* data = iContactFieldIterator->CurrentLC(); |
|
539 TBool saved = SaveDataL( *data ); |
|
540 CleanupStack::PopAndDestroy( data ); |
|
541 if ( !saved ) |
|
542 { |
|
543 // If data was not saved try to move next field. |
|
544 StartAsync( ESaveField ); |
|
545 } |
|
546 } |
|
547 |
|
548 void CVPbkVCardImporter::RemoveEmptyFieldsAndContacts() |
|
549 { |
|
550 TInt importedContactsCount = iImportedContacts.Count(); |
|
551 for ( TInt i = importedContactsCount - 1; i >= 0; --i ) |
|
552 { |
|
553 MVPbkStoreContactFieldCollection& fields = |
|
554 iImportedContacts[i]->Fields(); |
|
555 TInt fieldCount = fields.FieldCount(); |
|
556 while ( fieldCount-- > 0 ) |
|
557 { |
|
558 MVPbkStoreContactField& field = fields.FieldAt( fieldCount ); |
|
559 if ( field.FieldData().IsEmpty() ) |
|
560 { |
|
561 iImportedContacts[i]->RemoveField( fieldCount ); |
|
562 } |
|
563 } |
|
564 |
|
565 if ( fields.FieldCount() == 0 ) |
|
566 { |
|
567 delete iImportedContacts[i]; |
|
568 iImportedContacts.Remove( i ); |
|
569 } |
|
570 } |
|
571 } |
|
572 |
|
573 void CVPbkVCardImporter::CopyContactTitlesL() |
|
574 { |
|
575 // If vcard was splitted to multiple contacts then copy |
|
576 // title fields from the first imported contact to the other contacts. |
|
577 iAddFieldOperation = iCopyPolicy->CopyTitleFieldsL( |
|
578 *iImportedContacts[0], |
|
579 *iCurContact, |
|
580 *this ); |
|
581 } |
|
582 |
|
583 void CVPbkVCardImporter::HandleFailedFieldAdditionL( TInt aError ) |
|
584 { |
|
585 if ( aError == KErrNotSupported ) |
|
586 { |
|
587 // Target contact didn't support field or didn't have field type |
|
588 // conversion for the field. Continue with next field. |
|
589 StartAsync( ESaveField ); |
|
590 } |
|
591 else if ( aError == KErrOverflow ) |
|
592 { |
|
593 if( iCntContact && iImportedContacts.Count() == 0 ) |
|
594 { |
|
595 iAddCntContactFieldOperation = iCopyPolicy->CopyTitleFieldsL( |
|
596 *iCntContact, |
|
597 *iCurContact, |
|
598 *this ); |
|
599 } |
|
600 |
|
601 // Target contact is full of that field -> Create a new contact |
|
602 // and import field to that one. |
|
603 iImportedContacts.AppendL( iCurContact ); |
|
604 iCurContact = NULL; |
|
605 iCurContact = iTargetStore.CreateNewContactLC(); |
|
606 CleanupStack::Pop(); |
|
607 // Copy title fields to new contact first |
|
608 CopyContactTitlesL(); |
|
609 } |
|
610 else |
|
611 { |
|
612 // Some other error -> importing failed |
|
613 iObserver->ContactImportingFailed( aError ); |
|
614 } |
|
615 } |
|
616 |
|
617 void CVPbkVCardImporter::HandleError( TInt aError ) |
|
618 { |
|
619 if ( aError != KErrNone ) |
|
620 { |
|
621 iObserver->ContactImportingFailed( aError ); |
|
622 } |
|
623 } |
|
624 |
|
625 void CVPbkVCardImporter::StartAsync( TState aNextState ) |
|
626 { |
|
627 iState = aNextState; |
|
628 TRequestStatus* status = &iStatus; |
|
629 User::RequestComplete( status, KErrNone ); |
|
630 SetActive(); |
|
631 } |
|
632 TBool CVPbkVCardImporter::IsOwncard() |
|
633 { |
|
634 return iOwnCard; |
|
635 } |
|
636 |
|
637 // ---------------------------------------------------------------------------- |
|
638 // CVPbkVCardImporter::IsGroupcard |
|
639 // ---------------------------------------------------------------------------- |
|
640 TBool CVPbkVCardImporter::IsGroupcard() |
|
641 { |
|
642 return iGroupCard; |
|
643 } |
|
644 // ---------------------------------------------------------------------------- |
|
645 // CVPbkVCardImporter::GetGroupcardvalue |
|
646 // ---------------------------------------------------------------------------- |
|
647 |
|
648 TPtr CVPbkVCardImporter::GetGroupcardvalue() |
|
649 { |
|
650 return ( iGroupCardValue->Des()); |
|
651 } |
|
652 |
|
653 void CVPbkVCardImporter::StoreReady(MVPbkContactStore& aContactStore) |
|
654 { |
|
655 if (iCntContact) |
|
656 { |
|
657 delete iCntContact; |
|
658 iCntContact = NULL; |
|
659 } |
|
660 |
|
661 iCntContact = aContactStore.CreateNewContactLC(); |
|
662 CleanupStack::Pop(); // iCntContact |
|
663 |
|
664 ParseNextL(); |
|
665 } |
|
666 |
|
667 void CVPbkVCardImporter::StoreUnavailable( |
|
668 MVPbkContactStore& /*aContactStore*/, |
|
669 TInt /*aReason*/) |
|
670 { |
|
671 } |
|
672 |
|
673 void CVPbkVCardImporter::HandleStoreEventL( |
|
674 MVPbkContactStore& /*aContactStore*/, |
|
675 TVPbkContactStoreEvent /*aStoreEvent*/) |
|
676 { |
|
677 } |
|
678 |
|
679 // End of file |