94
|
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: Task list entry
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#define __E32SVR_H__
|
|
19 |
#include "tsfswentry.h"
|
|
20 |
#include <s32strm.h>
|
|
21 |
#include <fbs.h>
|
|
22 |
|
|
23 |
// --------------------------------------------------------------------------
|
|
24 |
// CTsFswEntry::NewL
|
|
25 |
// --------------------------------------------------------------------------
|
|
26 |
//
|
|
27 |
CTsFswEntry* CTsFswEntry::NewL()
|
|
28 |
{
|
|
29 |
CTsFswEntry* self = NewLC();
|
|
30 |
CleanupStack::Pop( self );
|
|
31 |
return self;
|
|
32 |
}
|
|
33 |
|
|
34 |
// --------------------------------------------------------------------------
|
|
35 |
// CTsFswEntry::NewLC
|
|
36 |
// --------------------------------------------------------------------------
|
|
37 |
//
|
|
38 |
CTsFswEntry* CTsFswEntry::NewLC()
|
|
39 |
{
|
|
40 |
CTsFswEntry* self = new ( ELeave ) CTsFswEntry;
|
|
41 |
CleanupStack::PushL( self );
|
|
42 |
return self;
|
|
43 |
}
|
|
44 |
|
|
45 |
// --------------------------------------------------------------------------
|
|
46 |
// CTsFswEntry::~CTsFswEntry
|
|
47 |
// --------------------------------------------------------------------------
|
|
48 |
//
|
|
49 |
CTsFswEntry::~CTsFswEntry()
|
|
50 |
{
|
|
51 |
delete iAppName;
|
|
52 |
delete iAppIconBitmap;
|
|
53 |
delete iAppIconMask;
|
|
54 |
}
|
|
55 |
|
|
56 |
// --------------------------------------------------------------------------
|
|
57 |
// CTsFswEntry::SetWgId
|
|
58 |
// --------------------------------------------------------------------------
|
|
59 |
//
|
|
60 |
void CTsFswEntry::SetWgId( TInt aWgId )
|
|
61 |
{
|
|
62 |
iWgId = aWgId;
|
|
63 |
}
|
|
64 |
|
|
65 |
// --------------------------------------------------------------------------
|
|
66 |
// CTsFswEntry::SetAppUid
|
|
67 |
// --------------------------------------------------------------------------
|
|
68 |
//
|
|
69 |
void CTsFswEntry::SetAppUid( const TUid& aUid )
|
|
70 |
{
|
|
71 |
iAppUid = aUid;
|
|
72 |
}
|
|
73 |
|
|
74 |
// --------------------------------------------------------------------------
|
|
75 |
// CTsFswEntry::SetAppNameL
|
|
76 |
// --------------------------------------------------------------------------
|
|
77 |
//
|
|
78 |
void CTsFswEntry::SetAppNameL( const TDesC& aAppName )
|
|
79 |
{
|
|
80 |
delete iAppName; iAppName = 0;
|
|
81 |
iAppName = aAppName.AllocL();
|
|
82 |
}
|
|
83 |
|
|
84 |
// --------------------------------------------------------------------------
|
|
85 |
// CTsFswEntry::SetSystemApp
|
|
86 |
// --------------------------------------------------------------------------
|
|
87 |
//
|
|
88 |
void CTsFswEntry::SetCloseableApp( TBool aValue )
|
|
89 |
{
|
|
90 |
iCloseableApp = aValue;
|
|
91 |
}
|
|
92 |
|
|
93 |
// --------------------------------------------------------------------------
|
|
94 |
// CTsFswEntry::SetAppIconHandles
|
|
95 |
// --------------------------------------------------------------------------
|
|
96 |
//
|
|
97 |
void CTsFswEntry::SetAppIcon( CFbsBitmap* aBitmap, CFbsBitmap* aMask )
|
|
98 |
{
|
|
99 |
iAppIconBitmap = aBitmap;
|
|
100 |
iAppIconMask = aMask;
|
|
101 |
}
|
|
102 |
|
|
103 |
// --------------------------------------------------------------------------
|
|
104 |
// CTsFswEntry::WgId
|
|
105 |
// --------------------------------------------------------------------------
|
|
106 |
//
|
|
107 |
TInt CTsFswEntry::WgId() const
|
|
108 |
{
|
|
109 |
return iWgId;
|
|
110 |
}
|
|
111 |
|
|
112 |
// --------------------------------------------------------------------------
|
|
113 |
// CTsFswEntry::AppUid
|
|
114 |
// --------------------------------------------------------------------------
|
|
115 |
//
|
|
116 |
TUid CTsFswEntry::AppUid() const
|
|
117 |
{
|
|
118 |
return iAppUid;
|
|
119 |
}
|
|
120 |
|
|
121 |
// --------------------------------------------------------------------------
|
|
122 |
// CTsFswEntry::AppName
|
|
123 |
// --------------------------------------------------------------------------
|
|
124 |
//
|
|
125 |
const TDesC& CTsFswEntry::AppName() const
|
|
126 |
{
|
|
127 |
return iAppName ? *iAppName : KNullDesC();
|
|
128 |
}
|
|
129 |
|
|
130 |
// --------------------------------------------------------------------------
|
|
131 |
// CTsFswEntry::SystemApp
|
|
132 |
// --------------------------------------------------------------------------
|
|
133 |
//
|
|
134 |
TBool CTsFswEntry::CloseableApp() const
|
|
135 |
{
|
|
136 |
return iCloseableApp;
|
|
137 |
}
|
|
138 |
|
|
139 |
// --------------------------------------------------------------------------
|
|
140 |
// CTsFswEntry::AppIconBitmapHandle
|
|
141 |
// --------------------------------------------------------------------------
|
|
142 |
//
|
|
143 |
CFbsBitmap* CTsFswEntry::AppIconBitmap() const
|
|
144 |
{
|
|
145 |
return iAppIconBitmap;
|
|
146 |
}
|
|
147 |
|
|
148 |
// --------------------------------------------------------------------------
|
|
149 |
// CTsFswEntry::AppIconMaskHandle
|
|
150 |
// --------------------------------------------------------------------------
|
|
151 |
//
|
|
152 |
CFbsBitmap* CTsFswEntry::AppIconMask() const
|
|
153 |
{
|
|
154 |
return iAppIconMask;
|
|
155 |
}
|
|
156 |
|
|
157 |
// --------------------------------------------------------------------------
|
|
158 |
// CTsFswEntry::ExternalizeL
|
|
159 |
// --------------------------------------------------------------------------
|
|
160 |
//
|
|
161 |
void CTsFswEntry::ExternalizeL( RWriteStream& aStream )
|
|
162 |
{
|
|
163 |
aStream.WriteInt32L( iWgId );
|
|
164 |
aStream.WriteInt32L( iAppUid.iUid );
|
|
165 |
aStream << AppName();
|
|
166 |
aStream.WriteInt32L( iCloseableApp );
|
|
167 |
if ( iAppIconBitmap )
|
|
168 |
{
|
|
169 |
aStream.WriteInt32L( iAppIconBitmap->Handle() );
|
|
170 |
}
|
|
171 |
else
|
|
172 |
{
|
|
173 |
aStream.WriteInt32L( KErrNotFound );
|
|
174 |
}
|
|
175 |
|
|
176 |
if ( iAppIconMask )
|
|
177 |
{
|
|
178 |
aStream.WriteInt32L( iAppIconMask->Handle() );
|
|
179 |
}
|
|
180 |
else
|
|
181 |
{
|
|
182 |
aStream.WriteInt32L( KErrNotFound );
|
|
183 |
}
|
|
184 |
}
|
|
185 |
|
|
186 |
// --------------------------------------------------------------------------
|
|
187 |
// CTsFswEntry::InternalizeL
|
|
188 |
// --------------------------------------------------------------------------
|
|
189 |
//
|
|
190 |
void CTsFswEntry::InternalizeL( RReadStream& aStream )
|
|
191 |
{
|
|
192 |
iWgId = aStream.ReadInt32L();
|
|
193 |
iAppUid = TUid::Uid( aStream.ReadInt32L() );
|
|
194 |
delete iAppName; iAppName = NULL;
|
|
195 |
iAppName = HBufC::NewL( aStream, KMaxTInt );
|
|
196 |
iCloseableApp = aStream.ReadInt32L();
|
|
197 |
TInt appIconBitmapHandle = aStream.ReadInt32L();
|
|
198 |
TInt appIconMaskHandle = aStream.ReadInt32L();
|
|
199 |
if ( appIconBitmapHandle != KErrNotFound )
|
|
200 |
{
|
|
201 |
iAppIconBitmap = new (ELeave) CFbsBitmap;
|
|
202 |
iAppIconBitmap->Duplicate( appIconBitmapHandle );
|
|
203 |
}
|
|
204 |
if ( appIconMaskHandle != KErrNotFound )
|
|
205 |
{
|
|
206 |
iAppIconMask = new (ELeave) CFbsBitmap;
|
|
207 |
iAppIconMask->Duplicate( appIconMaskHandle );
|
|
208 |
}
|
|
209 |
}
|
|
210 |
|
|
211 |
// --------------------------------------------------------------------------
|
|
212 |
// CTsFswEntry::ExternalizeArrayL
|
|
213 |
// --------------------------------------------------------------------------
|
|
214 |
//
|
|
215 |
void CTsFswEntry::ExternalizeArrayL( RWriteStream& aStream,
|
|
216 |
const RTsFswArray& aArray )
|
|
217 |
{
|
|
218 |
TInt count = aArray.Count();
|
|
219 |
aStream.WriteInt32L( count );
|
|
220 |
for ( TInt i = 0; i < count; ++i )
|
|
221 |
{
|
|
222 |
aArray[i]->ExternalizeL( aStream );
|
|
223 |
}
|
|
224 |
}
|
|
225 |
|
|
226 |
// --------------------------------------------------------------------------
|
|
227 |
// CTsFswEntry::InternalizeArrayL
|
|
228 |
// --------------------------------------------------------------------------
|
|
229 |
//
|
|
230 |
void CTsFswEntry::InternalizeArrayL( RReadStream& aStream,
|
|
231 |
RTsFswArray& aArray )
|
|
232 |
{
|
|
233 |
aArray.ResetAndDestroy();
|
|
234 |
TInt count = aStream.ReadInt32L(); for ( TInt i = 0; i < count; ++i )
|
|
235 |
{
|
|
236 |
CTsFswEntry* entry = CTsFswEntry::NewLC();
|
|
237 |
entry->InternalizeL( aStream );
|
|
238 |
aArray.AppendL( entry );
|
|
239 |
CleanupStack::Pop( entry );
|
|
240 |
}
|
|
241 |
}
|
|
242 |
|
|
243 |
// --------------------------------------------------------------------------
|
|
244 |
// CTsFswEntry::Type
|
|
245 |
// --------------------------------------------------------------------------
|
|
246 |
//
|
|
247 |
TAppType CTsFswEntry::Type() const
|
|
248 |
{
|
|
249 |
return EApp;
|
|
250 |
}
|
|
251 |
// end of file
|