|
1 /* |
|
2 * Copyright (c) 2007-2008 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: MRUI attachmen definition |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "emailtrace.h" |
|
20 #include "cesmrattachment.h" |
|
21 |
|
22 // unnamed namespace for local definitions |
|
23 namespace { |
|
24 |
|
25 // Unnamed attachment |
|
26 _LIT( KESMRUnnamedAttachment, "" ); |
|
27 |
|
28 // Zero length attachment |
|
29 const TInt KZeroLengthAttachment( 0 ); |
|
30 |
|
31 } |
|
32 |
|
33 // ======== MEMBER FUNCTIONS ======== |
|
34 |
|
35 // --------------------------------------------------------------------------- |
|
36 // CESMRAttachment::CESMRAttachment |
|
37 // --------------------------------------------------------------------------- |
|
38 // |
|
39 CESMRAttachment::CESMRAttachment( |
|
40 TInt aSizeInBytes, |
|
41 TESMRAttachmentState aAttachmentState ) |
|
42 : iSizeInBytes( aSizeInBytes ), |
|
43 iState( aAttachmentState ) |
|
44 { |
|
45 FUNC_LOG; |
|
46 // No implementation |
|
47 } |
|
48 |
|
49 // --------------------------------------------------------------------------- |
|
50 // CESMRAttachment::~CESMRAttachment |
|
51 // --------------------------------------------------------------------------- |
|
52 // |
|
53 EXPORT_C CESMRAttachment::~CESMRAttachment() |
|
54 { |
|
55 FUNC_LOG; |
|
56 delete iAttachmentName; |
|
57 } |
|
58 |
|
59 // --------------------------------------------------------------------------- |
|
60 // CESMRAttachment::NewL |
|
61 // --------------------------------------------------------------------------- |
|
62 // |
|
63 EXPORT_C CESMRAttachment* CESMRAttachment::NewL() |
|
64 { |
|
65 FUNC_LOG; |
|
66 CESMRAttachment* self = NewL( |
|
67 KESMRUnnamedAttachment, |
|
68 KZeroLengthAttachment, |
|
69 EAttachmentStateUnknown ); |
|
70 return self; |
|
71 } |
|
72 |
|
73 // --------------------------------------------------------------------------- |
|
74 // CESMRAttachment::NewL |
|
75 // --------------------------------------------------------------------------- |
|
76 // |
|
77 EXPORT_C CESMRAttachment* CESMRAttachment::NewL( |
|
78 const TDesC& aAttachmentName, |
|
79 TInt aSizeInBytes, |
|
80 TESMRAttachmentState aAttachmentState ) |
|
81 { |
|
82 FUNC_LOG; |
|
83 CESMRAttachment* self = |
|
84 new (ELeave) CESMRAttachment( aSizeInBytes, aAttachmentState ); |
|
85 CleanupStack::PushL( self ); |
|
86 self->ConstructL( aAttachmentName ); |
|
87 CleanupStack::Pop( self ); |
|
88 return self; |
|
89 } |
|
90 |
|
91 // --------------------------------------------------------------------------- |
|
92 // CESMRAttachment::ConstructL |
|
93 // --------------------------------------------------------------------------- |
|
94 // |
|
95 void CESMRAttachment::ConstructL( |
|
96 const TDesC& aAttachmentName ) |
|
97 { |
|
98 FUNC_LOG; |
|
99 iAttachmentName = aAttachmentName.AllocL(); |
|
100 } |
|
101 |
|
102 // --------------------------------------------------------------------------- |
|
103 // CESMRAttachment::SetAttachmentNameL |
|
104 // --------------------------------------------------------------------------- |
|
105 // |
|
106 EXPORT_C void CESMRAttachment::SetAttachmentNameL( |
|
107 const TDes& aAttachmentName ) |
|
108 { |
|
109 FUNC_LOG; |
|
110 delete iAttachmentName; |
|
111 iAttachmentName = NULL; |
|
112 iAttachmentName = aAttachmentName.AllocL(); |
|
113 } |
|
114 |
|
115 // --------------------------------------------------------------------------- |
|
116 // CESMRAttachment::AttachmentName |
|
117 // --------------------------------------------------------------------------- |
|
118 // |
|
119 EXPORT_C const TDesC& CESMRAttachment::AttachmentName() const |
|
120 { |
|
121 FUNC_LOG; |
|
122 return *iAttachmentName; |
|
123 } |
|
124 |
|
125 // --------------------------------------------------------------------------- |
|
126 // CESMRAttachment::SetAttachmentSize |
|
127 // --------------------------------------------------------------------------- |
|
128 // |
|
129 EXPORT_C void CESMRAttachment::SetAttachmentSize( |
|
130 TInt aAttachmentSizeInBytes ) |
|
131 { |
|
132 FUNC_LOG; |
|
133 iSizeInBytes = aAttachmentSizeInBytes; |
|
134 } |
|
135 |
|
136 // --------------------------------------------------------------------------- |
|
137 // CESMRAttachment::AttachmentSizeInBytes |
|
138 // --------------------------------------------------------------------------- |
|
139 // |
|
140 EXPORT_C TInt CESMRAttachment::AttachmentSizeInBytes() const |
|
141 { |
|
142 FUNC_LOG; |
|
143 return iSizeInBytes; |
|
144 } |
|
145 |
|
146 // --------------------------------------------------------------------------- |
|
147 // CESMRAttachment::SetAttachmentState |
|
148 // --------------------------------------------------------------------------- |
|
149 // |
|
150 EXPORT_C void CESMRAttachment::SetAttachmentState( |
|
151 TESMRAttachmentState aAttachmentState ) |
|
152 { |
|
153 FUNC_LOG; |
|
154 iState = aAttachmentState; |
|
155 } |
|
156 |
|
157 // --------------------------------------------------------------------------- |
|
158 // CESMRAttachment::AttachmenState |
|
159 // --------------------------------------------------------------------------- |
|
160 // |
|
161 EXPORT_C CESMRAttachment::TESMRAttachmentState |
|
162 CESMRAttachment::AttachmenState() const |
|
163 { |
|
164 FUNC_LOG; |
|
165 return iState; |
|
166 } |
|
167 |
|
168 // EOF |
|
169 |