|
1 /* |
|
2 * Copyright (c) 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: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <s32mem.h> |
|
19 #include "cainnerentry.h" |
|
20 |
|
21 // ======== MEMBER FUNCTIONS ======== |
|
22 |
|
23 // --------------------------------------------------------------------------- |
|
24 // |
|
25 // --------------------------------------------------------------------------- |
|
26 // |
|
27 CCaInnerEntry::~CCaInnerEntry() |
|
28 { |
|
29 iText.Close(); |
|
30 iDescription.Close(); |
|
31 iEntryTypeName.Close(); |
|
32 iAttributes.ResetAndDestroy(); |
|
33 } |
|
34 |
|
35 // --------------------------------------------------------------------------- |
|
36 // |
|
37 // --------------------------------------------------------------------------- |
|
38 // |
|
39 EXPORT_C CCaInnerEntry* CCaInnerEntry::NewL() |
|
40 { |
|
41 CCaInnerEntry* entry = CCaInnerEntry::NewLC(); |
|
42 CleanupStack::Pop( entry ); |
|
43 return entry; |
|
44 } |
|
45 |
|
46 // --------------------------------------------------------------------------- |
|
47 // |
|
48 // --------------------------------------------------------------------------- |
|
49 // |
|
50 EXPORT_C CCaInnerEntry* CCaInnerEntry::NewLC() |
|
51 { |
|
52 CCaInnerEntry* self = new ( ELeave ) CCaInnerEntry(); |
|
53 CleanupStack::PushL( self ); |
|
54 self->ConstructL(); |
|
55 return self; |
|
56 } |
|
57 |
|
58 // --------------------------------------------------------------------------- |
|
59 // |
|
60 // --------------------------------------------------------------------------- |
|
61 // |
|
62 EXPORT_C void CCaInnerEntry::ExternalizeL( RWriteStream& aStream ) const |
|
63 { |
|
64 aStream.WriteInt32L( iId ); |
|
65 aStream.WriteInt32L( iUid ); |
|
66 aStream.WriteInt32L( iIcon.iId ); |
|
67 aStream.WriteInt32L( iIcon.iBitmapId ); |
|
68 aStream.WriteInt32L( iIcon.iMaskId ); |
|
69 aStream.WriteInt32L( iIcon.iSkinMajorId ); |
|
70 aStream.WriteInt32L( iIcon.iSkinMinorId ); |
|
71 aStream.WriteUint32L( iIcon.iFileName.Length() ); |
|
72 aStream.WriteL( iIcon.iFileName, iIcon.iFileName.Length() ); |
|
73 aStream.WriteUint32L( iFlags ); |
|
74 aStream.WriteUint32L( iRole ); |
|
75 aStream.WriteUint32L( iText.Length() ); |
|
76 aStream.WriteL( iText, iText.Length() ); |
|
77 aStream.WriteUint32L( iDescription.Length() ); |
|
78 aStream.WriteL( iDescription, iDescription.Length() ); |
|
79 aStream.WriteUint32L( iEntryTypeName.Length() ); |
|
80 aStream.WriteL( iEntryTypeName, iEntryTypeName.Length() ); |
|
81 iAttributes.ExternalizeL( aStream ); |
|
82 aStream.CommitL(); |
|
83 } |
|
84 |
|
85 // --------------------------------------------------------------------------- |
|
86 // |
|
87 // --------------------------------------------------------------------------- |
|
88 // |
|
89 EXPORT_C void CCaInnerEntry::InternalizeL( RReadStream& aStream ) |
|
90 { |
|
91 iId = aStream.ReadInt32L(); |
|
92 iUid = aStream.ReadInt32L(); |
|
93 iIcon.iId = aStream.ReadInt32L(); |
|
94 iIcon.iBitmapId = aStream.ReadInt32L(); |
|
95 iIcon.iMaskId = aStream.ReadInt32L(); |
|
96 iIcon.iSkinMajorId = aStream.ReadInt32L(); |
|
97 iIcon.iSkinMinorId = aStream.ReadInt32L(); |
|
98 TUint length = aStream.ReadUint32L(); |
|
99 aStream.ReadL( iIcon.iFileName, length ); |
|
100 iFlags = aStream.ReadUint32L(); |
|
101 iRole = aStream.ReadUint32L(); |
|
102 length = aStream.ReadUint32L(); |
|
103 iText.Close(); |
|
104 iText.CreateL( length ); |
|
105 aStream.ReadL( iText, length ); |
|
106 length = aStream.ReadUint32L(); |
|
107 iDescription.Close( ); |
|
108 iDescription.CreateL( length ); |
|
109 aStream.ReadL( iDescription, length); |
|
110 length = aStream.ReadUint32L( ); |
|
111 iEntryTypeName.Close(); |
|
112 iEntryTypeName.CreateL( length ); |
|
113 aStream.ReadL( iEntryTypeName, length ); |
|
114 iAttributes.InternalizeL( aStream ); |
|
115 } |
|
116 |
|
117 // --------------------------------------------------------------------------- |
|
118 // |
|
119 // --------------------------------------------------------------------------- |
|
120 // |
|
121 void CCaInnerEntry::ConstructL() |
|
122 { |
|
123 |
|
124 } |
|
125 |
|
126 // --------------------------------------------------------------------------- |
|
127 // |
|
128 // --------------------------------------------------------------------------- |
|
129 // |
|
130 CCaInnerEntry::CCaInnerEntry() |
|
131 { |
|
132 |
|
133 } |
|
134 |
|
135 // --------------------------------------------------------------------------- |
|
136 // |
|
137 // --------------------------------------------------------------------------- |
|
138 // |
|
139 EXPORT_C TInt CCaInnerEntry::GetId() const |
|
140 { |
|
141 return iId; |
|
142 } |
|
143 |
|
144 // --------------------------------------------------------------------------- |
|
145 // |
|
146 // --------------------------------------------------------------------------- |
|
147 // |
|
148 EXPORT_C const RBuf& CCaInnerEntry::GetText() const |
|
149 { |
|
150 return iText; |
|
151 } |
|
152 |
|
153 // --------------------------------------------------------------------------- |
|
154 // |
|
155 // --------------------------------------------------------------------------- |
|
156 // |
|
157 EXPORT_C const RBuf& CCaInnerEntry::GetDescription() const |
|
158 { |
|
159 return iDescription; |
|
160 } |
|
161 |
|
162 // --------------------------------------------------------------------------- |
|
163 // |
|
164 // --------------------------------------------------------------------------- |
|
165 // |
|
166 EXPORT_C const RBuf& CCaInnerEntry::GetEntryTypeName() const |
|
167 { |
|
168 return iEntryTypeName; |
|
169 } |
|
170 |
|
171 // --------------------------------------------------------------------------- |
|
172 // |
|
173 // --------------------------------------------------------------------------- |
|
174 // |
|
175 EXPORT_C const CCaInnerEntry::TIconAttributes& CCaInnerEntry::GetIcon() const |
|
176 { |
|
177 return iIcon; |
|
178 } |
|
179 |
|
180 // --------------------------------------------------------------------------- |
|
181 // |
|
182 // --------------------------------------------------------------------------- |
|
183 // |
|
184 EXPORT_C TUint CCaInnerEntry::GetFlags() const |
|
185 { |
|
186 return iFlags; |
|
187 } |
|
188 |
|
189 // --------------------------------------------------------------------------- |
|
190 // |
|
191 // --------------------------------------------------------------------------- |
|
192 // |
|
193 EXPORT_C const RCaEntryAttrArray& CCaInnerEntry::GetAttributes() const |
|
194 { |
|
195 return iAttributes; |
|
196 } |
|
197 |
|
198 // --------------------------------------------------------------------------- |
|
199 // |
|
200 // --------------------------------------------------------------------------- |
|
201 // |
|
202 EXPORT_C TUint CCaInnerEntry::GetRole() const |
|
203 { |
|
204 return iRole; |
|
205 } |
|
206 |
|
207 // --------------------------------------------------------------------------- |
|
208 // |
|
209 // --------------------------------------------------------------------------- |
|
210 // |
|
211 EXPORT_C TInt32 CCaInnerEntry::GetUid() const |
|
212 { |
|
213 return iUid; |
|
214 } |
|
215 |
|
216 // --------------------------------------------------------------------------- |
|
217 // |
|
218 // --------------------------------------------------------------------------- |
|
219 // |
|
220 EXPORT_C TInt CCaInnerEntry::GetIconId() const |
|
221 { |
|
222 return iIcon.iId; |
|
223 } |
|
224 // SETTERS |
|
225 |
|
226 // --------------------------------------------------------------------------- |
|
227 // |
|
228 // --------------------------------------------------------------------------- |
|
229 // |
|
230 EXPORT_C void CCaInnerEntry::SetId( TUint aId ) |
|
231 { |
|
232 iId = aId; |
|
233 } |
|
234 |
|
235 // --------------------------------------------------------------------------- |
|
236 // |
|
237 // --------------------------------------------------------------------------- |
|
238 // |
|
239 EXPORT_C void CCaInnerEntry::SetTextL( const TDesC& aText ) |
|
240 { |
|
241 iText.Close(); |
|
242 iText.CreateL( aText ); |
|
243 } |
|
244 |
|
245 // --------------------------------------------------------------------------- |
|
246 // |
|
247 // --------------------------------------------------------------------------- |
|
248 // |
|
249 EXPORT_C void CCaInnerEntry::SetDescriptionL( const TDesC& aText ) |
|
250 { |
|
251 iDescription.Close(); |
|
252 iDescription.CreateL( aText ); |
|
253 } |
|
254 |
|
255 // --------------------------------------------------------------------------- |
|
256 // |
|
257 // --------------------------------------------------------------------------- |
|
258 // |
|
259 EXPORT_C void CCaInnerEntry::SetEntryTypeNameL( const TDesC& aTypeName ) |
|
260 { |
|
261 iEntryTypeName.Close(); |
|
262 iEntryTypeName.CreateL( aTypeName ); |
|
263 } |
|
264 |
|
265 // --------------------------------------------------------------------------- |
|
266 // |
|
267 // --------------------------------------------------------------------------- |
|
268 // |
|
269 EXPORT_C void CCaInnerEntry::SetIconDataL( TInt aBitmapId, TInt aMaskId, |
|
270 TInt aSkinMajorId, TInt aSkinMinorId, const TDesC& aFilename ) |
|
271 { |
|
272 iIcon.iBitmapId = aBitmapId; |
|
273 iIcon.iMaskId = aMaskId; |
|
274 iIcon.iSkinMajorId = aSkinMajorId; |
|
275 iIcon.iSkinMinorId = aSkinMinorId; |
|
276 |
|
277 iIcon.iFileName.Copy( aFilename ); |
|
278 } |
|
279 |
|
280 // --------------------------------------------------------------------------- |
|
281 // |
|
282 // --------------------------------------------------------------------------- |
|
283 // |
|
284 EXPORT_C void CCaInnerEntry::AddAttributeL( const TDesC& aKey, |
|
285 const TDesC& aValue ) |
|
286 { |
|
287 // to avoid duplicated attribute |
|
288 if( iAttributes.Exist( aKey ) ) |
|
289 { |
|
290 iAttributes.RemoveAttribute( aKey ); |
|
291 } |
|
292 CCaEntryAttribute* attr = CCaEntryAttribute::NewLC( aKey ); |
|
293 attr->SetValueL( aValue ); |
|
294 iAttributes.AppendL( attr ); |
|
295 CleanupStack::Pop( attr ); |
|
296 } |
|
297 |
|
298 // --------------------------------------------------------------------------- |
|
299 // |
|
300 // --------------------------------------------------------------------------- |
|
301 // |
|
302 EXPORT_C void CCaInnerEntry::SetFlags( TUint aFlags ) |
|
303 { |
|
304 iFlags = aFlags; |
|
305 } |
|
306 |
|
307 // --------------------------------------------------------------------------- |
|
308 // |
|
309 // --------------------------------------------------------------------------- |
|
310 // |
|
311 EXPORT_C void CCaInnerEntry::SetRole( TUint aRole ) |
|
312 { |
|
313 iRole = aRole; |
|
314 } |
|
315 |
|
316 // --------------------------------------------------------------------------- |
|
317 // |
|
318 // --------------------------------------------------------------------------- |
|
319 // |
|
320 EXPORT_C void CCaInnerEntry::RemoveAttributeL( const TDesC& aKey ) |
|
321 { |
|
322 iAttributes.RemoveAttribute( aKey ); |
|
323 } |
|
324 |
|
325 // --------------------------------------------------------------------------- |
|
326 // |
|
327 // --------------------------------------------------------------------------- |
|
328 // |
|
329 EXPORT_C TBool CCaInnerEntry::FindAttribute( const TDesC& aKey, |
|
330 TDes& aAttrVal ) |
|
331 { |
|
332 return iAttributes.Find( aKey, aAttrVal ); |
|
333 } |
|
334 |
|
335 // --------------------------------------------------------------------------- |
|
336 // |
|
337 // --------------------------------------------------------------------------- |
|
338 // |
|
339 EXPORT_C void CCaInnerEntry::SetUid( TInt32 aUid ) |
|
340 { |
|
341 iUid = aUid; |
|
342 } |
|
343 |
|
344 // --------------------------------------------------------------------------- |
|
345 // |
|
346 // --------------------------------------------------------------------------- |
|
347 // |
|
348 EXPORT_C void CCaInnerEntry::SetIconId( TInt aIconId ) |
|
349 { |
|
350 iIcon.iId = aIconId; |
|
351 } |