1 /* |
1 /* |
2 * Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
31 #include "ncdproviderutils.h" |
31 #include "ncdproviderutils.h" |
32 #include "ncdinstallationservice.h" |
32 #include "ncdinstallationservice.h" |
33 #include "ncdpurchasedetails.h" |
33 #include "ncdpurchasedetails.h" |
34 |
34 |
35 #include "catalogsdebug.h" |
35 #include "catalogsdebug.h" |
|
36 #include "catalogsconstants.h" |
|
37 |
36 |
38 |
37 CNcdNodeContentInfo::CNcdNodeContentInfo( NcdNodeClassIds::TNcdNodeClassId aClassId ) |
39 CNcdNodeContentInfo::CNcdNodeContentInfo( NcdNodeClassIds::TNcdNodeClassId aClassId ) |
38 : CNcdCommunicable(), |
40 : CNcdCommunicable(), |
39 iClassId( aClassId ) |
41 iClassId( aClassId ) |
40 { |
42 { |
192 else |
206 else |
193 { |
207 { |
194 iPurpose |= ENcdItemPurposeUnknown; |
208 iPurpose |= ENcdItemPurposeUnknown; |
195 } |
209 } |
196 } |
210 } |
197 |
|
198 iMimeType = aData.DownloadableContent()->Mime().AllocL(); |
211 iMimeType = aData.DownloadableContent()->Mime().AllocL(); |
199 |
212 |
200 if ( iPurpose & ENcdItemPurposeApplication ) |
213 if ( iPurpose & ENcdItemPurposeApplication ) |
201 { |
214 { |
202 TInt uid = 0; |
215 if ( iMimeType->Compare(KMimeTypeMatchSisx) == 0 ) |
203 TRAPD( err, uid = DesHexToIntL( aData.DownloadableContent()->Id() ) ); |
216 { |
204 if( err != KErrNone ) |
217 // sis package, convert the string to uid |
205 { |
218 TInt uid = 0; |
206 DLERROR(( _L("DownloadableContent()->Id() was not valid hex, using ZERO: %S"), |
219 TRAPD( err, uid = DesHexToIntL( aData.DownloadableContent()->Id() ) ); |
207 &aData.DownloadableContent()->Id() )); |
220 if( err != KErrNone ) |
208 iUid.iUid = 0; |
221 { |
209 } |
222 DLERROR(( _L("DownloadableContent()->Id() was not valid hex, using ZERO: %S"), |
210 else |
223 &aData.DownloadableContent()->Id() )); |
211 { |
224 iUid.iUid = 0; |
212 iUid.iUid = uid; |
225 } |
|
226 else |
|
227 { |
|
228 iUid.iUid = uid; |
|
229 } |
|
230 } |
|
231 |
|
232 if ( iMimeType->Compare( KMimeTypeMatchWidget ) == 0 ) |
|
233 { |
|
234 // widget, save identifier |
|
235 iIdentifier = aData.DownloadableContent()->Id().AllocL(); |
213 } |
236 } |
214 } |
237 } |
215 |
238 |
216 iVersion = aData.DownloadableContent()->Version().AllocL(); |
239 iVersion = aData.DownloadableContent()->Version().AllocL(); |
217 iSize = aData.DownloadableContent()->Size(); |
240 iSize = aData.DownloadableContent()->Size(); |
228 |
251 |
229 aStream.WriteInt32L( ClassId() ); |
252 aStream.WriteInt32L( ClassId() ); |
230 |
253 |
231 aStream.WriteUint16L( iPurpose ); |
254 aStream.WriteUint16L( iPurpose ); |
232 ExternalizeDesL( *iMimeType, aStream ); |
255 ExternalizeDesL( *iMimeType, aStream ); |
233 aStream.WriteInt32L( iUid.iUid ); |
256 |
|
257 // The code here must be sync with the Internalization code in CNcdNodeContentInfoProxy |
|
258 if ( iMimeType->Compare( KMimeTypeMatchWidget ) == 0 ) |
|
259 { |
|
260 ExternalizeDesL( *iIdentifier, aStream ); |
|
261 } |
|
262 else |
|
263 { |
|
264 aStream.WriteInt32L( iUid.iUid ); |
|
265 } |
|
266 |
234 ExternalizeDesL( *iVersion, aStream ); |
267 ExternalizeDesL( *iVersion, aStream ); |
235 aStream.WriteInt32L( iSize ); |
268 aStream.WriteInt32L( iSize ); |
236 |
269 |
237 DLTRACEOUT(("")); |
270 DLTRACEOUT(("")); |
238 } |
271 } |
253 User::Leave( KErrCorrupt ); |
286 User::Leave( KErrCorrupt ); |
254 } |
287 } |
255 |
288 |
256 iPurpose = aStream.ReadUint16L(); |
289 iPurpose = aStream.ReadUint16L(); |
257 InternalizeDesL( iMimeType, aStream ); |
290 InternalizeDesL( iMimeType, aStream ); |
258 iUid.iUid = aStream.ReadInt32L(); |
291 |
|
292 // This Internalize function is called when the node is loaded from cache. RReadStream is a sign of that. |
|
293 // So same logic here also. Check mimetype and then decide to save uid or identifier. |
|
294 if ( iMimeType->Compare( KMimeTypeMatchWidget ) == 0 ) |
|
295 { |
|
296 InternalizeDesL( iIdentifier, aStream ); |
|
297 } |
|
298 else |
|
299 { |
|
300 iUid.iUid = aStream.ReadInt32L(); |
|
301 } |
|
302 |
259 InternalizeDesL( iVersion, aStream ); |
303 InternalizeDesL( iVersion, aStream ); |
260 iSize = aStream.ReadInt32L(); |
304 iSize = aStream.ReadInt32L(); |
261 |
305 |
262 DLTRACEOUT(("")); |
306 DLTRACEOUT(("")); |
263 } |
307 } |