431 return EFalse; |
431 return EFalse; |
432 } |
432 } |
433 return ETrue; |
433 return ETrue; |
434 } |
434 } |
435 |
435 |
436 void CCreatorMailboxElement::AsyncExecuteCommandL() |
|
437 { |
|
438 const CCreatorScriptAttribute* amountAttr = FindAttributeByName(KAmount); |
|
439 const CCreatorScriptAttribute* typeAttr = FindAttributeByName(KMailboxType); |
|
440 TInt amount = 1; |
|
441 if( amountAttr ) |
|
442 { |
|
443 amount = ConvertStrToIntL(amountAttr->Value()); |
|
444 } |
|
445 |
|
446 TMailboxType mailboxType = EMailboxPOP3; |
|
447 |
|
448 if( typeAttr && CompareIgnoreCase(typeAttr->Value(), Kimap4) == 0 ) |
|
449 { |
|
450 mailboxType = EMailboxIMAP4; |
|
451 } |
|
452 |
|
453 // Get 'fields' element |
|
454 CCreatorScriptElement* fieldsElement = FindSubElement(KFields); |
|
455 if( fieldsElement && fieldsElement->SubElements().Count() > 0) |
|
456 { |
|
457 // Get sub-elements |
|
458 const RPointerArray<CCreatorScriptElement>& fields = fieldsElement->SubElements(); |
|
459 // Create mailbox entries, the amount of entries is defined by amount: |
|
460 if( iLoopIndex < amount ) |
|
461 { |
|
462 CMailboxesParameters* param = new (ELeave) CMailboxesParameters; |
|
463 CleanupStack::PushL(param); |
|
464 |
|
465 param->iMailboxType = mailboxType; |
|
466 |
|
467 for( TInt i = 0; i < fields.Count(); ++i ) |
|
468 { |
|
469 CCreatorScriptElement* field = fields[i]; |
|
470 TPtrC elemName = field->Name(); |
|
471 TPtrC elemContent = field->Content(); |
|
472 const CCreatorScriptAttribute* randomAttr = fields[i]->FindAttributeByName(KRandomLength); |
|
473 TBool useRandom = EFalse; |
|
474 if( randomAttr || elemContent.Length() == 0 ) |
|
475 { |
|
476 useRandom = ETrue; |
|
477 } |
|
478 |
|
479 if( SetTextParamL(elemName, elemContent, param, useRandom ) == EFalse && |
|
480 SetBooleanParamL(elemName, elemContent, param, useRandom ) == EFalse && |
|
481 SetIntegerParamL(elemName, elemContent, param, useRandom ) == EFalse && |
|
482 SetEnumParamL(elemName, elemContent, param, useRandom ) ) |
|
483 { |
|
484 LOGSTRING2("CCreatorMailboxElement::AsyncExecuteCommandL: Unknown mailbox field: %S", &elemName); |
|
485 } |
|
486 } |
|
487 iEngine->AppendToCommandArrayL(ECmdCreateMessagingEntryMailboxes, param); |
|
488 CleanupStack::Pop(); // param |
|
489 StartNextLoop(); |
|
490 } |
|
491 else |
|
492 { |
|
493 AsyncCommandFinished(); |
|
494 } |
|
495 } |
|
496 else |
|
497 { |
|
498 iEngine->AppendToCommandArrayL(ECmdCreateMessagingEntryMailboxes, 0, amount); |
|
499 AsyncCommandFinished(); |
|
500 } |
|
501 } |
|
502 |
|
503 |
|
504 void CCreatorMailboxElement::ExecuteCommandL() |
436 void CCreatorMailboxElement::ExecuteCommandL() |
505 { |
437 { |
506 const CCreatorScriptAttribute* amountAttr = FindAttributeByName(KAmount); |
438 const CCreatorScriptAttribute* amountAttr = FindAttributeByName(KAmount); |
507 const CCreatorScriptAttribute* typeAttr = FindAttributeByName(KMailboxType); |
439 const CCreatorScriptAttribute* typeAttr = FindAttributeByName(KMailboxType); |
508 TInt amount = 1; |
440 TInt amount = 1; |