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() );
|
|
75 |
iAttributes.ExternalizeL( aStream );
|
92
|
76 |
iIcon->ExternalizeL( aStream );
|
85
|
77 |
aStream.CommitL();
|
|
78 |
}
|
|
79 |
|
|
80 |
// ---------------------------------------------------------------------------
|
|
81 |
//
|
|
82 |
// ---------------------------------------------------------------------------
|
|
83 |
//
|
|
84 |
EXPORT_C void CCaInnerEntry::InternalizeL( RReadStream& aStream )
|
|
85 |
{
|
|
86 |
iId = aStream.ReadInt32L();
|
|
87 |
iUid = aStream.ReadInt32L();
|
|
88 |
iFlags = aStream.ReadUint32L();
|
|
89 |
iRole = aStream.ReadUint32L();
|
92
|
90 |
TUint length = aStream.ReadUint32L();
|
85
|
91 |
iText.Close();
|
|
92 |
iText.CreateL( length );
|
|
93 |
aStream.ReadL( iText, length );
|
|
94 |
length = aStream.ReadUint32L();
|
|
95 |
iDescription.Close( );
|
|
96 |
iDescription.CreateL( length );
|
|
97 |
aStream.ReadL( iDescription, length);
|
|
98 |
length = aStream.ReadUint32L( );
|
|
99 |
iEntryTypeName.Close();
|
|
100 |
iEntryTypeName.CreateL( length );
|
|
101 |
aStream.ReadL( iEntryTypeName, length );
|
|
102 |
iAttributes.InternalizeL( aStream );
|
92
|
103 |
iIcon->InternalizeL( aStream );
|
85
|
104 |
}
|
|
105 |
|
|
106 |
// ---------------------------------------------------------------------------
|
|
107 |
//
|
|
108 |
// ---------------------------------------------------------------------------
|
|
109 |
//
|
|
110 |
void CCaInnerEntry::ConstructL()
|
|
111 |
{
|
92
|
112 |
iIcon = CCaInnerIconDescription::NewL();
|
85
|
113 |
}
|
|
114 |
|
|
115 |
// ---------------------------------------------------------------------------
|
|
116 |
//
|
|
117 |
// ---------------------------------------------------------------------------
|
|
118 |
//
|
|
119 |
CCaInnerEntry::CCaInnerEntry()
|
|
120 |
{
|
|
121 |
}
|
|
122 |
|
|
123 |
// ---------------------------------------------------------------------------
|
|
124 |
//
|
|
125 |
// ---------------------------------------------------------------------------
|
|
126 |
//
|
|
127 |
EXPORT_C TInt CCaInnerEntry::GetId() const
|
|
128 |
{
|
|
129 |
return iId;
|
|
130 |
}
|
|
131 |
|
|
132 |
// ---------------------------------------------------------------------------
|
|
133 |
//
|
|
134 |
// ---------------------------------------------------------------------------
|
|
135 |
//
|
|
136 |
EXPORT_C const RBuf& CCaInnerEntry::GetText() const
|
|
137 |
{
|
|
138 |
return iText;
|
|
139 |
}
|
|
140 |
|
|
141 |
// ---------------------------------------------------------------------------
|
|
142 |
//
|
|
143 |
// ---------------------------------------------------------------------------
|
|
144 |
//
|
|
145 |
EXPORT_C const RBuf& CCaInnerEntry::GetDescription() const
|
|
146 |
{
|
|
147 |
return iDescription;
|
|
148 |
}
|
|
149 |
|
|
150 |
// ---------------------------------------------------------------------------
|
|
151 |
//
|
|
152 |
// ---------------------------------------------------------------------------
|
|
153 |
//
|
|
154 |
EXPORT_C const RBuf& CCaInnerEntry::GetEntryTypeName() const
|
|
155 |
{
|
|
156 |
return iEntryTypeName;
|
|
157 |
}
|
|
158 |
|
|
159 |
// ---------------------------------------------------------------------------
|
|
160 |
//
|
|
161 |
// ---------------------------------------------------------------------------
|
|
162 |
//
|
92
|
163 |
EXPORT_C const CCaInnerIconDescription* CCaInnerEntry::Icon() const
|
85
|
164 |
{
|
|
165 |
return iIcon;
|
|
166 |
}
|
|
167 |
|
|
168 |
// ---------------------------------------------------------------------------
|
|
169 |
//
|
|
170 |
// ---------------------------------------------------------------------------
|
|
171 |
//
|
|
172 |
EXPORT_C TUint CCaInnerEntry::GetFlags() const
|
|
173 |
{
|
|
174 |
return iFlags;
|
|
175 |
}
|
|
176 |
|
|
177 |
// ---------------------------------------------------------------------------
|
|
178 |
//
|
|
179 |
// ---------------------------------------------------------------------------
|
|
180 |
//
|
|
181 |
EXPORT_C const RCaEntryAttrArray& CCaInnerEntry::GetAttributes() const
|
|
182 |
{
|
|
183 |
return iAttributes;
|
|
184 |
}
|
|
185 |
|
|
186 |
// ---------------------------------------------------------------------------
|
|
187 |
//
|
|
188 |
// ---------------------------------------------------------------------------
|
|
189 |
//
|
|
190 |
EXPORT_C TUint CCaInnerEntry::GetRole() const
|
|
191 |
{
|
|
192 |
return iRole;
|
|
193 |
}
|
|
194 |
|
|
195 |
// ---------------------------------------------------------------------------
|
|
196 |
//
|
|
197 |
// ---------------------------------------------------------------------------
|
|
198 |
//
|
|
199 |
EXPORT_C TInt32 CCaInnerEntry::GetUid() const
|
|
200 |
{
|
|
201 |
return iUid;
|
|
202 |
}
|
|
203 |
|
|
204 |
// ---------------------------------------------------------------------------
|
|
205 |
//
|
|
206 |
// ---------------------------------------------------------------------------
|
|
207 |
//
|
|
208 |
EXPORT_C TInt CCaInnerEntry::GetIconId() const
|
|
209 |
{
|
92
|
210 |
return iIcon->Id();
|
85
|
211 |
}
|
|
212 |
// SETTERS
|
|
213 |
|
|
214 |
// ---------------------------------------------------------------------------
|
|
215 |
//
|
|
216 |
// ---------------------------------------------------------------------------
|
|
217 |
//
|
|
218 |
EXPORT_C void CCaInnerEntry::SetId( TUint aId )
|
|
219 |
{
|
|
220 |
iId = aId;
|
|
221 |
}
|
|
222 |
|
|
223 |
// ---------------------------------------------------------------------------
|
|
224 |
//
|
|
225 |
// ---------------------------------------------------------------------------
|
|
226 |
//
|
|
227 |
EXPORT_C void CCaInnerEntry::SetTextL( const TDesC& aText )
|
|
228 |
{
|
|
229 |
iText.Close();
|
|
230 |
iText.CreateL( aText );
|
|
231 |
}
|
|
232 |
|
|
233 |
// ---------------------------------------------------------------------------
|
|
234 |
//
|
|
235 |
// ---------------------------------------------------------------------------
|
|
236 |
//
|
|
237 |
EXPORT_C void CCaInnerEntry::SetDescriptionL( const TDesC& aText )
|
|
238 |
{
|
|
239 |
iDescription.Close();
|
|
240 |
iDescription.CreateL( aText );
|
|
241 |
}
|
|
242 |
|
|
243 |
// ---------------------------------------------------------------------------
|
|
244 |
//
|
|
245 |
// ---------------------------------------------------------------------------
|
|
246 |
//
|
|
247 |
EXPORT_C void CCaInnerEntry::SetEntryTypeNameL( const TDesC& aTypeName )
|
|
248 |
{
|
|
249 |
iEntryTypeName.Close();
|
|
250 |
iEntryTypeName.CreateL( aTypeName );
|
|
251 |
}
|
|
252 |
|
|
253 |
// ---------------------------------------------------------------------------
|
|
254 |
//
|
|
255 |
// ---------------------------------------------------------------------------
|
|
256 |
//
|
88
|
257 |
EXPORT_C void CCaInnerEntry::SetIconDataL(
|
|
258 |
const TDesC& aFilename, const TDesC& aSkinId, const TDesC& aApplicationId )
|
85
|
259 |
{
|
92
|
260 |
iIcon->SetFileNameL( aFilename );
|
|
261 |
iIcon->SetSkinIdL( aSkinId );
|
|
262 |
iIcon->SetApplicationIdL( aApplicationId );
|
85
|
263 |
}
|
|
264 |
|
|
265 |
// ---------------------------------------------------------------------------
|
|
266 |
//
|
|
267 |
// ---------------------------------------------------------------------------
|
|
268 |
//
|
|
269 |
EXPORT_C void CCaInnerEntry::AddAttributeL( const TDesC& aKey,
|
|
270 |
const TDesC& aValue )
|
|
271 |
{
|
|
272 |
// to avoid duplicated attribute
|
|
273 |
if( iAttributes.Exist( aKey ) )
|
|
274 |
{
|
|
275 |
iAttributes.RemoveAttribute( aKey );
|
|
276 |
}
|
|
277 |
CCaEntryAttribute* attr = CCaEntryAttribute::NewLC( aKey );
|
|
278 |
attr->SetValueL( aValue );
|
|
279 |
iAttributes.AppendL( attr );
|
|
280 |
CleanupStack::Pop( attr );
|
|
281 |
}
|
|
282 |
|
|
283 |
// ---------------------------------------------------------------------------
|
|
284 |
//
|
|
285 |
// ---------------------------------------------------------------------------
|
|
286 |
//
|
|
287 |
EXPORT_C void CCaInnerEntry::SetFlags( TUint aFlags )
|
|
288 |
{
|
|
289 |
iFlags = aFlags;
|
|
290 |
}
|
|
291 |
|
|
292 |
// ---------------------------------------------------------------------------
|
|
293 |
//
|
|
294 |
// ---------------------------------------------------------------------------
|
|
295 |
//
|
|
296 |
EXPORT_C void CCaInnerEntry::SetRole( TUint aRole )
|
|
297 |
{
|
|
298 |
iRole = aRole;
|
|
299 |
}
|
|
300 |
|
|
301 |
// ---------------------------------------------------------------------------
|
|
302 |
//
|
|
303 |
// ---------------------------------------------------------------------------
|
|
304 |
//
|
|
305 |
EXPORT_C void CCaInnerEntry::RemoveAttributeL( const TDesC& aKey )
|
|
306 |
{
|
|
307 |
iAttributes.RemoveAttribute( aKey );
|
|
308 |
}
|
|
309 |
|
|
310 |
// ---------------------------------------------------------------------------
|
|
311 |
//
|
|
312 |
// ---------------------------------------------------------------------------
|
|
313 |
//
|
|
314 |
EXPORT_C TBool CCaInnerEntry::FindAttribute( const TDesC& aKey,
|
|
315 |
TDes& aAttrVal )
|
|
316 |
{
|
|
317 |
return iAttributes.Find( aKey, aAttrVal );
|
|
318 |
}
|
|
319 |
|
|
320 |
// ---------------------------------------------------------------------------
|
|
321 |
//
|
|
322 |
// ---------------------------------------------------------------------------
|
|
323 |
//
|
92
|
324 |
EXPORT_C TBool CCaInnerEntry::FindAttribute( const TDesC& aKey,
|
|
325 |
TPtrC& aAttrVal )
|
|
326 |
{
|
|
327 |
return iAttributes.Find( aKey, aAttrVal );
|
|
328 |
}
|
|
329 |
|
|
330 |
// ---------------------------------------------------------------------------
|
|
331 |
//
|
|
332 |
// ---------------------------------------------------------------------------
|
|
333 |
//
|
85
|
334 |
EXPORT_C void CCaInnerEntry::SetUid( TInt32 aUid )
|
|
335 |
{
|
|
336 |
iUid = aUid;
|
|
337 |
}
|
|
338 |
|
|
339 |
// ---------------------------------------------------------------------------
|
|
340 |
//
|
|
341 |
// ---------------------------------------------------------------------------
|
|
342 |
//
|
|
343 |
EXPORT_C void CCaInnerEntry::SetIconId( TInt aIconId )
|
|
344 |
{
|
92
|
345 |
iIcon->SetId( aIconId );
|
85
|
346 |
}
|