1 /* |
|
2 * =========================================================================== |
|
3 * Name : hgfswentry.cpp |
|
4 * Part of : Huriganes / Fast Swap Server |
|
5 * Description : Task list entry |
|
6 * Version : %version: 7 % |
|
7 * |
|
8 * Copyright © 2008 Nokia Corporation. |
|
9 * This material, including documentation and any related |
|
10 * computer programs, is protected by copyright controlled by |
|
11 * Nokia Corporation. All rights are reserved. Copying, |
|
12 * including reproducing, storing, adapting or translating, any |
|
13 * or all of this material requires the prior written consent of |
|
14 * Nokia Corporation. This material also contains confidential |
|
15 * information which may not be disclosed to others without the |
|
16 * prior written consent of Nokia Corporation. |
|
17 * =========================================================================== |
|
18 */ |
|
19 |
|
20 #include "hgfswentry.h" |
|
21 #include <s32strm.h> |
|
22 |
|
23 // -------------------------------------------------------------------------- |
|
24 // CHgFswEntry::NewL |
|
25 // -------------------------------------------------------------------------- |
|
26 // |
|
27 EXPORT_C CHgFswEntry* CHgFswEntry::NewL() |
|
28 { |
|
29 CHgFswEntry* self = NewLC(); |
|
30 CleanupStack::Pop( self ); |
|
31 return self; |
|
32 } |
|
33 |
|
34 // -------------------------------------------------------------------------- |
|
35 // CHgFswEntry::NewLC |
|
36 // -------------------------------------------------------------------------- |
|
37 // |
|
38 EXPORT_C CHgFswEntry* CHgFswEntry::NewLC() |
|
39 { |
|
40 CHgFswEntry* self = new ( ELeave ) CHgFswEntry; |
|
41 CleanupStack::PushL( self ); |
|
42 return self; |
|
43 } |
|
44 |
|
45 // -------------------------------------------------------------------------- |
|
46 // CHgFswEntry::~CHgFswEntry |
|
47 // -------------------------------------------------------------------------- |
|
48 // |
|
49 CHgFswEntry::~CHgFswEntry() |
|
50 { |
|
51 delete iAppName; |
|
52 } |
|
53 |
|
54 // -------------------------------------------------------------------------- |
|
55 // CHgFswEntry::SetWgId |
|
56 // -------------------------------------------------------------------------- |
|
57 // |
|
58 EXPORT_C void CHgFswEntry::SetWgId( TInt aWgId ) |
|
59 { |
|
60 iWgId = aWgId; |
|
61 } |
|
62 |
|
63 // -------------------------------------------------------------------------- |
|
64 // CHgFswEntry::SetAppUid |
|
65 // -------------------------------------------------------------------------- |
|
66 // |
|
67 EXPORT_C void CHgFswEntry::SetAppUid( const TUid& aUid ) |
|
68 { |
|
69 iAppUid = aUid; |
|
70 } |
|
71 |
|
72 // -------------------------------------------------------------------------- |
|
73 // CHgFswEntry::SetAppNameL |
|
74 // -------------------------------------------------------------------------- |
|
75 // |
|
76 EXPORT_C void CHgFswEntry::SetAppNameL( const TDesC& aAppName ) |
|
77 { |
|
78 delete iAppName; iAppName = 0; |
|
79 iAppName = aAppName.AllocL(); |
|
80 } |
|
81 |
|
82 // -------------------------------------------------------------------------- |
|
83 // CHgFswEntry::SetScreenshotHandle |
|
84 // -------------------------------------------------------------------------- |
|
85 // |
|
86 EXPORT_C void CHgFswEntry::SetScreenshotHandle( TInt aHandle ) |
|
87 { |
|
88 iScreenshotHandle = aHandle; |
|
89 } |
|
90 |
|
91 // -------------------------------------------------------------------------- |
|
92 // CHgFswEntry::SetAlwaysShown |
|
93 // -------------------------------------------------------------------------- |
|
94 // |
|
95 EXPORT_C void CHgFswEntry::SetAlwaysShown( TBool aValue ) |
|
96 { |
|
97 iAlwaysShown = aValue; |
|
98 } |
|
99 |
|
100 // -------------------------------------------------------------------------- |
|
101 // CHgFswEntry::SetSystemApp |
|
102 // -------------------------------------------------------------------------- |
|
103 // |
|
104 EXPORT_C void CHgFswEntry::SetSystemApp( TBool aValue ) |
|
105 { |
|
106 iSystemApp = aValue; |
|
107 } |
|
108 |
|
109 // -------------------------------------------------------------------------- |
|
110 // CHgFswEntry::SetWidget |
|
111 // -------------------------------------------------------------------------- |
|
112 // |
|
113 EXPORT_C void CHgFswEntry::SetWidget( TBool aValue ) |
|
114 { |
|
115 iWidget = aValue; |
|
116 } |
|
117 |
|
118 // -------------------------------------------------------------------------- |
|
119 // CHgFswEntry::SetAppIconHandles |
|
120 // -------------------------------------------------------------------------- |
|
121 // |
|
122 EXPORT_C void CHgFswEntry::SetAppIconHandles( TInt aBitmapHandle, TInt aMaskHandle ) |
|
123 { |
|
124 iAppIconBitmapHandle = aBitmapHandle; |
|
125 iAppIconMaskHandle = aMaskHandle; |
|
126 } |
|
127 |
|
128 // -------------------------------------------------------------------------- |
|
129 // CHgFswEntry::WgId |
|
130 // -------------------------------------------------------------------------- |
|
131 // |
|
132 EXPORT_C TInt CHgFswEntry::WgId() const |
|
133 { |
|
134 return iWgId; |
|
135 } |
|
136 |
|
137 // -------------------------------------------------------------------------- |
|
138 // CHgFswEntry::AppUid |
|
139 // -------------------------------------------------------------------------- |
|
140 // |
|
141 EXPORT_C TUid CHgFswEntry::AppUid() const |
|
142 { |
|
143 return iAppUid; |
|
144 } |
|
145 |
|
146 // -------------------------------------------------------------------------- |
|
147 // CHgFswEntry::AppName |
|
148 // -------------------------------------------------------------------------- |
|
149 // |
|
150 EXPORT_C const TDesC& CHgFswEntry::AppName() const |
|
151 { |
|
152 return iAppName ? *iAppName : KNullDesC(); |
|
153 } |
|
154 |
|
155 // -------------------------------------------------------------------------- |
|
156 // CHgFswEntry::ScreenshotHandle |
|
157 // -------------------------------------------------------------------------- |
|
158 // |
|
159 EXPORT_C TInt CHgFswEntry::ScreenshotHandle() const |
|
160 { |
|
161 return iScreenshotHandle; |
|
162 } |
|
163 |
|
164 // -------------------------------------------------------------------------- |
|
165 // CHgFswEntry::AlwaysShown |
|
166 // -------------------------------------------------------------------------- |
|
167 // |
|
168 EXPORT_C TBool CHgFswEntry::AlwaysShown() const |
|
169 { |
|
170 return iAlwaysShown; |
|
171 } |
|
172 |
|
173 // -------------------------------------------------------------------------- |
|
174 // CHgFswEntry::SystemApp |
|
175 // -------------------------------------------------------------------------- |
|
176 // |
|
177 EXPORT_C TBool CHgFswEntry::SystemApp() const |
|
178 { |
|
179 return iSystemApp; |
|
180 } |
|
181 |
|
182 // -------------------------------------------------------------------------- |
|
183 // CHgFswEntry::Widget |
|
184 // -------------------------------------------------------------------------- |
|
185 // |
|
186 EXPORT_C TBool CHgFswEntry::Widget() const |
|
187 { |
|
188 return iWidget; |
|
189 } |
|
190 |
|
191 // -------------------------------------------------------------------------- |
|
192 // CHgFswEntry::AppIconBitmapHandle |
|
193 // -------------------------------------------------------------------------- |
|
194 // |
|
195 EXPORT_C TInt CHgFswEntry::AppIconBitmapHandle() const |
|
196 { |
|
197 return iAppIconBitmapHandle; |
|
198 } |
|
199 |
|
200 // -------------------------------------------------------------------------- |
|
201 // CHgFswEntry::AppIconMaskHandle |
|
202 // -------------------------------------------------------------------------- |
|
203 // |
|
204 EXPORT_C TInt CHgFswEntry::AppIconMaskHandle() const |
|
205 { |
|
206 return iAppIconMaskHandle; |
|
207 } |
|
208 |
|
209 // -------------------------------------------------------------------------- |
|
210 // CHgFswEntry::ExternalizeL |
|
211 // -------------------------------------------------------------------------- |
|
212 // |
|
213 EXPORT_C void CHgFswEntry::ExternalizeL( RWriteStream& aStream ) |
|
214 { |
|
215 aStream.WriteInt32L( iWgId ); |
|
216 aStream.WriteInt32L( iAppUid.iUid ); |
|
217 aStream << AppName(); |
|
218 aStream.WriteInt32L( iScreenshotHandle ); |
|
219 aStream.WriteInt32L( iAlwaysShown ); |
|
220 aStream.WriteInt32L( iSystemApp ); |
|
221 aStream.WriteInt32L( iWidget ); |
|
222 aStream.WriteInt32L( iAppIconBitmapHandle ); |
|
223 aStream.WriteInt32L( iAppIconMaskHandle ); |
|
224 } |
|
225 |
|
226 // -------------------------------------------------------------------------- |
|
227 // CHgFswEntry::InternalizeL |
|
228 // -------------------------------------------------------------------------- |
|
229 // |
|
230 EXPORT_C void CHgFswEntry::InternalizeL( RReadStream& aStream ) |
|
231 { |
|
232 iWgId = aStream.ReadInt32L(); |
|
233 iAppUid = TUid::Uid( aStream.ReadInt32L() ); |
|
234 delete iAppName; iAppName = 0; |
|
235 iAppName = HBufC::NewL( aStream, KMaxTInt ); |
|
236 iScreenshotHandle = aStream.ReadInt32L(); |
|
237 iAlwaysShown = aStream.ReadInt32L(); |
|
238 iSystemApp = aStream.ReadInt32L(); |
|
239 iWidget = aStream.ReadInt32L(); |
|
240 iAppIconBitmapHandle = aStream.ReadInt32L(); |
|
241 iAppIconMaskHandle = aStream.ReadInt32L(); |
|
242 } |
|
243 |
|
244 // -------------------------------------------------------------------------- |
|
245 // CHgFswEntry::ExternalizeArrayL |
|
246 // -------------------------------------------------------------------------- |
|
247 // |
|
248 EXPORT_C void CHgFswEntry::ExternalizeArrayL( RWriteStream& aStream, |
|
249 const RHgFswArray& aArray ) |
|
250 { |
|
251 TInt count = aArray.Count(); |
|
252 aStream.WriteInt32L( count ); |
|
253 for ( TInt i = 0; i < count; ++i ) |
|
254 { |
|
255 aArray[i]->ExternalizeL( aStream ); |
|
256 } |
|
257 } |
|
258 |
|
259 // -------------------------------------------------------------------------- |
|
260 // CHgFswEntry::InternalizeArrayL |
|
261 // -------------------------------------------------------------------------- |
|
262 // |
|
263 EXPORT_C void CHgFswEntry::InternalizeArrayL( RReadStream& aStream, |
|
264 RHgFswArray& aArray ) |
|
265 { |
|
266 aArray.ResetAndDestroy(); |
|
267 TInt count = aStream.ReadInt32L(); |
|
268 for ( TInt i = 0; i < count; ++i ) |
|
269 { |
|
270 CHgFswEntry* entry = CHgFswEntry::NewLC(); |
|
271 entry->InternalizeL( aStream ); |
|
272 aArray.AppendL( entry ); |
|
273 CleanupStack::Pop( entry ); |
|
274 } |
|
275 } |
|
276 |
|
277 |
|
278 // end of file |
|