|
1 /* |
|
2 * Copyright (c) 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: Definition of Email attachment. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef EMAILATTACHMENT_H |
|
20 #define EMAILATTACHMENT_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32std.h> |
|
24 #include <e32base.h> |
|
25 |
|
26 #include "CFSMailClient.h" |
|
27 #include <memailcontent.h> |
|
28 #include "emailapiutils.h" |
|
29 |
|
30 using namespace EmailInterface; |
|
31 |
|
32 class CEmailMessageContent; |
|
33 // CLASS DECLARATION |
|
34 |
|
35 /** |
|
36 * CEmailAttachment |
|
37 * |
|
38 */ |
|
39 |
|
40 NONSHARABLE_CLASS(CEmailAttachment) : public CBase, public MEmailAttachment |
|
41 { |
|
42 public: |
|
43 // Constructors and destructor |
|
44 |
|
45 /** |
|
46 * Destructor. |
|
47 */ |
|
48 ~CEmailAttachment(); |
|
49 |
|
50 /** |
|
51 * Two-phased constructor. |
|
52 */ |
|
53 static CEmailAttachment* NewL( |
|
54 CPluginData& aPluginData, |
|
55 const TMessageContentId& aMsgContentId, |
|
56 CFSMailMessagePart *aAtt, |
|
57 const TDataOwner aOwner ); |
|
58 |
|
59 /** |
|
60 * Two-phased constructor. |
|
61 */ |
|
62 static CEmailAttachment* NewLC( |
|
63 CPluginData& aPluginData, |
|
64 const TMessageContentId& aMsgContentId, |
|
65 CFSMailMessagePart *aAtt, |
|
66 const TDataOwner aOwner ); |
|
67 |
|
68 public: // from MEmailInterface |
|
69 virtual TEmailTypeId InterfaceId() const; |
|
70 |
|
71 virtual void Release(); |
|
72 |
|
73 public: // from MEmailAttachment |
|
74 /** |
|
75 * Returns file handle of this attachment. If the attachment is |
|
76 * not associated with a file, null file handle is returned. |
|
77 */ |
|
78 virtual RFile FileL() const; |
|
79 |
|
80 /** |
|
81 * Sets file name field |
|
82 */ |
|
83 virtual void SetFileNameL( const TDesC& aFileName ); |
|
84 |
|
85 /** |
|
86 * Returns file name or null pointer descriptor if attachment |
|
87 * is not associated with any file |
|
88 */ |
|
89 virtual TPtrC FileNameL() const; |
|
90 |
|
91 |
|
92 public: // from MEmailMessageContent |
|
93 |
|
94 virtual TMessageContentId Id() const; |
|
95 |
|
96 virtual TPtrC ContentType() const; |
|
97 |
|
98 virtual void SetContentType( const TDesC& aContentType ); |
|
99 |
|
100 virtual TPtrC ContentId() const; |
|
101 |
|
102 virtual void SetContentId( const TDesC& aContentId ); |
|
103 |
|
104 virtual TPtrC ContentDescription() const; |
|
105 |
|
106 virtual void SetContentDescription( const TDesC& aContentDescription ); |
|
107 |
|
108 virtual TPtrC ContentDisposition() const; |
|
109 |
|
110 virtual void SetContentDisposition( const TDesC& aContentDisposition ); |
|
111 |
|
112 virtual TPtrC ContentClass() const; |
|
113 |
|
114 virtual void SetContentClass( const TDesC& aContentClass ); |
|
115 |
|
116 virtual TInt AvailableSize() const; |
|
117 |
|
118 virtual TInt TotalSize() const; |
|
119 |
|
120 virtual TPtrC ContentL() const; |
|
121 |
|
122 virtual void SetContentL( const TDesC& aContent ); |
|
123 |
|
124 virtual void FetchL( MEmailFetchObserver& aObserver ); |
|
125 |
|
126 virtual void CancelFetch(); |
|
127 |
|
128 virtual void SaveToFileL( const TDesC& aPath ); |
|
129 |
|
130 virtual MEmailMultipart* AsMultipartOrNull() const; |
|
131 |
|
132 virtual MEmailTextContent* AsTextContentOrNull() const; |
|
133 |
|
134 virtual MEmailAttachment* AsAttachmentOrNull() const; |
|
135 |
|
136 private: |
|
137 |
|
138 /** |
|
139 * Constructor for performing 1st stage construction |
|
140 */ |
|
141 CEmailAttachment( const TDataOwner aOwner ); |
|
142 |
|
143 /** |
|
144 * EPOC default constructor for performing 2nd stage construction |
|
145 */ |
|
146 void ConstructL( |
|
147 CPluginData& aPluginData, |
|
148 const TMessageContentId& aMsgContentId ); |
|
149 |
|
150 void ConstructL( |
|
151 CPluginData& aPluginData, |
|
152 const TMessageContentId& aMsgContentId, |
|
153 CFSMailMessagePart *aPart); |
|
154 |
|
155 private: |
|
156 CEmailMessageContent* iEmailMsgContent; |
|
157 TDataOwner iOwner; |
|
158 }; |
|
159 |
|
160 #endif // EMAILATTACHMENT_H |