|
1 /* |
|
2 * Copyright (c) 2007-2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CMRCMAILREMOTEATTACHMENTDOWNLOADER_H |
|
19 #define CMRCMAILREMOTEATTACHMENTDOWNLOADER_H |
|
20 |
|
21 #include <e32base.h> |
|
22 #include <bamdesca.h> |
|
23 #include <f32file.h> |
|
24 |
|
25 #include "mcalremoteattachmentoperation.h" |
|
26 #include "mfsmailrequestobserver.h" |
|
27 #include "tmrcmailremoteattachmentpluginurlparser.h" |
|
28 |
|
29 class CFSMailMessage; |
|
30 class CFSMailClient; |
|
31 class CCalRemoteAttachment; |
|
32 class MCalRemoteAttachmentOperationObserver; |
|
33 |
|
34 /** |
|
35 * CMRCmailRemoteAttachmentDownloader is responsible for |
|
36 * downloading remote attachment. |
|
37 */ |
|
38 NONSHARABLE_CLASS( CMRCmailRemoteAttachmentDownloader ) : |
|
39 public CActive, |
|
40 public MCalRemoteAttachmentOperation, |
|
41 public MFSMailRequestObserver |
|
42 { |
|
43 public: // Construction and destruction |
|
44 /** |
|
45 * Creates and initializes new CMRCmailRemoteAttachmentDownloader |
|
46 * object. Ownership is transferred to caller. |
|
47 * |
|
48 * @param aMailClient Reference to mail client |
|
49 * @param aObserver Reference to command observer |
|
50 * @param aUri Attachment URI |
|
51 */ |
|
52 static CMRCmailRemoteAttachmentDownloader* NewL( |
|
53 CFSMailClient& aMailClient, |
|
54 MCalRemoteAttachmentOperationObserver& aObserver, |
|
55 const TDesC& aUri ); |
|
56 |
|
57 /** |
|
58 * C++ destructor |
|
59 */ |
|
60 ~CMRCmailRemoteAttachmentDownloader(); |
|
61 |
|
62 public: // From CActive |
|
63 void DoCancel(); |
|
64 void RunL(); |
|
65 TInt RunError( TInt aError ); |
|
66 |
|
67 public: // From MCalRemoteAttachmentOperation |
|
68 TInt Progress() const; |
|
69 const MCalRemoteAttachment& AttachmentInformation() const; |
|
70 |
|
71 private: // From MFSMailRequestObserver |
|
72 void RequestResponseL( TFSProgress aEvent, TInt aRequestId ); |
|
73 |
|
74 private: // Implementation |
|
75 CMRCmailRemoteAttachmentDownloader( |
|
76 CFSMailClient& aMailClient, |
|
77 MCalRemoteAttachmentOperationObserver& aObserver ); |
|
78 void ConstructL( |
|
79 const TDesC& aUri ); |
|
80 void IssueRequest(); |
|
81 void NotifyCompletionL( CFSMailMessagePart& aAttachment ); |
|
82 void NotifyError( TInt aError ); |
|
83 TInt ProgressL() const; |
|
84 void DoCancelL(); |
|
85 |
|
86 private: // Data |
|
87 /// Ref: Reference to mail client |
|
88 CFSMailClient& iMailClient; |
|
89 /// Ref: Command observer |
|
90 MCalRemoteAttachmentOperationObserver& iObserver; |
|
91 /// Own: Remote attachment information |
|
92 CCalRemoteAttachment* iRemoteAttachment; |
|
93 /// Own: Attachment URI |
|
94 HBufC* iUri; |
|
95 /// Own: Mail message |
|
96 CFSMailMessage* iMailMessage; |
|
97 /// Own: Mail operation ID |
|
98 TInt iFSMailOperationId; |
|
99 /// Own: Mail ID parser |
|
100 TMRCMailRemoteAttachmentPluginURLParser iMailIdParser; |
|
101 /// Own: Attachment file |
|
102 RFile iAttachmentFile; |
|
103 }; |
|
104 |
|
105 #endif // CMRCMAILREMOTEATTACHMENTDOWNLOADER_H |
|
106 |
|
107 // EOF |