1 /* |
1 /* |
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2005-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". |
17 |
17 |
18 |
18 |
19 // INCLUDE FILES |
19 // INCLUDE FILES |
20 #include <s32mem.h> // For RBufWriteStream |
20 #include <s32mem.h> // For RBufWriteStream |
21 #include <utf.h> // for CnvUtfConverter |
21 #include <utf.h> // for CnvUtfConverter |
22 //#include <pathinfo.h> |
22 #include <usif/usifcommon.h> |
23 #include <usif/sif/sifcommon.h> |
23 #include <usif/scr/scr.h> |
|
24 #include <driveinfo.h> |
24 |
25 |
25 using namespace Usif; |
26 using namespace Usif; |
26 |
27 |
27 #include "debug.h" |
28 #include "debug.h" |
28 #include "sconinstaller.h" |
29 #include "sconinstaller.h" |
29 #include "sconpcdconsts.h" |
30 #include "sconpcdconsts.h" |
30 #include "sconpcdutility.h" |
|
31 |
|
32 |
31 |
33 const TInt KSConSeConUidValue = 0x101f99f6; |
32 const TInt KSConSeConUidValue = 0x101f99f6; |
34 const TUid KSConSeConUid = {KSConSeConUidValue}; |
33 const TUid KSConSeConUid = {KSConSeConUidValue}; |
35 |
34 |
36 _LIT8(KValSep, "="); |
35 _LIT8(KValSep, "="); |
192 // ----------------------------------------------------------------------------- |
191 // ----------------------------------------------------------------------------- |
193 // |
192 // |
194 void CSConAppInstaller::DoCancel() |
193 void CSConAppInstaller::DoCancel() |
195 { |
194 { |
196 TRACE_FUNC_ENTRY; |
195 TRACE_FUNC_ENTRY; |
197 |
|
198 LOGGER_WRITE("Cancel iSwInstaller"); |
196 LOGGER_WRITE("Cancel iSwInstaller"); |
199 iSwInstaller.CancelOperation(); |
197 iSwInstaller.CancelOperation(); |
200 /* |
|
201 // find and complete current task |
|
202 CSConTask* task = NULL; |
|
203 TInt ret = iQueue->GetTask( iCurrentTask, task ); |
|
204 |
|
205 if ( iCurrentTask > 0 && ret != KErrNotFound ) |
|
206 { |
|
207 |
|
208 switch( task->GetServiceId() ) |
|
209 { |
|
210 case EInstall : |
|
211 iQueue->CompleteTask( iCurrentTask, KErrCancel ); |
|
212 break; |
|
213 case EUninstall : |
|
214 iQueue->CompleteTask( iCurrentTask, KErrCancel ); |
|
215 break; |
|
216 default : |
|
217 break; |
|
218 } |
|
219 } |
|
220 */ |
|
221 TRACE_FUNC_EXIT; |
198 TRACE_FUNC_EXIT; |
222 } |
199 } |
223 |
200 |
224 // ----------------------------------------------------------------------------- |
201 // ----------------------------------------------------------------------------- |
225 // CSConAppInstaller::RunL() |
202 // CSConAppInstaller::RunL() |
273 CleanupClosePushL( stream ); |
250 CleanupClosePushL( stream ); |
274 |
251 |
275 ExternalizeResultArrayIntValL( KSifOutParam_ComponentId , stream); |
252 ExternalizeResultArrayIntValL( KSifOutParam_ComponentId , stream); |
276 ExternalizeResultIntValL( KSifOutParam_ErrCategory , stream); |
253 ExternalizeResultIntValL( KSifOutParam_ErrCategory , stream); |
277 ExternalizeResultIntValL( KSifOutParam_ErrCode , stream); |
254 ExternalizeResultIntValL( KSifOutParam_ErrCode , stream); |
278 ExternalizeResultIntValL( KSifOutParam_ExtendedErrCode , stream); |
255 //ExternalizeResultIntValL( KSifOutParam_ExtendedErrCode , stream); |
279 ExternalizeResultStringValL( KSifOutParam_ErrMessage , stream); |
256 ExternalizeResultStringValL( KSifOutParam_ErrMessage , stream); |
280 ExternalizeResultStringValL( KSifOutParam_ErrMessageDetails , stream); |
257 ExternalizeResultStringValL( KSifOutParam_ErrMessageDetails , stream); |
281 |
258 |
282 stream.CommitL(); |
259 stream.CommitL(); |
283 |
260 |
412 if ( aInstallParams.iMode == ESilentInstall ) |
389 if ( aInstallParams.iMode == ESilentInstall ) |
413 { |
390 { |
414 LOGGER_WRITE( "Begin silent installation.. " ); |
391 LOGGER_WRITE( "Begin silent installation.. " ); |
415 |
392 |
416 iSifOptions->AddIntL( Usif::KSifInParam_InstallSilently, ETrue ); |
393 iSifOptions->AddIntL( Usif::KSifInParam_InstallSilently, ETrue ); |
417 iSifOptions->AddIntL( Usif::KSifInParam_PerformOCSP, EFalse ); |
394 iSifOptions->AddIntL( Usif::KSifInParam_PerformOCSP, Usif::ENotAllowed ); |
418 // Note if upgrade is allowed, see NeedsInstallingL function. |
395 // Note if upgrade is allowed, see NeedsInstallingL function. |
419 iSifOptions->AddIntL( Usif::KSifInParam_AllowUpgrade, ETrue ); |
396 iSifOptions->AddIntL( Usif::KSifInParam_AllowUpgrade, Usif::EAllowed ); |
420 iSifOptions->AddIntL( Usif::KSifInParam_AllowUntrusted, EFalse ); |
397 iSifOptions->AddIntL( Usif::KSifInParam_AllowUntrusted, Usif::ENotAllowed ); |
421 iSifOptions->AddIntL( Usif::KSifInParam_GrantCapabilities, EFalse ); |
398 iSifOptions->AddIntL( Usif::KSifInParam_GrantCapabilities, Usif::ENotAllowed ); |
422 // Defined for the install. |
399 // Defined for the install. |
423 iSifOptions->AddIntL( Usif::KSifInParam_InstallOptionalItems, ETrue ); |
400 iSifOptions->AddIntL( Usif::KSifInParam_InstallOptionalItems, Usif::EAllowed ); |
424 iSifOptions->AddIntL( Usif::KSifInParam_IgnoreOCSPWarnings, ETrue ); |
401 iSifOptions->AddIntL( Usif::KSifInParam_IgnoreOCSPWarnings, Usif::EAllowed ); |
425 iSifOptions->AddIntL( Usif::KSifInParam_AllowAppShutdown, ETrue ); |
402 iSifOptions->AddIntL( Usif::KSifInParam_AllowAppShutdown, Usif::EAllowed ); |
426 iSifOptions->AddIntL( Usif::KSifInParam_AllowDownload, ETrue ); |
403 iSifOptions->AddIntL( Usif::KSifInParam_AllowDownload, Usif::EAllowed ); |
427 iSifOptions->AddIntL( Usif::KSifInParam_AllowOverwrite, ETrue ); |
404 iSifOptions->AddIntL( Usif::KSifInParam_AllowOverwrite, Usif::EAllowed ); |
428 |
405 |
429 iSwInstaller.Install( aInstallParams.iPath, *iSifOptions, |
406 iSwInstaller.Install( aInstallParams.iPath, *iSifOptions, |
430 *iSifResults, iStatus, ETrue ); |
407 *iSifResults, iStatus, ETrue ); |
431 } |
408 } |
432 else |
409 else |
486 TRACE_FUNC_ENTRY; |
463 TRACE_FUNC_ENTRY; |
487 |
464 |
488 CSConTask* task = NULL; |
465 CSConTask* task = NULL; |
489 User::LeaveIfError( iQueue->GetTask( iCurrentTask, task ) ); |
466 User::LeaveIfError( iQueue->GetTask( iCurrentTask, task ) ); |
490 |
467 |
491 SConPcdUtility::ProcessListInstalledAppsL( task ); |
468 CSConListInstApps& listInstApps = *task->iListAppsParams; |
492 |
469 Usif::RSoftwareComponentRegistry scr; |
493 TRACE_FUNC_EXIT; |
470 User::LeaveIfError( scr.Connect() ); |
494 } |
471 CleanupClosePushL( scr ); |
495 |
472 |
496 // ----------------------------------------------------------------------------- |
473 RArray<Usif::TComponentId> componentList; |
497 // CSConAppInstaller::DeleteFile( const TDesC& aPath ) |
474 CleanupClosePushL( componentList ); |
498 // Deletes a file |
475 Usif::CComponentFilter* filter = Usif::CComponentFilter::NewLC(); |
499 // ----------------------------------------------------------------------------- |
476 |
500 // |
477 if ( listInstApps.iAllApps ) |
501 void CSConAppInstaller::DeleteFile( const TDesC& aPath ) |
478 { |
502 { |
479 TDriveList driveList; |
503 TRACE_FUNC; |
480 // Get all drives that are visible to the user. |
504 iFs.Delete( aPath ); |
481 TInt driveCount; |
|
482 User::LeaveIfError( DriveInfo::GetUserVisibleDrives( iFs, driveList, driveCount ) ); |
|
483 filter->SetInstalledDrivesL( driveList ); |
|
484 } |
|
485 else |
|
486 { |
|
487 filter->SetInstalledDrivesL( listInstApps.iDriveList ); |
|
488 } |
|
489 |
|
490 scr.GetComponentIdsL( componentList, filter); |
|
491 |
|
492 CleanupStack::PopAndDestroy( filter ); |
|
493 LOGGER_WRITE_1("components found: %d", componentList.Count()); |
|
494 for (int i=0; i<componentList.Count(); i++) |
|
495 { |
|
496 Usif::CComponentEntry* entry = Usif::CComponentEntry::NewLC(); |
|
497 TBool found = scr.GetComponentL(componentList[i], *entry ); |
|
498 if (!found) |
|
499 User::Leave(KErrNotFound); |
|
500 |
|
501 CSConInstApp* app = new (ELeave) CSConInstApp(); |
|
502 CleanupStack::PushL( app ); |
|
503 |
|
504 StrCopyL( entry->Name(), app->iName ); |
|
505 StrCopyL( entry->Vendor(), app->iVendor ); |
|
506 app->iSize = entry->ComponentSize(); |
|
507 StrCopyL( entry->Version(), app->iVersion ); |
|
508 app->iWidgetBundleId = entry->GlobalId().AllocL(); |
|
509 |
|
510 app->iUid.iUid = componentList[i]; |
|
511 |
|
512 if ( entry->SoftwareType().Match( Usif::KSoftwareTypeNative ) == 0 ) |
|
513 { |
|
514 app->iType = ESisApplication; |
|
515 } |
|
516 else if ( entry->SoftwareType().Match( Usif::KSoftwareTypeJava ) == 0 ) |
|
517 { |
|
518 app->iType = EJavaApplication; |
|
519 } |
|
520 else if ( entry->SoftwareType().Match( Usif::KSoftwareTypeWidget ) == 0 ) |
|
521 { |
|
522 app->iType = EWidgetApplication; |
|
523 } |
|
524 |
|
525 User::LeaveIfError( listInstApps.iApps.Append( app ) ); |
|
526 CleanupStack::Pop( app ); |
|
527 |
|
528 CleanupStack::PopAndDestroy( entry ); |
|
529 } |
|
530 CleanupStack::PopAndDestroy( &componentList ); |
|
531 CleanupStack::PopAndDestroy( &scr ); |
|
532 |
|
533 TRACE_FUNC_EXIT; |
|
534 } |
|
535 |
|
536 void CSConAppInstaller::StrCopyL( const TDesC& aSrc, TDes& aDest ) |
|
537 { |
|
538 if (aSrc.Size() > aDest.MaxSize()) |
|
539 User::Leave(KErrTooBig); |
|
540 aDest.Copy( aSrc ); |
505 } |
541 } |
506 // End of file |
542 // End of file |