85
|
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();
|
92
|
33 |
delete iIcon;
|
85
|
34 |
}
|
|
35 |
|
|
36 |
// ---------------------------------------------------------------------------
|
|
37 |
//
|
|
38 |
// ---------------------------------------------------------------------------
|
|
39 |
//
|
|
40 |
EXPORT_C CCaInnerEntry* CCaInnerEntry::NewL()
|
|
41 |
{
|
|
42 |
CCaInnerEntry* entry = CCaInnerEntry::NewLC();
|
|
43 |
CleanupStack::Pop( entry );
|
|
44 |
return entry;
|
|
45 |
}
|
|
46 |
|
|
47 |
// ---------------------------------------------------------------------------
|
|
48 |
//
|
|
49 |
// ---------------------------------------------------------------------------
|
|
50 |
//
|
|
51 |
EXPORT_C CCaInnerEntry* CCaInnerEntry::NewLC()
|
|
52 |
{
|
|
53 |
CCaInnerEntry* self = new ( ELeave ) CCaInnerEntry();
|
|
54 |
CleanupStack::PushL( self );
|
|
55 |
self->ConstructL();
|
|
56 |
return self;
|
|
57 |
}
|
|
58 |
|
|
59 |
// ---------------------------------------------------------------------------
|
|
60 |
//
|
|
61 |
// ---------------------------------------------------------------------------
|
|
62 |
//
|
|
63 |
EXPORT_C void CCaInnerEntry::ExternalizeL( RWriteStream& aStream ) const
|
|
64 |
{
|
|
65 |
aStream.WriteInt32L( iId );
|
|
66 |
aStream.WriteInt32L( iUid );
|
|
67 |
aStream.WriteUint32L( iFlags );
|
|
68 |
aStream.WriteUint32L( iRole );
|
|
69 |
aStream.WriteUint32L( iText.Length() );
|
|
70 |
aStream.WriteL( iText, iText.Length() );
|
|
71 |
aStream.WriteUint32L( iDescription.Length() );
|
|
72 |
aStream.WriteL( iDescription, iDescription.Length() );
|
|
73 |
aStream.WriteUint32L( iEntryTypeName.Length() );
|
|
74 |
aStream.WriteL( iEntryTypeName, iEntryTypeName.Length() );
|
98
|
75 |
aStream.WriteUint32L( iTextLocalized );
|
|
76 |
aStream.WriteUint32L( iDescriptionLocalized );
|
85
|
77 |
iAttributes.ExternalizeL( aStream );
|
92
|
78 |
iIcon->ExternalizeL( aStream );
|
127
|
79 |
aStream.WriteUint32L( iParentIds.Count() );
|
|
80 |
for( TInt i = 0; i < iParentIds.Count(); i++ )
|
|
81 |
{
|
|
82 |
aStream.WriteInt32L( iParentIds[i] );
|
|
83 |
}
|
85
|
84 |
aStream.CommitL();
|
|
85 |
}
|
|
86 |
|
|
87 |
// ---------------------------------------------------------------------------
|
|
88 |
//
|
|
89 |
// ---------------------------------------------------------------------------
|
|
90 |
//
|
|
91 |
EXPORT_C void CCaInnerEntry::InternalizeL( RReadStream& aStream )
|
|
92 |
{
|
|
93 |
iId = aStream.ReadInt32L();
|
|
94 |
iUid = aStream.ReadInt32L();
|
|
95 |
iFlags = aStream.ReadUint32L();
|
|
96 |
iRole = aStream.ReadUint32L();
|
92
|
97 |
TUint length = aStream.ReadUint32L();
|
85
|
98 |
iText.Close();
|
|
99 |
iText.CreateL( length );
|
|
100 |
aStream.ReadL( iText, length );
|
|
101 |
length = aStream.ReadUint32L();
|
|
102 |
iDescription.Close( );
|
|
103 |
iDescription.CreateL( length );
|
|
104 |
aStream.ReadL( iDescription, length);
|
|
105 |
length = aStream.ReadUint32L( );
|
|
106 |
iEntryTypeName.Close();
|
|
107 |
iEntryTypeName.CreateL( length );
|
|
108 |
aStream.ReadL( iEntryTypeName, length );
|
98
|
109 |
iTextLocalized = aStream.ReadUint32L();
|
|
110 |
iDescriptionLocalized = aStream.ReadUint32L();
|
85
|
111 |
iAttributes.InternalizeL( aStream );
|
92
|
112 |
iIcon->InternalizeL( aStream );
|
127
|
113 |
iParentIds.Close();
|
|
114 |
TInt count = aStream.ReadUint32L();
|
|
115 |
for( TInt i = 0; i < count; i++ )
|
|
116 |
{
|
|
117 |
iParentIds.AppendL( aStream.ReadInt32L() );
|
|
118 |
}
|
85
|
119 |
}
|
|
120 |
|
|
121 |
// ---------------------------------------------------------------------------
|
|
122 |
//
|
|
123 |
// ---------------------------------------------------------------------------
|
|
124 |
//
|
|
125 |
void CCaInnerEntry::ConstructL()
|
|
126 |
{
|
92
|
127 |
iIcon = CCaInnerIconDescription::NewL();
|
98
|
128 |
iTextLocalized = EFalse;
|
|
129 |
iDescriptionLocalized = EFalse;
|
85
|
130 |
}
|
|
131 |
|
|
132 |
// ---------------------------------------------------------------------------
|
|
133 |
//
|
|
134 |
// ---------------------------------------------------------------------------
|
|
135 |
//
|
|
136 |
CCaInnerEntry::CCaInnerEntry()
|
|
137 |
{
|
|
138 |
}
|
|
139 |
|
|
140 |
// ---------------------------------------------------------------------------
|
|
141 |
//
|
|
142 |
// ---------------------------------------------------------------------------
|
|
143 |
//
|
|
144 |
EXPORT_C TInt CCaInnerEntry::GetId() const
|
|
145 |
{
|
|
146 |
return iId;
|
|
147 |
}
|
|
148 |
|
|
149 |
// ---------------------------------------------------------------------------
|
|
150 |
//
|
|
151 |
// ---------------------------------------------------------------------------
|
|
152 |
//
|
|
153 |
EXPORT_C const RBuf& CCaInnerEntry::GetText() const
|
|
154 |
{
|
|
155 |
return iText;
|
|
156 |
}
|
|
157 |
|
|
158 |
// ---------------------------------------------------------------------------
|
|
159 |
//
|
|
160 |
// ---------------------------------------------------------------------------
|
|
161 |
//
|
|
162 |
EXPORT_C const RBuf& CCaInnerEntry::GetDescription() const
|
|
163 |
{
|
|
164 |
return iDescription;
|
|
165 |
}
|
|
166 |
|
|
167 |
// ---------------------------------------------------------------------------
|
|
168 |
//
|
|
169 |
// ---------------------------------------------------------------------------
|
|
170 |
//
|
|
171 |
EXPORT_C const RBuf& CCaInnerEntry::GetEntryTypeName() const
|
|
172 |
{
|
|
173 |
return iEntryTypeName;
|
|
174 |
}
|
|
175 |
|
|
176 |
// ---------------------------------------------------------------------------
|
|
177 |
//
|
|
178 |
// ---------------------------------------------------------------------------
|
|
179 |
//
|
92
|
180 |
EXPORT_C const CCaInnerIconDescription* CCaInnerEntry::Icon() const
|
85
|
181 |
{
|
|
182 |
return iIcon;
|
|
183 |
}
|
|
184 |
|
|
185 |
// ---------------------------------------------------------------------------
|
|
186 |
//
|
|
187 |
// ---------------------------------------------------------------------------
|
|
188 |
//
|
|
189 |
EXPORT_C TUint CCaInnerEntry::GetFlags() const
|
|
190 |
{
|
|
191 |
return iFlags;
|
|
192 |
}
|
|
193 |
|
|
194 |
// ---------------------------------------------------------------------------
|
|
195 |
//
|
|
196 |
// ---------------------------------------------------------------------------
|
|
197 |
//
|
|
198 |
EXPORT_C const RCaEntryAttrArray& CCaInnerEntry::GetAttributes() const
|
|
199 |
{
|
|
200 |
return iAttributes;
|
|
201 |
}
|
|
202 |
|
|
203 |
// ---------------------------------------------------------------------------
|
|
204 |
//
|
|
205 |
// ---------------------------------------------------------------------------
|
|
206 |
//
|
|
207 |
EXPORT_C TUint CCaInnerEntry::GetRole() const
|
|
208 |
{
|
|
209 |
return iRole;
|
|
210 |
}
|
|
211 |
|
|
212 |
// ---------------------------------------------------------------------------
|
|
213 |
//
|
|
214 |
// ---------------------------------------------------------------------------
|
|
215 |
//
|
|
216 |
EXPORT_C TInt32 CCaInnerEntry::GetUid() const
|
|
217 |
{
|
|
218 |
return iUid;
|
|
219 |
}
|
|
220 |
|
|
221 |
// ---------------------------------------------------------------------------
|
|
222 |
//
|
|
223 |
// ---------------------------------------------------------------------------
|
|
224 |
//
|
|
225 |
EXPORT_C TInt CCaInnerEntry::GetIconId() const
|
|
226 |
{
|
92
|
227 |
return iIcon->Id();
|
85
|
228 |
}
|
127
|
229 |
|
|
230 |
// ---------------------------------------------------------------------------
|
|
231 |
//
|
|
232 |
// ---------------------------------------------------------------------------
|
|
233 |
//
|
|
234 |
EXPORT_C const RArray<TInt>& CCaInnerEntry::GetParentIds() const
|
|
235 |
{
|
|
236 |
return iParentIds;
|
|
237 |
}
|
|
238 |
|
85
|
239 |
// SETTERS
|
|
240 |
|
|
241 |
// ---------------------------------------------------------------------------
|
|
242 |
//
|
|
243 |
// ---------------------------------------------------------------------------
|
|
244 |
//
|
|
245 |
EXPORT_C void CCaInnerEntry::SetId( TUint aId )
|
|
246 |
{
|
|
247 |
iId = aId;
|
|
248 |
}
|
|
249 |
|
|
250 |
// ---------------------------------------------------------------------------
|
|
251 |
//
|
|
252 |
// ---------------------------------------------------------------------------
|
|
253 |
//
|
98
|
254 |
EXPORT_C void CCaInnerEntry::SetTextL( const TDesC& aText, TBool localized )
|
85
|
255 |
{
|
|
256 |
iText.Close();
|
|
257 |
iText.CreateL( aText );
|
98
|
258 |
iTextLocalized = localized;
|
85
|
259 |
}
|
|
260 |
|
|
261 |
// ---------------------------------------------------------------------------
|
|
262 |
//
|
|
263 |
// ---------------------------------------------------------------------------
|
|
264 |
//
|
98
|
265 |
EXPORT_C void CCaInnerEntry::SetDescriptionL(
|
|
266 |
const TDesC& aText, TBool localized )
|
85
|
267 |
{
|
|
268 |
iDescription.Close();
|
|
269 |
iDescription.CreateL( aText );
|
98
|
270 |
iDescriptionLocalized = localized;
|
85
|
271 |
}
|
|
272 |
|
|
273 |
// ---------------------------------------------------------------------------
|
|
274 |
//
|
|
275 |
// ---------------------------------------------------------------------------
|
|
276 |
//
|
|
277 |
EXPORT_C void CCaInnerEntry::SetEntryTypeNameL( const TDesC& aTypeName )
|
|
278 |
{
|
|
279 |
iEntryTypeName.Close();
|
|
280 |
iEntryTypeName.CreateL( aTypeName );
|
|
281 |
}
|
|
282 |
|
|
283 |
// ---------------------------------------------------------------------------
|
|
284 |
//
|
|
285 |
// ---------------------------------------------------------------------------
|
|
286 |
//
|
88
|
287 |
EXPORT_C void CCaInnerEntry::SetIconDataL(
|
|
288 |
const TDesC& aFilename, const TDesC& aSkinId, const TDesC& aApplicationId )
|
85
|
289 |
{
|
92
|
290 |
iIcon->SetFileNameL( aFilename );
|
|
291 |
iIcon->SetSkinIdL( aSkinId );
|
|
292 |
iIcon->SetApplicationIdL( aApplicationId );
|
85
|
293 |
}
|
|
294 |
|
|
295 |
// ---------------------------------------------------------------------------
|
|
296 |
//
|
|
297 |
// ---------------------------------------------------------------------------
|
|
298 |
//
|
|
299 |
EXPORT_C void CCaInnerEntry::AddAttributeL( const TDesC& aKey,
|
|
300 |
const TDesC& aValue )
|
|
301 |
{
|
|
302 |
// to avoid duplicated attribute
|
|
303 |
if( iAttributes.Exist( aKey ) )
|
|
304 |
{
|
|
305 |
iAttributes.RemoveAttribute( aKey );
|
|
306 |
}
|
|
307 |
CCaEntryAttribute* attr = CCaEntryAttribute::NewLC( aKey );
|
|
308 |
attr->SetValueL( aValue );
|
|
309 |
iAttributes.AppendL( attr );
|
|
310 |
CleanupStack::Pop( attr );
|
|
311 |
}
|
|
312 |
|
|
313 |
// ---------------------------------------------------------------------------
|
|
314 |
//
|
|
315 |
// ---------------------------------------------------------------------------
|
|
316 |
//
|
|
317 |
EXPORT_C void CCaInnerEntry::SetFlags( TUint aFlags )
|
|
318 |
{
|
|
319 |
iFlags = aFlags;
|
|
320 |
}
|
|
321 |
|
|
322 |
// ---------------------------------------------------------------------------
|
|
323 |
//
|
|
324 |
// ---------------------------------------------------------------------------
|
|
325 |
//
|
|
326 |
EXPORT_C void CCaInnerEntry::SetRole( TUint aRole )
|
|
327 |
{
|
|
328 |
iRole = aRole;
|
|
329 |
}
|
|
330 |
|
|
331 |
// ---------------------------------------------------------------------------
|
|
332 |
//
|
|
333 |
// ---------------------------------------------------------------------------
|
|
334 |
//
|
|
335 |
EXPORT_C void CCaInnerEntry::RemoveAttributeL( const TDesC& aKey )
|
|
336 |
{
|
|
337 |
iAttributes.RemoveAttribute( aKey );
|
|
338 |
}
|
|
339 |
|
|
340 |
// ---------------------------------------------------------------------------
|
|
341 |
//
|
|
342 |
// ---------------------------------------------------------------------------
|
|
343 |
//
|
|
344 |
EXPORT_C TBool CCaInnerEntry::FindAttribute( const TDesC& aKey,
|
|
345 |
TDes& aAttrVal )
|
|
346 |
{
|
|
347 |
return iAttributes.Find( aKey, aAttrVal );
|
|
348 |
}
|
|
349 |
|
|
350 |
// ---------------------------------------------------------------------------
|
|
351 |
//
|
|
352 |
// ---------------------------------------------------------------------------
|
|
353 |
//
|
92
|
354 |
EXPORT_C TBool CCaInnerEntry::FindAttribute( const TDesC& aKey,
|
|
355 |
TPtrC& aAttrVal )
|
|
356 |
{
|
|
357 |
return iAttributes.Find( aKey, aAttrVal );
|
|
358 |
}
|
|
359 |
|
|
360 |
// ---------------------------------------------------------------------------
|
|
361 |
//
|
|
362 |
// ---------------------------------------------------------------------------
|
|
363 |
//
|
85
|
364 |
EXPORT_C void CCaInnerEntry::SetUid( TInt32 aUid )
|
|
365 |
{
|
|
366 |
iUid = aUid;
|
|
367 |
}
|
|
368 |
|
|
369 |
// ---------------------------------------------------------------------------
|
|
370 |
//
|
|
371 |
// ---------------------------------------------------------------------------
|
|
372 |
//
|
|
373 |
EXPORT_C void CCaInnerEntry::SetIconId( TInt aIconId )
|
|
374 |
{
|
92
|
375 |
iIcon->SetId( aIconId );
|
85
|
376 |
}
|
98
|
377 |
|
|
378 |
// ---------------------------------------------------------------------------
|
|
379 |
//
|
|
380 |
// ---------------------------------------------------------------------------
|
|
381 |
//
|
127
|
382 |
EXPORT_C void CCaInnerEntry::SetParentIdsL( const RArray<TInt>& aArray )
|
|
383 |
{
|
|
384 |
for( TInt i( 0 ); i < aArray.Count(); ++i )
|
|
385 |
{
|
|
386 |
iParentIds.AppendL( aArray[i] );
|
|
387 |
}
|
|
388 |
}
|
|
389 |
|
|
390 |
// ---------------------------------------------------------------------------
|
|
391 |
//
|
|
392 |
// ---------------------------------------------------------------------------
|
|
393 |
//
|
98
|
394 |
EXPORT_C TBool CCaInnerEntry::isLocalized(TLocalizedType aLocalized) const
|
|
395 |
{
|
|
396 |
if(aLocalized == EDescriptionLocalized)
|
|
397 |
{
|
|
398 |
return iDescriptionLocalized;
|
|
399 |
}
|
|
400 |
if(aLocalized == ENameLocalized)
|
|
401 |
{
|
|
402 |
return iTextLocalized;
|
|
403 |
}
|
|
404 |
else
|
|
405 |
return EFalse;
|
|
406 |
}
|
|
407 |
|
|
408 |
|