|
1 /* |
|
2 * Copyright (c) 2006 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "ncdinstalloperationimpl.h" |
|
20 |
|
21 #include <s32mem.h> |
|
22 #include <f32file.h> |
|
23 #include <bautils.h> |
|
24 |
|
25 #include "catalogsbasemessage.h" |
|
26 #include "ncdnodemanager.h" |
|
27 #include "ncdnodeimpl.h" |
|
28 #include "ncdnodeidentifier.h" |
|
29 #include "catalogsutils.h" |
|
30 #include "catalogscontext.h" |
|
31 #include "ncdproviderdefines.h" |
|
32 #include "ncdnodeclassids.h" |
|
33 #include "catalogsconstants.h" |
|
34 #include "ncdinstallinfo.h" |
|
35 #include "ncdfileinfo.h" |
|
36 #include "ncdpurchasehistorydbimpl.h" |
|
37 #include "ncdutils.h" |
|
38 #include "ncderrors.h" |
|
39 #include "ncdoperationremovehandler.h" |
|
40 #include "ncdnodeinstallimpl.h" |
|
41 #include "ncdnodedownloadimpl.h" |
|
42 #include "ncdnodecontentinfoimpl.h" |
|
43 #include "ncdnodemetadataimpl.h" |
|
44 #include "ncdnodelink.h" |
|
45 #include "ncdproviderutils.h" |
|
46 #include "ncdpurchasehistoryutils.h" |
|
47 #include "ncdinstallreportobserver.h" |
|
48 #include "catalogsaccesspointmanager.h" |
|
49 #include "catalogsconnectionmethod.h" |
|
50 #include "catalogshttpconnectionmanager.h" |
|
51 #include "ncdgeneralmanager.h" |
|
52 |
|
53 #include "catalogsdebug.h" |
|
54 |
|
55 // ======== MEMBER FUNCTIONS ======== |
|
56 |
|
57 // --------------------------------------------------------------------------- |
|
58 // NewL |
|
59 // --------------------------------------------------------------------------- |
|
60 // |
|
61 CNcdInstallOperation* CNcdInstallOperation::NewL( |
|
62 MNcdOperationRemoveHandler& aRemoveHandler, |
|
63 const CNcdNodeIdentifier& aNodeId, |
|
64 CNcdGeneralManager& aGeneralManager, |
|
65 MCatalogsHttpSession& aHttpSession, |
|
66 MNcdInstallReportObserver& aReportObserver, |
|
67 MCatalogsSession& aSession ) |
|
68 { |
|
69 CNcdInstallOperation* self = new( ELeave ) CNcdInstallOperation( |
|
70 aRemoveHandler, |
|
71 aGeneralManager, |
|
72 aHttpSession, |
|
73 aReportObserver, |
|
74 aSession ); |
|
75 CleanupClosePushL( *self ); |
|
76 self->ConstructL( aNodeId ); |
|
77 |
|
78 CleanupStack::Pop(); |
|
79 return self; |
|
80 } |
|
81 |
|
82 |
|
83 // --------------------------------------------------------------------------- |
|
84 // Destructor |
|
85 // --------------------------------------------------------------------------- |
|
86 // |
|
87 CNcdInstallOperation::~CNcdInstallOperation() |
|
88 { |
|
89 DLTRACEIN(("")); |
|
90 |
|
91 delete iNodeId; |
|
92 |
|
93 // Deletes the JAD from disk and also deletes iJadFile |
|
94 DeleteJad(); |
|
95 DLTRACEOUT(("")); |
|
96 } |
|
97 |
|
98 // --------------------------------------------------------------------------- |
|
99 // Node Id getter |
|
100 // --------------------------------------------------------------------------- |
|
101 // |
|
102 const CNcdNodeIdentifier& CNcdInstallOperation::NodeIdentifier() const |
|
103 { |
|
104 return *iNodeId; |
|
105 } |
|
106 |
|
107 // --------------------------------------------------------------------------- |
|
108 // Cancel |
|
109 // --------------------------------------------------------------------------- |
|
110 // |
|
111 void CNcdInstallOperation::Cancel() |
|
112 { |
|
113 DLTRACEIN(( "" )); |
|
114 |
|
115 // Nothing to do here. Most of the install operation |
|
116 // functionality is in proxy side. |
|
117 |
|
118 DLTRACEOUT(( "" )); |
|
119 } |
|
120 |
|
121 |
|
122 // --------------------------------------------------------------------------- |
|
123 // Receive message |
|
124 // --------------------------------------------------------------------------- |
|
125 // |
|
126 void CNcdInstallOperation::ReceiveMessage( |
|
127 MCatalogsBaseMessage* aMessage, |
|
128 TInt aFunctionNumber ) |
|
129 { |
|
130 DLTRACEIN(("")); |
|
131 |
|
132 DASSERT( aMessage ); |
|
133 |
|
134 DLINFO(( "Handle: %i, aFunctionNumber=%d", |
|
135 aMessage->Handle(), |
|
136 aFunctionNumber)); |
|
137 |
|
138 // Now, we can be sure that rest of the time iMessage exists. |
|
139 // This member variable is set for the CounterPartLost function. |
|
140 iMessage = aMessage; |
|
141 |
|
142 TRAPD( err, DoReceiveMessageL( aMessage, aFunctionNumber ) ); |
|
143 |
|
144 if ( err != KErrNone ) |
|
145 { |
|
146 DLINFO(( ( "Error: %d" ), err )); |
|
147 CompleteMessage( iMessage, |
|
148 ENCDOperationMessageCompletionError, |
|
149 err ); |
|
150 } |
|
151 |
|
152 // Because the message should not be used after this, set it NULL. |
|
153 // So, CounterPartLost function will know that no messages are |
|
154 // waiting the response at the moment. |
|
155 iMessage = NULL; |
|
156 |
|
157 DLTRACEOUT(("")); |
|
158 } |
|
159 |
|
160 |
|
161 // --------------------------------------------------------------------------- |
|
162 // Counter part lost |
|
163 // --------------------------------------------------------------------------- |
|
164 // |
|
165 void CNcdInstallOperation::CounterPartLost( const MCatalogsSession& aSession ) |
|
166 { |
|
167 DLTRACEIN(("")); |
|
168 |
|
169 // This function may be called whenever -- when the message is waiting |
|
170 // response or when the message does not exist. |
|
171 // iMessage may be NULL here, because in the end of the |
|
172 // ReceiveMessage it is set to NULL. The life time of the message |
|
173 // ends shortly after CompleteAndRelease is called. |
|
174 if ( iMessage != NULL ) |
|
175 { |
|
176 iMessage->CounterPartLost( aSession ); |
|
177 } |
|
178 |
|
179 DLTRACEOUT(("")); |
|
180 } |
|
181 |
|
182 // --------------------------------------------------------------------------- |
|
183 // RunOperation |
|
184 // --------------------------------------------------------------------------- |
|
185 // |
|
186 TInt CNcdInstallOperation::RunOperation() |
|
187 { |
|
188 DLTRACEIN(( "Pending message: %X", iPendingMessage )); |
|
189 |
|
190 |
|
191 DLTRACEOUT(("")); |
|
192 return KErrNone; |
|
193 } |
|
194 |
|
195 |
|
196 // --------------------------------------------------------------------------- |
|
197 // Initializer |
|
198 // --------------------------------------------------------------------------- |
|
199 // |
|
200 TInt CNcdInstallOperation::Initialize() |
|
201 { |
|
202 DLTRACEIN( ( "" ) ); |
|
203 |
|
204 TRAPD( err, |
|
205 { |
|
206 DLTRACE(("Writing initialize response")); |
|
207 CBufBase* buf = CBufFlat::NewL( KBufExpandSize ); |
|
208 CleanupStack::PushL( buf ); |
|
209 |
|
210 RBufWriteStream stream( *buf ); |
|
211 CleanupClosePushL( stream ); |
|
212 |
|
213 // write completion code |
|
214 stream.WriteInt32L( ENCDOperationMessageCompletionInit ); |
|
215 |
|
216 // Get the file count from the node and return it to the proxy |
|
217 // Notice here that the node has to have some kind of metadata |
|
218 // in order the install operation to start. |
|
219 DLINFO(("Get the metadata of the node")); |
|
220 CNcdNode& node( iNodeManager->NodeL( *iNodeId ) ); |
|
221 CNcdNodeMetaData& metaData( node.NodeMetaDataL() ); |
|
222 DLINFO(("Get the install object of the metadata.")); |
|
223 CNcdNodeInstall& install( metaData.InstallL() ); |
|
224 stream.WriteInt32L( install.DownloadedFiles().MdcaCount() ); |
|
225 |
|
226 CleanupStack::PopAndDestroy( &stream ); |
|
227 |
|
228 DLINFO(("Create report")); |
|
229 // Because everything has gone smoothly so far, |
|
230 // create the install report for the server reports. |
|
231 CreateReportL(); |
|
232 |
|
233 DLTRACE(("Response length: %i", buf->Size() )); |
|
234 |
|
235 iPendingMessage->CompleteAndReleaseL( buf->Ptr(0), KErrNone ); |
|
236 iPendingMessage = NULL; |
|
237 CleanupStack::PopAndDestroy( buf ); |
|
238 }); |
|
239 |
|
240 if ( err != KErrNone ) |
|
241 { |
|
242 DLTRACE( ( "Err: %d", err ) ); |
|
243 iPendingMessage->CompleteAndRelease( err ); |
|
244 iPendingMessage = NULL; |
|
245 } |
|
246 DLTRACEOUT(( "err: %d", err )); |
|
247 return err; |
|
248 } |
|
249 |
|
250 |
|
251 // --------------------------------------------------------------------------- |
|
252 // Constructor |
|
253 // --------------------------------------------------------------------------- |
|
254 // |
|
255 CNcdInstallOperation::CNcdInstallOperation( |
|
256 MNcdOperationRemoveHandler& aRemoveHandler, |
|
257 CNcdGeneralManager& aGeneralManager, |
|
258 MCatalogsHttpSession& aHttpSession, |
|
259 MNcdInstallReportObserver& aReportObserver, |
|
260 MCatalogsSession& aSession ) : |
|
261 CNcdBaseOperation( aGeneralManager, &aRemoveHandler, EInstallOperation, aSession ), |
|
262 iHttpSession( aHttpSession ), |
|
263 iAccessPointManager( aGeneralManager.AccessPointManager() ), |
|
264 iReportObserver( aReportObserver ), |
|
265 iReportId( KNcdReportNotSupported ) |
|
266 { |
|
267 } |
|
268 |
|
269 |
|
270 // --------------------------------------------------------------------------- |
|
271 // ConstructL |
|
272 // --------------------------------------------------------------------------- |
|
273 // |
|
274 void CNcdInstallOperation::ConstructL( const CNcdNodeIdentifier& aNodeId ) |
|
275 { |
|
276 DLTRACEIN( ( "" ) ); |
|
277 // Call ConstructL for the base class |
|
278 CNcdBaseOperation::ConstructL(); |
|
279 |
|
280 // copy the identifier |
|
281 iNodeId = CNcdNodeIdentifier::NewL( aNodeId ); |
|
282 |
|
283 iInstallService = &CNcdProviderUtils::InstallationServiceL(); |
|
284 DLTRACEOUT(( "" )); |
|
285 } |
|
286 |
|
287 |
|
288 // --------------------------------------------------------------------------- |
|
289 // Gets info for an installable file from the node |
|
290 // --------------------------------------------------------------------------- |
|
291 // |
|
292 void CNcdInstallOperation::GetFileInfoL( MCatalogsBaseMessage& aMessage ) |
|
293 { |
|
294 DLTRACEIN(("")); |
|
295 TInt nextFile = ReadFileIndexL( aMessage ); |
|
296 |
|
297 CNcdNode& node( iNodeManager->NodeL( *iNodeId ) ); |
|
298 // Notice that in order the node to start install, the |
|
299 // node has to have some kind of metadata |
|
300 CNcdNodeMetaData& metaData( node.NodeMetaDataL() ); |
|
301 CNcdNodeDownload& nodeDl = metaData.DownloadL(); |
|
302 CNcdNodeInstall& install( metaData.InstallL() ); |
|
303 |
|
304 // Check that file index is in the valid range |
|
305 if ( nextFile < 0 || nextFile >= install.DownloadedFiles().MdcaCount() ) |
|
306 { |
|
307 DLERROR(("Invalid index")); |
|
308 User::Leave( KErrArgument ); |
|
309 } |
|
310 |
|
311 // Get item purpose |
|
312 TUint completePurpose = 0; |
|
313 TPtrC contentMime; |
|
314 |
|
315 DeleteJad(); |
|
316 |
|
317 TRAPD( error, |
|
318 { |
|
319 const CNcdNodeContentInfo& contentInfo = |
|
320 node.NodeMetaData()->ContentInfoL(); |
|
321 |
|
322 completePurpose = contentInfo.Purpose(); |
|
323 contentMime.Set( contentInfo.MimeType() ); |
|
324 DLINFO(( _L("Content mime: %S"), &contentMime )); |
|
325 }); |
|
326 |
|
327 LeaveIfNotErrorL( error, KErrNotFound ); |
|
328 |
|
329 // By default, use unknown purpose since installer |
|
330 // uses purpose for installing themes |
|
331 TNcdItemPurpose purpose = ENcdItemPurposeUnknown; |
|
332 |
|
333 // Check if the purpose includes theme or application |
|
334 if ( completePurpose & ENcdItemPurposeTheme ) |
|
335 { |
|
336 DLTRACE(("Purpose: Theme")); |
|
337 purpose = ENcdItemPurposeTheme; |
|
338 } |
|
339 else if ( completePurpose & ENcdItemPurposeApplication |
|
340 || completePurpose & ENcdItemPurposeGame |
|
341 || completePurpose & ENcdItemPurposeScreensaver ) |
|
342 { |
|
343 DLTRACE(("Purpose: Application")); |
|
344 purpose = ENcdItemPurposeApplication; |
|
345 } |
|
346 |
|
347 // Used to index downloadInfos. |
|
348 TInt downloadInfoIndex = nextFile; |
|
349 |
|
350 // This check used to be for handling rights objects that were not really |
|
351 // rights objects, eg. a picture given in the rights uri but now it has |
|
352 // been removed |
|
353 if ( install.DownloadedFiles().MdcaCount() > |
|
354 nodeDl.DownloadInfo().Count() ) |
|
355 { |
|
356 DLERROR(("Too many downloaded files, leaving with KErrCorrupt")); |
|
357 User::Leave( KErrCorrupt ); |
|
358 } |
|
359 |
|
360 DLTRACE(("File index: %d, downloadInfoIndex: %d", nextFile, downloadInfoIndex )); |
|
361 CNcdFileInfo* fileInfo = NULL; |
|
362 |
|
363 // Use normal install by default |
|
364 CNcdInstallInfo::TNcdInstallType installType = |
|
365 CNcdInstallInfo::ENcdInstallNormal; |
|
366 |
|
367 |
|
368 // Skip files that have not been downloaded or are already installed |
|
369 // Files that are downloaded are not skipped, doesn't matter |
|
370 // if they are installed or not |
|
371 while( nextFile < install.DownloadedFiles().MdcaCount() && |
|
372 ( !install.DownloadedFiles().MdcaPoint( nextFile ).Length() || |
|
373 // Check if file is missing and is installed, if it's missing |
|
374 // and not installed, we give an error by failing the installation |
|
375 // on proxy side when the file is missing |
|
376 ( !BaflUtils::FileExists( CNcdProviderUtils::FileSession(), |
|
377 install.DownloadedFiles().MdcaPoint( nextFile ) ) && ( |
|
378 install.IsContentInstalledL( nextFile, EFalse ) >= ENcdApplicationInstalled || |
|
379 // unless the file is launcher application which we can happily skip over |
|
380 IsOneOf( nodeDl.DownloadInfo()[ downloadInfoIndex ]->ContentUsage(), |
|
381 MNcdPurchaseDownloadInfo::ELauncher, |
|
382 MNcdPurchaseDownloadInfo::ELauncherOpen, |
|
383 MNcdPurchaseDownloadInfo::EConsumable ) ) ) ) ) |
|
384 { |
|
385 DLTRACE(("Skipping installed files or not downloaded files")); |
|
386 nextFile++; |
|
387 downloadInfoIndex++; |
|
388 } |
|
389 |
|
390 // We may have skipped over the last possible file so we have to |
|
391 // complete the operation |
|
392 if ( nextFile == install.DownloadedFiles().MdcaCount() ) |
|
393 { |
|
394 DLERROR(("Either nothing has been downloaded or everything is already installed")); |
|
395 HandleAllFilesInstalledL( nextFile, aMessage ); |
|
396 DLTRACEOUT(("Operation complete because all files have been installed")); |
|
397 return; |
|
398 } |
|
399 |
|
400 // Shortcut to correct download info |
|
401 MNcdPurchaseDownloadInfo* downloadInfo( |
|
402 nodeDl.DownloadInfo()[ downloadInfoIndex ] ); |
|
403 |
|
404 // Set dependency flag that we know not to update dependency/launcher |
|
405 iIsDependency = NcdPurchaseHistoryUtils::IsDependency( *downloadInfo ); |
|
406 |
|
407 |
|
408 DLINFO(( _L("Descriptor type: %S"), &downloadInfo->DescriptorType() )); |
|
409 DLINFO(( _L("Descriptor name: %S"), &downloadInfo->DescriptorName() )); |
|
410 DLINFO(( _L("Descriptor URI: %S"), &downloadInfo->DescriptorUri() )); |
|
411 |
|
412 |
|
413 if ( downloadInfo->ContentMimeType().MatchF( |
|
414 KMimeTypeMatch1JavaApplication ) != KErrNotFound || |
|
415 downloadInfo->ContentMimeType().MatchF( |
|
416 KMimeTypeMatch2JavaApplication ) != KErrNotFound || |
|
417 contentMime.MatchF( |
|
418 KMimeTypeMatch1JavaApplication ) != KErrNotFound || |
|
419 contentMime.MatchF( |
|
420 KMimeTypeMatch2JavaApplication ) != KErrNotFound ) |
|
421 |
|
422 { |
|
423 if ( downloadInfo->DescriptorType().CompareF( |
|
424 KDescriptorTypeJad ) == 0 ) |
|
425 { |
|
426 DLINFO(("Java app with JAD")); |
|
427 purpose = ENcdItemPurposeApplication; |
|
428 installType = CNcdInstallInfo::ENcdInstallJad; |
|
429 } |
|
430 else |
|
431 { |
|
432 DLINFO(("Java-application")); |
|
433 // Ensure that purpose is correct |
|
434 purpose = ENcdItemPurposeApplication; |
|
435 installType = CNcdInstallInfo::ENcdInstallJar; |
|
436 } |
|
437 } |
|
438 else if ( downloadInfo->ContentMimeType().MatchF( |
|
439 KMimeTypeMatchJad ) != KErrNotFound || |
|
440 contentMime.MatchF( KMimeTypeMatchJad ) != KErrNotFound ) |
|
441 { |
|
442 DLINFO(("Java app with JAD")); |
|
443 purpose = ENcdItemPurposeApplication; |
|
444 installType = CNcdInstallInfo::ENcdInstallJad; |
|
445 } |
|
446 |
|
447 |
|
448 DLTRACE(("Creating fileinfo")); |
|
449 // Create file info for proxy-side installer |
|
450 fileInfo = CNcdFileInfo::NewLC( |
|
451 install.DownloadedFiles().MdcaPoint( nextFile ), |
|
452 nodeDl.DownloadInfo()[ downloadInfoIndex ]->ContentMimeType(), |
|
453 purpose ); |
|
454 |
|
455 if ( installType == CNcdInstallInfo::ENcdInstallJad ) |
|
456 { |
|
457 DLINFO(( _L("Descriptor type: %S"), &downloadInfo->DescriptorType() )); |
|
458 DLINFO(( _L("Descriptor name: %S"), &downloadInfo->DescriptorName() )); |
|
459 DLINFO(( _L("Descriptor URI: %S"), &downloadInfo->DescriptorUri() )); |
|
460 DLINFO(( "Descriptor Data: %S", &downloadInfo->DescriptorData() )); |
|
461 if ( downloadInfo->DescriptorData().Length() ) |
|
462 { |
|
463 // This "if" is an ugly fix for embedded DD descriptors where |
|
464 // the .dm file is given in downloaddetails |
|
465 if ( !(downloadInfo->DescriptorType() == KDescriptorTypeOdd && |
|
466 downloadInfo->ContentUri().Length() ) ) |
|
467 { |
|
468 // Writing JAD to file on this side because proxies can't |
|
469 // write to engine's private dir |
|
470 if ( iJadFile ) |
|
471 { |
|
472 DeletePtr( iJadFile ); |
|
473 } |
|
474 iJadFile = |
|
475 CNcdProviderUtils::InstallationServiceL().WriteJadL( |
|
476 fileInfo->FilePath(), downloadInfo->DescriptorData() ); |
|
477 } |
|
478 } |
|
479 else |
|
480 { |
|
481 DLINFO(("No descriptor for JAD install")); |
|
482 } |
|
483 // Ensure that mime is JAD |
|
484 fileInfo->SetMimeTypeL( KMimeTypeMatchJad ); |
|
485 } |
|
486 |
|
487 |
|
488 CNcdInstallInfo* info = CNcdInstallInfo::NewL( fileInfo, |
|
489 installType ); |
|
490 CleanupStack::Pop( fileInfo ); |
|
491 CleanupStack::PushL( info ); |
|
492 info->SetIndex( nextFile ); |
|
493 |
|
494 MCatalogsBaseMessage* message = &aMessage; |
|
495 // Send the info back |
|
496 TInt err = CompleteMessage( |
|
497 message, |
|
498 ENCDOperationMessageCompletionComplete, |
|
499 *info, |
|
500 KErrNone ); |
|
501 |
|
502 CleanupStack::PopAndDestroy( info ); |
|
503 DLTRACEOUT(("err: %d", err)); |
|
504 } |
|
505 |
|
506 |
|
507 // --------------------------------------------------------------------------- |
|
508 // Completes the message correctly when all files have already been installed |
|
509 // --------------------------------------------------------------------------- |
|
510 // |
|
511 void CNcdInstallOperation::HandleAllFilesInstalledL( |
|
512 TInt aFinalIndex, MCatalogsBaseMessage& aMessage ) |
|
513 { |
|
514 DLTRACEIN(("")); |
|
515 CNcdInstallInfo* info = CNcdInstallInfo::NewL( NULL, |
|
516 CNcdInstallInfo::ENcdInstallNormal ); |
|
517 CleanupStack::PushL( info ); |
|
518 info->SetIndex( aFinalIndex ); |
|
519 |
|
520 MCatalogsBaseMessage* message = &aMessage; |
|
521 // Send the info back |
|
522 TInt err = CompleteMessage( |
|
523 message, |
|
524 ENCDOperationMessageCompletionComplete, |
|
525 *info, |
|
526 KErrNone ); |
|
527 CleanupStack::PopAndDestroy( info ); |
|
528 DLTRACEOUT(("Err: %d", err)); |
|
529 } |
|
530 |
|
531 |
|
532 // --------------------------------------------------------------------------- |
|
533 // Updates the info of an installed file |
|
534 // --------------------------------------------------------------------------- |
|
535 // |
|
536 void CNcdInstallOperation::UpdateInstalledFileInfoL( |
|
537 MCatalogsBaseMessage& aMessage ) |
|
538 { |
|
539 DLTRACEIN(("")); |
|
540 |
|
541 RCatalogsMessageReader reader; |
|
542 reader.OpenLC( aMessage ); |
|
543 |
|
544 // Read input message |
|
545 DLTRACE(("Reading file index")); |
|
546 TInt index = reader().ReadInt32L(); |
|
547 |
|
548 // Read the info from the stream |
|
549 CNcdFileInfo* info = CNcdFileInfo::NewLC( reader() ); |
|
550 |
|
551 // Read uids of installed applications |
|
552 TInt appUids = reader().ReadInt32L(); |
|
553 DLTRACE(( "Reading app uids: %d", appUids )); |
|
554 RArray<TUid> uids; |
|
555 CleanupClosePushL( uids ); |
|
556 uids.ReserveL( appUids ); |
|
557 while( appUids ) |
|
558 { |
|
559 uids.AppendL( TUid::Uid( reader().ReadInt32L() ) ); |
|
560 DLINFO(("Read UID: %x", uids[uids.Count() - 1] )); |
|
561 --appUids; |
|
562 } |
|
563 |
|
564 |
|
565 // Installed dependencies/upgrades are not updated to purchase history |
|
566 if ( !iIsDependency ) |
|
567 { |
|
568 //update purchase history with the info |
|
569 UpdatePurchaseHistoryL( *info, uids, |
|
570 aMessage.Session().Context().FamilyId() ); |
|
571 } |
|
572 |
|
573 CleanupStack::PopAndDestroy( 3, &reader ); // uids, info, reader |
|
574 |
|
575 DLTRACE(("Updating node from purchase history")); |
|
576 // Update node from the purchase history |
|
577 iNodeManager->InstallHandlerL( *iNodeId ); |
|
578 |
|
579 DLTRACE(("Completing message")); |
|
580 MCatalogsBaseMessage* message = &aMessage; |
|
581 TInt err = CompleteMessage( |
|
582 message, |
|
583 ENCDOperationMessageCompletionComplete, |
|
584 KErrNone ); |
|
585 |
|
586 DLTRACEOUT(("")); |
|
587 } |
|
588 |
|
589 |
|
590 void CNcdInstallOperation::CreateReportL() |
|
591 { |
|
592 DLTRACEIN(("")); |
|
593 CNcdNode& node( iNodeManager->NodeL( *iNodeId ) ); |
|
594 CNcdNodeMetaData& metaData( node.NodeMetaDataL() ); |
|
595 |
|
596 TNcdReportStatusInfo info( ENcdReportCreate, KErrNone ); |
|
597 // Use the node identifier to identify the content in install report. |
|
598 // Node id uniquely identifies the node that contains contents |
|
599 // that will be installed. One node may contains multiple contents but |
|
600 // they are all thought as one bundle, in one operation. Also, notice that |
|
601 // multiple nodes can contain same metadata and same content. |
|
602 |
|
603 /** |
|
604 * @ Get timestamp and purchase option id from purchase details and |
|
605 * set them to the report |
|
606 */ |
|
607 iReportId = |
|
608 iReportObserver.RegisterInstallL( |
|
609 iNodeId->NodeId(), |
|
610 metaData.Identifier(), |
|
611 info, |
|
612 metaData.Identifier().ServerUri(), |
|
613 metaData.Identifier().NodeNameSpace() ); |
|
614 |
|
615 // Access point is set when report is started. |
|
616 // Then base message is used to get required info. |
|
617 } |
|
618 |
|
619 |
|
620 void CNcdInstallOperation::StartReportL( MCatalogsBaseMessage& aMessage ) |
|
621 { |
|
622 DLTRACEIN(("")); |
|
623 // Set access point for report. |
|
624 UpdateReportAccessPointL( aMessage.Session().Context().FamilyId() ); |
|
625 |
|
626 TNcdReportStatusInfo info( ENcdReportStart, KErrNone ); |
|
627 iReportObserver.ReportInstallStatusL( |
|
628 iReportId, |
|
629 info ); |
|
630 |
|
631 // If this leaves, ReceiveMessge will complete the message. |
|
632 aMessage.CompleteAndRelease( KErrNone ); |
|
633 } |
|
634 |
|
635 |
|
636 void CNcdInstallOperation::CompleteReportL( MCatalogsBaseMessage& aMessage ) |
|
637 { |
|
638 DLTRACEIN(("")); |
|
639 RCatalogsMessageReader reader; |
|
640 reader.OpenLC( aMessage ); |
|
641 |
|
642 RReadStream& stream( reader() ); |
|
643 TInt errorCode( stream.ReadInt32L() ); |
|
644 |
|
645 CleanupStack::PopAndDestroy( &reader ); |
|
646 |
|
647 TNcdReportStatus status( ENcdReportSuccess ); |
|
648 if ( errorCode == KErrNone ) |
|
649 { |
|
650 status = ENcdReportSuccess; |
|
651 } |
|
652 else if ( errorCode == KErrCancel ) |
|
653 { |
|
654 status = ENcdReportCancel; |
|
655 } |
|
656 else |
|
657 { |
|
658 status = ENcdReportFail; |
|
659 } |
|
660 |
|
661 // Create the status info object with the given info. |
|
662 TNcdReportStatusInfo info( status, errorCode ); |
|
663 |
|
664 iReportObserver.ReportInstallStatusL( |
|
665 iReportId, |
|
666 info ); |
|
667 |
|
668 // If this leaves, ReceiveMessge will complete the message. |
|
669 aMessage.CompleteAndRelease( KErrNone ); |
|
670 } |
|
671 |
|
672 |
|
673 // --------------------------------------------------------------------------- |
|
674 // UpdateReportAccessPointL |
|
675 // --------------------------------------------------------------------------- |
|
676 // |
|
677 void CNcdInstallOperation::UpdateReportAccessPointL( const TUid& aClientUid ) |
|
678 { |
|
679 DLTRACEIN(("")); |
|
680 |
|
681 CNcdPurchaseHistoryDb& db = iNodeManager->PurchaseHistory(); |
|
682 CNcdNode& node( iNodeManager->NodeL( *iNodeId ) ); |
|
683 CNcdNodeMetaData& metadata( node.NodeMetaDataL() ); |
|
684 |
|
685 CNcdPurchaseDetails* purchase = |
|
686 NcdPurchaseHistoryUtils::PurchaseDetailsLC( |
|
687 db, |
|
688 aClientUid, |
|
689 metadata.Identifier(), |
|
690 EFalse ); |
|
691 |
|
692 // Create origin identifier |
|
693 CNcdNodeIdentifier* originIdentifier = |
|
694 CNcdNodeIdentifier::NewL( |
|
695 node.Identifier().NodeNameSpace(), |
|
696 purchase->OriginNodeId(), |
|
697 node.Identifier().ClientUid() ); |
|
698 |
|
699 CleanupStack::PopAndDestroy( purchase ); |
|
700 |
|
701 CleanupStack::PushL( originIdentifier ); |
|
702 |
|
703 // Get report ap |
|
704 TUint32 apId( 0 ); |
|
705 |
|
706 TInt error = |
|
707 iAccessPointManager.AccessPointIdL( |
|
708 *originIdentifier, |
|
709 MCatalogsAccessPointManager::EBrowse, |
|
710 aClientUid, |
|
711 apId ); |
|
712 |
|
713 TCatalogsConnectionMethod reportAp; |
|
714 if ( error == KErrNone ) |
|
715 { |
|
716 DLTRACE(( "Setting access point %d for reports", apId )) |
|
717 reportAp = |
|
718 TCatalogsConnectionMethod( |
|
719 apId, |
|
720 ECatalogsConnectionMethodTypeAccessPoint ); |
|
721 } |
|
722 |
|
723 if ( reportAp.iId == 0 ) |
|
724 { |
|
725 reportAp = iHttpSession.ConnectionManager().DefaultConnectionMethod(); |
|
726 } |
|
727 |
|
728 CleanupStack::PopAndDestroy( originIdentifier ); |
|
729 |
|
730 iReportObserver.SetInstallReportAccessPoint( |
|
731 iReportId, |
|
732 reportAp ); |
|
733 } |
|
734 |
|
735 |
|
736 // --------------------------------------------------------------------------- |
|
737 // Updates purchase history |
|
738 // --------------------------------------------------------------------------- |
|
739 // |
|
740 void CNcdInstallOperation::UpdatePurchaseHistoryL( const CNcdFileInfo& aInfo, |
|
741 const RArray<TUid>& aAppUids, const TUid& aClientUid ) |
|
742 { |
|
743 DLTRACEIN(("")); |
|
744 |
|
745 CNcdPurchaseHistoryDb& db = iNodeManager->PurchaseHistory(); |
|
746 CNcdNode& node( iNodeManager->NodeL( *iNodeId ) ); |
|
747 CNcdNodeMetaData& metadata( node.NodeMetaDataL() ); |
|
748 |
|
749 CNcdPurchaseDetails* purchase = NcdPurchaseHistoryUtils::PurchaseDetailsLC( |
|
750 db, |
|
751 aClientUid, |
|
752 metadata.Identifier(), |
|
753 EFalse ); |
|
754 |
|
755 |
|
756 CNcdPurchaseInstallInfo* installInfo = CNcdPurchaseInstallInfo::NewLC(); |
|
757 |
|
758 const CNcdNodeContentInfo* contentInfo = NULL; |
|
759 TRAPD( err, contentInfo = &metadata.ContentInfoL() ); |
|
760 |
|
761 LeaveIfNotErrorL( err, KErrNotFound ); |
|
762 |
|
763 if ( aAppUids.Count() ) |
|
764 { |
|
765 DLTRACE(("Updating installed application info")); |
|
766 // Use application UID from the protocol if it exists |
|
767 if ( contentInfo && contentInfo->Uid() != TUid::Null() ) |
|
768 { |
|
769 DLINFO(( "Using UID from Content info: %x", |
|
770 contentInfo->Uid().iUid )); |
|
771 installInfo->SetApplicationUid( contentInfo->Uid() ); |
|
772 } |
|
773 else |
|
774 { |
|
775 DLINFO(( "Using UID from installer: %x", aAppUids[0].iUid )); |
|
776 installInfo->SetApplicationUid( aAppUids[0] ); |
|
777 } |
|
778 |
|
779 // Theme version number's are not updated from sis registry |
|
780 if ( aInfo.Purpose() != ENcdItemPurposeTheme && |
|
781 aInfo.FilePath().Length() ) |
|
782 { |
|
783 DLTRACE(( _L("Got version number from sis registry: %S"), |
|
784 &aInfo.FilePath() )); |
|
785 |
|
786 installInfo->SetApplicationVersionL( |
|
787 aInfo.FilePath() ); |
|
788 } |
|
789 else if ( contentInfo ) |
|
790 { |
|
791 DLTRACE(("Content info exists")); |
|
792 // Use application version from the protocol |
|
793 DLINFO(( _L("Setting app version: %S"), |
|
794 &contentInfo->Version() )); |
|
795 installInfo->SetApplicationVersionL( |
|
796 contentInfo->Version() ); |
|
797 } |
|
798 |
|
799 } |
|
800 else if ( aInfo.Purpose() == ENcdItemPurposeTheme ) |
|
801 { |
|
802 DLTRACE(("Updating installed theme info")); |
|
803 installInfo->SetThemeNameL( aInfo.FilePath() ); |
|
804 } |
|
805 else |
|
806 { |
|
807 DLTRACE(("Updating installed content info")); |
|
808 DLINFO(( _L("Installed file: %S"), &aInfo.FilePath() )); |
|
809 |
|
810 // Save the filename |
|
811 installInfo->SetFilenameL( aInfo.FilePath() ); |
|
812 } |
|
813 |
|
814 // update purpose to purchase history |
|
815 |
|
816 // if purpose in content info was unknown, we use the one gotten from installer |
|
817 // since it may have been updated to something more specific |
|
818 if ( contentInfo && contentInfo->Purpose() != ENcdItemPurposeUnknown ) |
|
819 { |
|
820 TUint newPurpose = contentInfo->Purpose(); |
|
821 if ( aInfo.Purpose() == ENcdItemPurposeApplication ) |
|
822 { |
|
823 // This ensures that games etc. stuff that were installed like |
|
824 // applications, are also handled like applications |
|
825 newPurpose |= ENcdItemPurposeApplication; |
|
826 } |
|
827 DLTRACE(("Setting purpose as %d", newPurpose)); |
|
828 purchase->SetItemPurpose( newPurpose ); |
|
829 } |
|
830 else |
|
831 { |
|
832 // backup in case we didn't get content info for some reason |
|
833 DLINFO(("Didn't get ContentInfo, updating purpose from FileInfo")); |
|
834 purchase->SetItemPurpose( purchase->ItemPurpose() | aInfo.Purpose() ); |
|
835 } |
|
836 |
|
837 DLINFO(("Item purpose: %d", purchase->ItemPurpose() )); |
|
838 // Add install info to purchase details. Ownership is transferred |
|
839 |
|
840 if ( ReplaceInstallInfoL( *purchase, *installInfo ) ) |
|
841 { |
|
842 CleanupStack::PopAndDestroy( installInfo ); |
|
843 } |
|
844 else |
|
845 { |
|
846 DLTRACE(("Adding install info to purchase details")); |
|
847 purchase->AddInstallInfoL( installInfo ); |
|
848 CleanupStack::Pop( installInfo ); |
|
849 } |
|
850 |
|
851 DLTRACE(("Saving purchase details")); |
|
852 db.SavePurchaseL( *purchase, EFalse ); |
|
853 CleanupStack::PopAndDestroy( purchase ); |
|
854 |
|
855 DLTRACEOUT(("")); |
|
856 } |
|
857 |
|
858 |
|
859 // --------------------------------------------------------------------------- |
|
860 // Checks if the details already contain a matching info |
|
861 // --------------------------------------------------------------------------- |
|
862 // |
|
863 TBool CNcdInstallOperation::ReplaceInstallInfoL( |
|
864 MNcdPurchaseDetails& aDetails, |
|
865 const MNcdPurchaseInstallInfo& aInfo ) |
|
866 { |
|
867 DLTRACEIN(("")); |
|
868 TArray< MNcdPurchaseInstallInfo* > installInfos( |
|
869 aDetails.InstallInfoL() ); |
|
870 |
|
871 TParsePtrC path( aInfo.Filename() ); |
|
872 TPtrC installedFile( path.NameAndExt() ); |
|
873 DLTRACE(("Going through %d install infos", installInfos.Count() )); |
|
874 for ( TInt i = 0; i < installInfos.Count(); ++i ) |
|
875 { |
|
876 MNcdPurchaseInstallInfo& oldInfo( *installInfos[ i ] ); |
|
877 |
|
878 if ( ( oldInfo.ApplicationUid() == aInfo.ApplicationUid() && |
|
879 oldInfo.ApplicationVersion() == aInfo.ApplicationVersion() && |
|
880 oldInfo.ThemeName() == aInfo.ThemeName() ) || |
|
881 // also replace empty infos, hopefully this doesn't break anything |
|
882 // because this is needed in order to correctly handle cancelled |
|
883 // theme installations or more spefically successful theme installations |
|
884 // after a cancelled theme installation |
|
885 ( oldInfo.ApplicationUid() == KNullUid && |
|
886 oldInfo.ApplicationVersion() == KNullDesC && |
|
887 // replace the old info if theme name is empty or if the old theme name |
|
888 // is not empty but the new info is entirely empty == reinstalling a theme |
|
889 ( oldInfo.ThemeName() == KNullDesC || |
|
890 ( aInfo.ApplicationUid() == KNullUid && |
|
891 aInfo.ApplicationVersion() == KNullDesC && |
|
892 aInfo.ThemeName() == KNullDesC ) ) ) ) |
|
893 |
|
894 { |
|
895 // Parse the filename from the file path |
|
896 TParsePtrC oldPath( oldInfo.Filename() ); |
|
897 if ( oldPath.NameAndExt() == installedFile ) |
|
898 { |
|
899 DLTRACEOUT(("Info already exists")); |
|
900 |
|
901 // Update the filename in case the file has been installed |
|
902 // to a different drive than before |
|
903 CNcdPurchaseInstallInfo* modInfo = |
|
904 static_cast<CNcdPurchaseInstallInfo*>( installInfos[i] ); |
|
905 |
|
906 // This updates the theme name in the following case: |
|
907 // 1. theme was already installed when bought and installed with the client |
|
908 // 2. user uninstalled the theme |
|
909 // 3. user downloaded and installed the theme again |
|
910 if ( oldInfo.ThemeName() == KNullDesC ) |
|
911 { |
|
912 modInfo->SetThemeNameL( aInfo.ThemeName() ); |
|
913 } |
|
914 modInfo->SetFilenameL( aInfo.Filename() ); |
|
915 return ETrue; |
|
916 } |
|
917 } |
|
918 } |
|
919 |
|
920 // This tries to update an existing java app uid when we are reinstalling |
|
921 // java apps |
|
922 TArray< MNcdPurchaseDownloadInfo* > downloadInfos( |
|
923 aDetails.DownloadInfoL() ); |
|
924 |
|
925 if ( installInfos.Count() && |
|
926 aInfo.ApplicationUid() != KNullUid && |
|
927 downloadInfos.Count() >= installInfos.Count() ) |
|
928 { |
|
929 TBool isJava = EFalse; |
|
930 for ( TInt i = 0; i < downloadInfos.Count(); ++i ) |
|
931 { |
|
932 if ( IsJava( downloadInfos[i]->ContentMimeType(), ETrue ) ) |
|
933 { |
|
934 isJava = ETrue; |
|
935 break; |
|
936 } |
|
937 } |
|
938 |
|
939 if ( !isJava ) |
|
940 { |
|
941 DLTRACEOUT(("No java app")); |
|
942 return EFalse; |
|
943 } |
|
944 |
|
945 DLTRACE(("Update the uid of the first existing app")); |
|
946 for ( TInt i = 0; i < installInfos.Count(); ++i ) |
|
947 { |
|
948 MNcdPurchaseInstallInfo& oldInfo( *installInfos[ i ] ); |
|
949 if ( oldInfo.ApplicationUid() != KNullUid ) |
|
950 { |
|
951 DLTRACE(("Updating application uid from %x to %x", |
|
952 oldInfo.ApplicationUid(), aInfo.ApplicationUid() )); |
|
953 // Update the app uid for java app |
|
954 CNcdPurchaseInstallInfo* modInfo = |
|
955 static_cast<CNcdPurchaseInstallInfo*>( installInfos[i] ); |
|
956 |
|
957 modInfo->SetApplicationUid( aInfo.ApplicationUid() ); |
|
958 modInfo->SetApplicationVersionL( aInfo.ApplicationVersion() ); |
|
959 return ETrue; |
|
960 } |
|
961 } |
|
962 } |
|
963 |
|
964 return EFalse; |
|
965 } |
|
966 |
|
967 |
|
968 // --------------------------------------------------------------------------- |
|
969 // Checks if the given mime type matches a java app |
|
970 // --------------------------------------------------------------------------- |
|
971 // |
|
972 TBool CNcdInstallOperation::IsJava( |
|
973 const TDesC& aMimeType, |
|
974 TBool aAcceptJad ) const |
|
975 { |
|
976 DLTRACEIN(( _L("aMimeType: %S"), &aMimeType )); |
|
977 |
|
978 TBool matches = aMimeType.MatchF( KMimeTypeMatch1JavaApplication ) != KErrNotFound || |
|
979 aMimeType.MatchF( KMimeTypeMatch2JavaApplication ) != KErrNotFound; |
|
980 |
|
981 if ( !matches && aAcceptJad ) |
|
982 { |
|
983 matches = aMimeType.MatchF( KMimeTypeMatchJad ) != KErrNotFound; |
|
984 } |
|
985 DLTRACEOUT(("Matched: %d", matches)); |
|
986 return matches; |
|
987 } |
|
988 |
|
989 |
|
990 // --------------------------------------------------------------------------- |
|
991 // Gets the path to the file indexed by the message |
|
992 // --------------------------------------------------------------------------- |
|
993 // |
|
994 HBufC* CNcdInstallOperation::FilePathLC( |
|
995 MCatalogsBaseMessage& aMessage ) |
|
996 { |
|
997 DLTRACEIN(("")); |
|
998 TInt fileIndex = ReadFileIndexL( aMessage ); |
|
999 |
|
1000 CNcdNode& node( iNodeManager->NodeL( *iNodeId ) ); |
|
1001 // Notice that in order the node to start install, the |
|
1002 // node has to have some kind of metadata |
|
1003 CNcdNodeMetaData& metaData( node.NodeMetaDataL() ); |
|
1004 CNcdNodeInstall& install( metaData.InstallL() ); |
|
1005 |
|
1006 // Check that file index is in the valid range |
|
1007 if ( fileIndex < 0 || fileIndex >= install.DownloadedFiles().MdcaCount() ) |
|
1008 { |
|
1009 DLERROR(("Invalid index: %d", fileIndex )); |
|
1010 User::Leave( KErrArgument ); |
|
1011 } |
|
1012 |
|
1013 DLTRACEOUT(( _L("Filepath %S from index: %d"), |
|
1014 &install.DownloadedFiles().MdcaPoint( fileIndex ), fileIndex )); |
|
1015 |
|
1016 return install.DownloadedFiles().MdcaPoint( fileIndex ).AllocLC(); |
|
1017 } |
|
1018 |
|
1019 |
|
1020 // --------------------------------------------------------------------------- |
|
1021 // Opens a file |
|
1022 // --------------------------------------------------------------------------- |
|
1023 // |
|
1024 void CNcdInstallOperation::OpenFileL( |
|
1025 MCatalogsBaseMessage& aMessage ) |
|
1026 { |
|
1027 DLTRACEIN(("")); |
|
1028 RFs fs; |
|
1029 User::LeaveIfError( fs.Connect() ); |
|
1030 CleanupClosePushL( fs ); |
|
1031 |
|
1032 DLTRACE(("Sharing the file server")); |
|
1033 User::LeaveIfError( fs.ShareProtected() ); |
|
1034 |
|
1035 DLTRACE(("Trying to open the file")); |
|
1036 RFile file; |
|
1037 CleanupClosePushL( file ); |
|
1038 |
|
1039 // Ugly hackfix for handling JADs |
|
1040 if ( iJadFile ) |
|
1041 { |
|
1042 User::LeaveIfError( file.Open( fs, |
|
1043 *iJadFile, |
|
1044 NcdProviderDefines::KNcdSharableFileOpenFlags ) ); |
|
1045 } |
|
1046 else |
|
1047 { |
|
1048 HBufC* path = FilePathLC( aMessage ); |
|
1049 User::LeaveIfError( file.Open( fs, |
|
1050 *path, |
|
1051 NcdProviderDefines::KNcdSharableFileOpenFlags ) ); |
|
1052 CleanupStack::PopAndDestroy( path ); |
|
1053 } |
|
1054 DLTRACE(("File open, transferring to client")); |
|
1055 |
|
1056 aMessage.CompleteAndReleaseL( fs, file ); |
|
1057 |
|
1058 DLTRACE(("File transferred")); |
|
1059 CleanupStack::PopAndDestroy( 2, &fs ); // file, fs |
|
1060 } |
|
1061 |
|
1062 |
|
1063 // --------------------------------------------------------------------------- |
|
1064 // Does the actual message handling |
|
1065 // --------------------------------------------------------------------------- |
|
1066 // |
|
1067 void CNcdInstallOperation::DoReceiveMessageL( |
|
1068 MCatalogsBaseMessage* aMessage, |
|
1069 TInt aFunctionNumber ) |
|
1070 { |
|
1071 DLTRACEIN(("")); |
|
1072 switch ( aFunctionNumber ) |
|
1073 { |
|
1074 case ENCDOperationFunctionGetData: |
|
1075 { |
|
1076 GetFileInfoL( *aMessage ); |
|
1077 break; |
|
1078 } |
|
1079 |
|
1080 case ENCDOperationFunctionSetData: |
|
1081 { |
|
1082 UpdateInstalledFileInfoL( *aMessage ); |
|
1083 break; |
|
1084 } |
|
1085 |
|
1086 case ENcdOperationFunctionOpenFile: |
|
1087 { |
|
1088 OpenFileL( *aMessage ); |
|
1089 break; |
|
1090 } |
|
1091 |
|
1092 case ENcdOperationFunctionDeleteFile: |
|
1093 { |
|
1094 DeleteFileL( *aMessage ); |
|
1095 break; |
|
1096 } |
|
1097 |
|
1098 case ENCDOperationFunctionReportStart: |
|
1099 { |
|
1100 StartReportL( *aMessage ); |
|
1101 break; |
|
1102 } |
|
1103 |
|
1104 case ENCDOperationFunctionReportComplete: |
|
1105 { |
|
1106 CompleteReportL( *aMessage ); |
|
1107 break; |
|
1108 } |
|
1109 |
|
1110 default: |
|
1111 { |
|
1112 DLTRACE(("Calling baseclass")); |
|
1113 // Call implementation in the base class |
|
1114 CNcdBaseOperation::ReceiveMessage( aMessage, aFunctionNumber ); |
|
1115 break; |
|
1116 } |
|
1117 } |
|
1118 DLTRACEOUT(("")); |
|
1119 } |
|
1120 |
|
1121 |
|
1122 // --------------------------------------------------------------------------- |
|
1123 // Deletes a file index by the message. Also JAD is deleted if necessary |
|
1124 // --------------------------------------------------------------------------- |
|
1125 // |
|
1126 void CNcdInstallOperation::DeleteFileL( MCatalogsBaseMessage& aMessage ) |
|
1127 { |
|
1128 DLTRACEIN(("")); |
|
1129 HBufC* path = FilePathLC( aMessage ); |
|
1130 // Delete installed SIS/JAR/content file |
|
1131 User::LeaveIfError( iInstallService->DeleteFile( *path ) ); |
|
1132 |
|
1133 CleanupStack::PopAndDestroy( path ); |
|
1134 // If we installed JAD+JAR we must delete JAD separately. |
|
1135 DeleteJad(); |
|
1136 |
|
1137 aMessage.CompleteAndReleaseL( KErrNone, KErrNone ); |
|
1138 } |
|
1139 |
|
1140 |
|
1141 // --------------------------------------------------------------------------- |
|
1142 // Reads a file index from the message |
|
1143 // --------------------------------------------------------------------------- |
|
1144 // |
|
1145 TInt CNcdInstallOperation::ReadFileIndexL( MCatalogsBaseMessage& aMessage ) |
|
1146 { |
|
1147 RCatalogsMessageReader reader; |
|
1148 reader.OpenLC( aMessage ); |
|
1149 |
|
1150 // Read the requested file index |
|
1151 TInt fileIndex = reader().ReadInt32L(); |
|
1152 CleanupStack::PopAndDestroy( &reader ); |
|
1153 return fileIndex; |
|
1154 } |
|
1155 |
|
1156 |
|
1157 // --------------------------------------------------------------------------- |
|
1158 // Deletes JAD from disk and the filename |
|
1159 // --------------------------------------------------------------------------- |
|
1160 // |
|
1161 void CNcdInstallOperation::DeleteJad() |
|
1162 { |
|
1163 DLTRACEIN(("")); |
|
1164 |
|
1165 if ( iJadFile && iInstallService ) |
|
1166 { |
|
1167 // Error is ignored because we can't handle disk errors in |
|
1168 // any special way and other errors will make themselves known |
|
1169 // anyway |
|
1170 iInstallService->DeleteFile( *iJadFile ); |
|
1171 } |
|
1172 |
|
1173 DeletePtr( iJadFile ); |
|
1174 } |