1 /* |
1 /* |
2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
17 |
17 |
18 |
18 |
19 #include "emailtrace.h" |
19 #include "emailtrace.h" |
20 #include "cesmrmrinfoicalretriever.h" |
20 #include "cesmrmrinfoicalretriever.h" |
21 #include "cesmrinforecurrencehandler.h" |
21 #include "cesmrinforecurrencehandler.h" |
22 #include "cesmrattachmentinfo.h" |
|
23 #include "mesmricalviewerobserver.h" |
22 #include "mesmricalviewerobserver.h" |
24 #include "tesmrinputparams.h" |
23 #include "tesmrinputparams.h" |
25 #include "esmricalviewerutils.h" |
24 #include "esmricalviewerutils.h" |
26 #include "esmrconfig.hrh" |
25 #include "esmrconfig.hrh" |
27 |
26 |
325 CESMRInfoIcalRetrieverCmd::~CESMRInfoIcalRetrieverCmd() |
324 CESMRInfoIcalRetrieverCmd::~CESMRInfoIcalRetrieverCmd() |
326 { |
325 { |
327 FUNC_LOG; |
326 FUNC_LOG; |
328 iSupportedFields.Reset(); |
327 iSupportedFields.Reset(); |
329 iSupportedFields.Close(); |
328 iSupportedFields.Close(); |
330 delete iAttachmentInfo; |
|
331 delete iConvertedEntry; |
329 delete iConvertedEntry; |
332 } |
330 } |
333 |
331 |
334 // --------------------------------------------------------------------------- |
332 // --------------------------------------------------------------------------- |
335 // CESMRInfoIcalRetriever::NewL |
333 // CESMRInfoIcalRetriever::NewL |
584 TInt err = start.MinutesFrom(alarmTime, minutesBetween); |
580 TInt err = start.MinutesFrom(alarmTime, minutesBetween); |
585 |
581 |
586 if ( KErrNone == err && minutesBetween.Int() > 0 ) |
582 if ( KErrNone == err && minutesBetween.Int() > 0 ) |
587 { |
583 { |
588 alarm->SetTimeOffset( minutesBetween ); |
584 alarm->SetTimeOffset( minutesBetween ); |
589 // this method copies alarm details and does not take ownership |
585 // this method copies alarm details and does not take ownership |
590 iConvertedEntry->SetAlarmL( alarm ); |
586 iConvertedEntry->SetAlarmL( alarm ); |
591 } |
587 } |
592 // that's why we can destroy it here |
588 // that's why we can destroy it here |
593 CleanupStack::PopAndDestroy( alarm ); |
589 CleanupStack::PopAndDestroy( alarm ); |
594 } |
590 } |
631 |
627 |
632 CleanupStack::PopAndDestroy( recurrenceHandler ); |
628 CleanupStack::PopAndDestroy( recurrenceHandler ); |
633 } |
629 } |
634 } |
630 } |
635 |
631 |
636 // --------------------------------------------------------------------------- |
|
637 // CESMRInfoIcalRetrieverCmd::FillAttachmentInfoL |
|
638 // --------------------------------------------------------------------------- |
|
639 // |
|
640 void CESMRInfoIcalRetrieverCmd::FillAttachmentInfoL() |
|
641 { |
|
642 FUNC_LOG; |
|
643 CFSMailMessage* msg = Message(); |
|
644 |
|
645 if ( msg->IsFlagSet( EFSMsgFlag_Attachments ) ) |
|
646 { |
|
647 RPointerArray<CFSMailMessagePart> attachmentParts; |
|
648 CleanupStack::PushL( |
|
649 TCleanupItem( |
|
650 ESMRIcalViewerUtils::MessagePartPointerArrayCleanup, |
|
651 &attachmentParts ) ); |
|
652 |
|
653 msg->AttachmentListL( attachmentParts ); |
|
654 |
|
655 TInt attachmentCount( attachmentParts.Count() ); |
|
656 if ( attachmentCount > 0 ) |
|
657 { |
|
658 delete iAttachmentInfo; |
|
659 iAttachmentInfo = NULL; |
|
660 |
|
661 iInputParameters.iAttachmentInfo = NULL; |
|
662 |
|
663 CESMRAttachmentInfo* attachmentInfo = CESMRAttachmentInfo::NewL(); |
|
664 CleanupStack::PushL( attachmentInfo ); |
|
665 |
|
666 for( TInt i(0); i < attachmentCount; ++i ) |
|
667 { |
|
668 CESMRAttachment::TESMRAttachmentState state( |
|
669 CESMRAttachment::EAttachmentStateDownloaded ); |
|
670 |
|
671 if ( EFSFull != attachmentParts[i]->FetchLoadState() ) |
|
672 { |
|
673 state = CESMRAttachment::EAttachmentStateNotDownloaded; |
|
674 } |
|
675 |
|
676 TInt contentSize( attachmentParts[i]->ContentSize() ); |
|
677 TPtrC attachmentName( attachmentParts[i]->AttachmentNameL() ); |
|
678 if ( contentSize >= 0 && attachmentName.Length() ) |
|
679 { |
|
680 attachmentInfo->AddAttachmentInfoL( |
|
681 attachmentName, |
|
682 contentSize, |
|
683 state ); |
|
684 } |
|
685 } |
|
686 |
|
687 if ( attachmentInfo->AttachmentCount() ) |
|
688 { |
|
689 iAttachmentInfo = attachmentInfo; |
|
690 CleanupStack::Pop( attachmentInfo ); |
|
691 // ownership does not change |
|
692 iInputParameters.iAttachmentInfo = iAttachmentInfo; |
|
693 } |
|
694 else |
|
695 { |
|
696 CleanupStack::PopAndDestroy( attachmentInfo ); |
|
697 } |
|
698 |
|
699 attachmentInfo = NULL; |
|
700 } |
|
701 CleanupStack::PopAndDestroy(); // attachmentparts |
|
702 } |
|
703 } |
|
704 |
|
705 // EOF |
632 // EOF |
706 |
633 |