|
1 /* |
|
2 * Copyright (c) 2002 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: MsgRecipientItem implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // ========== INCLUDE FILES ================================ |
|
21 |
|
22 #include "MsgRecipientItem.h" // for CMsgRecipientItem |
|
23 #include "MsgEditorPanic.h" |
|
24 |
|
25 // ========== EXTERNAL DATA STRUCTURES ===================== |
|
26 |
|
27 // ========== EXTERNAL FUNCTION PROTOTYPES ================= |
|
28 |
|
29 // ========== CONSTANTS ==================================== |
|
30 |
|
31 const TInt KMsgRecipientListGranularity = 10; |
|
32 |
|
33 // ========== MACROS ======================================= |
|
34 |
|
35 // ========== LOCAL CONSTANTS AND MACROS =================== |
|
36 |
|
37 // ========== MODULE DATA STRUCTURES ======================= |
|
38 |
|
39 // ========== LOCAL FUNCTION PROTOTYPES ==================== |
|
40 |
|
41 // ========== LOCAL FUNCTIONS ============================== |
|
42 |
|
43 // ========== MEMBER FUNCTIONS ============================= |
|
44 |
|
45 // --------------------------------------------------------- |
|
46 // CMsgRecipientItem::NewLC |
|
47 // |
|
48 // |
|
49 // --------------------------------------------------------- |
|
50 // |
|
51 EXPORT_C CMsgRecipientItem* CMsgRecipientItem::NewLC( |
|
52 const TDesC& aName, const TDesC& aAddress ) |
|
53 { |
|
54 CMsgRecipientItem* self = NewL( aName, aAddress ); |
|
55 CleanupStack::PushL( self ); |
|
56 return self; |
|
57 } |
|
58 |
|
59 // --------------------------------------------------------- |
|
60 // CMsgRecipientItem::NewL |
|
61 // |
|
62 // |
|
63 // --------------------------------------------------------- |
|
64 // |
|
65 EXPORT_C CMsgRecipientItem* CMsgRecipientItem::NewL( |
|
66 const TDesC& aName, const TDesC& aAddress ) |
|
67 { |
|
68 CMsgRecipientItem* self = new ( ELeave ) CMsgRecipientItem; |
|
69 |
|
70 self->SetNameL( aName ); |
|
71 self->SetAddressL( aAddress ); |
|
72 |
|
73 return self; |
|
74 } |
|
75 |
|
76 // --------------------------------------------------------- |
|
77 // CMsgRecipientItem::CMsgRecipientItem |
|
78 // |
|
79 // |
|
80 // --------------------------------------------------------- |
|
81 // |
|
82 CMsgRecipientItem::CMsgRecipientItem() : |
|
83 iContactLink( NULL ) |
|
84 { |
|
85 } |
|
86 |
|
87 // --------------------------------------------------------- |
|
88 // CMsgRecipientItem::~CMsgRecipientItem |
|
89 // |
|
90 // |
|
91 // --------------------------------------------------------- |
|
92 // |
|
93 CMsgRecipientItem::~CMsgRecipientItem() |
|
94 { |
|
95 delete iAddress; |
|
96 delete iName; |
|
97 } |
|
98 |
|
99 // --------------------------------------------------------- |
|
100 // CMsgRecipientItem::SetNameL |
|
101 // |
|
102 // |
|
103 // --------------------------------------------------------- |
|
104 // |
|
105 EXPORT_C void CMsgRecipientItem::SetNameL( const TDesC& aName ) |
|
106 { |
|
107 HBufC *name = aName.AllocL(); |
|
108 delete iName; |
|
109 iName = name; |
|
110 } |
|
111 |
|
112 // --------------------------------------------------------- |
|
113 // CMsgRecipientItem::Name |
|
114 // |
|
115 // |
|
116 // --------------------------------------------------------- |
|
117 // |
|
118 EXPORT_C HBufC* CMsgRecipientItem::Name() |
|
119 { |
|
120 return iName; |
|
121 } |
|
122 |
|
123 // --------------------------------------------------------- |
|
124 // CMsgRecipientItem::SetAddressL |
|
125 // |
|
126 // |
|
127 // --------------------------------------------------------- |
|
128 // |
|
129 EXPORT_C void CMsgRecipientItem::SetAddressL( const TDesC& aAddress ) |
|
130 { |
|
131 HBufC *address = aAddress.AllocL(); |
|
132 delete iAddress; |
|
133 iAddress = address; |
|
134 } |
|
135 |
|
136 // --------------------------------------------------------- |
|
137 // CMsgRecipientItem::Address |
|
138 // |
|
139 // |
|
140 // --------------------------------------------------------- |
|
141 // |
|
142 EXPORT_C HBufC* CMsgRecipientItem::Address() |
|
143 { |
|
144 return iAddress; |
|
145 } |
|
146 |
|
147 |
|
148 // --------------------------------------------------------- |
|
149 // CMsgRecipientItem::SetContactLink |
|
150 // |
|
151 // |
|
152 // --------------------------------------------------------- |
|
153 // |
|
154 EXPORT_C void CMsgRecipientItem::SetContactLink( |
|
155 const MVPbkContactLink* aContactLink |
|
156 ) |
|
157 { |
|
158 iContactLink = aContactLink; |
|
159 } |
|
160 |
|
161 // --------------------------------------------------------- |
|
162 // CMsgRecipientItem::ContactLink |
|
163 // |
|
164 // |
|
165 // --------------------------------------------------------- |
|
166 // |
|
167 EXPORT_C const MVPbkContactLink* CMsgRecipientItem::ContactLink() |
|
168 { |
|
169 return iContactLink; |
|
170 } |
|
171 |
|
172 |
|
173 // --------------------------------------------------------- |
|
174 // CMsgRecipientItem::SetId |
|
175 // |
|
176 // |
|
177 // --------------------------------------------------------- |
|
178 // |
|
179 EXPORT_C void CMsgRecipientItem::SetId( TContactItemId /*aId*/ ) |
|
180 { |
|
181 __ASSERT_DEBUG( EFalse, Panic( EMsgFunctionDeprecated ) ); |
|
182 } |
|
183 |
|
184 // --------------------------------------------------------- |
|
185 // CMsgRecipientItem::Id |
|
186 // |
|
187 // |
|
188 // --------------------------------------------------------- |
|
189 // |
|
190 EXPORT_C TContactItemId CMsgRecipientItem::Id() |
|
191 { |
|
192 __ASSERT_DEBUG( EFalse, Panic( EMsgFunctionDeprecated ) ); |
|
193 return TContactItemId(); |
|
194 } |
|
195 |
|
196 // --------------------------------------------------------- |
|
197 // CMsgRecipientItem::SetVerified |
|
198 // |
|
199 // |
|
200 // --------------------------------------------------------- |
|
201 // |
|
202 EXPORT_C void CMsgRecipientItem::SetVerified( TBool aVerified ) |
|
203 { |
|
204 iVerified = aVerified; |
|
205 } |
|
206 |
|
207 // --------------------------------------------------------- |
|
208 // CMsgRecipientItem::IsVerified |
|
209 // |
|
210 // |
|
211 // --------------------------------------------------------- |
|
212 // |
|
213 EXPORT_C TBool CMsgRecipientItem::IsVerified() |
|
214 { |
|
215 return iVerified; |
|
216 } |
|
217 |
|
218 // --------------------------------------------------------- |
|
219 // CMsgRecipientItem::SetValidated |
|
220 // |
|
221 // |
|
222 // --------------------------------------------------------- |
|
223 // |
|
224 EXPORT_C void CMsgRecipientItem::SetValidated( TBool aValidated ) |
|
225 { |
|
226 iValidated = aValidated; |
|
227 } |
|
228 |
|
229 // --------------------------------------------------------- |
|
230 // CMsgRecipientItem::IsValidated |
|
231 // |
|
232 // |
|
233 // --------------------------------------------------------- |
|
234 // |
|
235 EXPORT_C TBool CMsgRecipientItem::IsValidated() |
|
236 { |
|
237 return iValidated; |
|
238 } |
|
239 |
|
240 // ========================================================= |
|
241 |
|
242 // --------------------------------------------------------- |
|
243 // CMsgRecipientList::NewL |
|
244 // |
|
245 // |
|
246 // --------------------------------------------------------- |
|
247 // |
|
248 EXPORT_C CMsgRecipientList* CMsgRecipientList::NewL() |
|
249 { |
|
250 CMsgRecipientList* self = new ( ELeave ) CMsgRecipientList(); |
|
251 |
|
252 CleanupStack::PushL( self ); |
|
253 self->ConstructL(); |
|
254 CleanupStack::Pop(); // self |
|
255 |
|
256 return self; |
|
257 } |
|
258 |
|
259 // --------------------------------------------------------- |
|
260 // CMsgRecipientList::~CMsgRecipientList |
|
261 // |
|
262 // |
|
263 // --------------------------------------------------------- |
|
264 // |
|
265 CMsgRecipientList::~CMsgRecipientList() |
|
266 { |
|
267 if ( iRecipientArray ) |
|
268 { |
|
269 iRecipientArray->ResetAndDestroy(); |
|
270 } |
|
271 delete iRecipientArray; |
|
272 } |
|
273 |
|
274 // --------------------------------------------------------- |
|
275 // CMsgRecipientList::AppendL |
|
276 // |
|
277 // |
|
278 // --------------------------------------------------------- |
|
279 // |
|
280 EXPORT_C void CMsgRecipientList::AppendL( CMsgRecipientItem* aItem ) |
|
281 { |
|
282 iRecipientArray->AppendL( aItem ); |
|
283 } |
|
284 |
|
285 // --------------------------------------------------------- |
|
286 // CMsgRecipientList::InsertL |
|
287 // |
|
288 // |
|
289 // --------------------------------------------------------- |
|
290 // |
|
291 EXPORT_C void CMsgRecipientList::InsertL( TInt aIndex, CMsgRecipientItem* aItem ) |
|
292 { |
|
293 iRecipientArray->InsertL( aIndex, aItem ); |
|
294 } |
|
295 |
|
296 // --------------------------------------------------------- |
|
297 // CMsgRecipientList::Count |
|
298 // |
|
299 // |
|
300 // --------------------------------------------------------- |
|
301 // |
|
302 EXPORT_C TInt CMsgRecipientList::Count() const |
|
303 { |
|
304 return iRecipientArray->Count(); |
|
305 } |
|
306 |
|
307 // --------------------------------------------------------- |
|
308 // CMsgRecipientList::At |
|
309 // |
|
310 // |
|
311 // --------------------------------------------------------- |
|
312 // |
|
313 EXPORT_C CMsgRecipientItem* CMsgRecipientList::At( TInt aIndex ) const |
|
314 { |
|
315 return iRecipientArray->At( aIndex ); |
|
316 } |
|
317 |
|
318 // --------------------------------------------------------- |
|
319 // CMsgRecipientList::operator[] |
|
320 // |
|
321 // |
|
322 // --------------------------------------------------------- |
|
323 // |
|
324 EXPORT_C CMsgRecipientItem* CMsgRecipientList::operator[]( TInt aIndex ) const |
|
325 { |
|
326 return iRecipientArray->At( aIndex ); |
|
327 } |
|
328 |
|
329 // --------------------------------------------------------- |
|
330 // CMsgRecipientList::CMsgRecipientList |
|
331 // |
|
332 // |
|
333 // --------------------------------------------------------- |
|
334 // |
|
335 CMsgRecipientList::CMsgRecipientList() |
|
336 { |
|
337 } |
|
338 |
|
339 // --------------------------------------------------------- |
|
340 // CMsgRecipientList::ConstructL |
|
341 // |
|
342 // |
|
343 // --------------------------------------------------------- |
|
344 // |
|
345 void CMsgRecipientList::ConstructL() |
|
346 { |
|
347 iRecipientArray = new ( ELeave ) CMsgRecipientArray( KMsgRecipientListGranularity ); |
|
348 } |
|
349 |
|
350 // End of File |