301 // The Widget registry API is used here. |
302 // The Widget registry API is used here. |
302 // ----------------------------------------------------------------------------- |
303 // ----------------------------------------------------------------------------- |
303 |
304 |
304 EXPORT_C TBool IAUpdateUtils::IsWidgetInstalledL(const TDesC& aIdentifier, TIAUpdateVersion& aVersion ) |
305 EXPORT_C TBool IAUpdateUtils::IsWidgetInstalledL(const TDesC& aIdentifier, TIAUpdateVersion& aVersion ) |
305 { |
306 { |
|
307 |
|
308 TBool retVal = EFalse; |
|
309 |
|
310 // Connect to registry |
|
311 Usif::RSoftwareComponentRegistry scrSession; |
|
312 CleanupClosePushL( scrSession ); |
|
313 User::LeaveIfError( scrSession.Connect()); |
|
314 |
|
315 // // Get widget component id by identifier |
|
316 Usif::TComponentId compId = 0; |
|
317 TRAPD( err, compId = |
|
318 scrSession.GetComponentIdL( aIdentifier, Usif::KSoftwareTypeWidget )); |
|
319 |
|
320 if ( err == KErrNotFound ) |
|
321 { |
|
322 retVal = EFalse; |
|
323 } |
|
324 else if (err != KErrNone ) |
|
325 { |
|
326 User::Leave( err ); |
|
327 } |
|
328 else |
|
329 { |
|
330 // Widget found |
|
331 retVal = ETrue; |
|
332 |
|
333 // Get entry |
|
334 Usif::CComponentEntry* entry = Usif::CComponentEntry::NewLC(); |
|
335 retVal = scrSession.GetComponentL(compId, *entry); |
|
336 |
|
337 // Convert version |
|
338 DesToVersionL ( entry->Version(), aVersion.iMajor, aVersion.iMinor, aVersion.iBuild ); |
|
339 |
|
340 CleanupStack::PopAndDestroy(entry); |
|
341 } |
|
342 |
|
343 CleanupStack::PopAndDestroy( &scrSession ); |
|
344 |
|
345 return retVal; |
|
346 |
|
347 /* |
306 RWidgetRegistryClientSession widgetRegistry; |
348 RWidgetRegistryClientSession widgetRegistry; |
307 |
349 |
308 User::LeaveIfError( widgetRegistry.Connect() ); |
350 User::LeaveIfError( widgetRegistry.Connect() ); |
309 |
351 |
310 CleanupClosePushL( widgetRegistry ); |
352 CleanupClosePushL( widgetRegistry ); |
459 } |
502 } |
460 CleanupStack::PopAndDestroy( ®istrySession ); |
503 CleanupStack::PopAndDestroy( ®istrySession ); |
461 return exeFound; |
504 return exeFound; |
462 } |
505 } |
463 |
506 |
464 |
|
465 // --------------------------------------------------------------------------- |
507 // --------------------------------------------------------------------------- |
466 // IAUpdateUtils::SilentInstallOptionsL |
508 // IAUpdateUtils::UsifSilentInstallOptionsL |
467 // |
509 // |
468 // --------------------------------------------------------------------------- |
510 // --------------------------------------------------------------------------- |
469 // |
511 |
470 SwiUI::TInstallOptions IAUpdateUtils::SilentInstallOptionsL( |
512 void IAUpdateUtils::UsifSilentInstallOptionsL( |
471 const CIAUpdateBaseNode& aNode ) |
513 Usif::COpaqueNamedParams * aOptions ) |
472 { |
514 { |
473 IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::SilentInstallOptionsL() begin"); |
515 |
474 SwiUI::TInstallOptions options; |
516 aOptions->AddIntL( Usif::KSifInParam_InstallSilently, ETrue ); |
475 |
517 |
476 // Upgrades are allowed |
518 // Upgrades are allowed |
477 options.iUpgrade = SwiUI::EPolicyAllowed; |
519 aOptions->AddIntL( Usif::KSifInParam_AllowUpgrade, Usif::EAllowed ); |
478 |
520 |
479 // Install all if optional packets exist. |
521 // Install all if optional packets exist. |
480 options.iOptionalItems = SwiUI::EPolicyAllowed; |
522 aOptions->AddIntL( Usif::KSifInParam_InstallOptionalItems, Usif::EAllowed ); |
481 |
523 |
482 // Prevent online cert revocation check. |
524 // Prevent online cert revocation check. |
483 options.iOCSP = SwiUI::EPolicyNotAllowed; |
525 aOptions->AddIntL( Usif::KSifInParam_PerformOCSP, Usif::ENotAllowed ); |
484 |
526 |
485 // See iOCSP setting above |
527 // See iOCSP setting above |
486 options.iIgnoreOCSPWarnings = SwiUI::EPolicyAllowed; |
528 aOptions->AddIntL( Usif::KSifInParam_IgnoreOCSPWarnings, Usif::EAllowed ); |
487 |
529 |
488 // Do not allow installation of uncertified packages. |
530 // Do not allow installation of uncertified packages. |
489 options.iUntrusted = SwiUI::EPolicyNotAllowed; |
531 aOptions->AddIntL( Usif::KSifInParam_AllowUntrusted, Usif::ENotAllowed ); |
490 |
532 |
491 // If filetexts are included in SIS package. Then, show them. |
533 // If filetexts are included in SIS package, show them. |
492 options.iPackageInfo = SwiUI::EPolicyUserConfirm; |
534 aOptions->AddIntL( Usif::KSifInParam_PackageInfo, Usif::EAllowed ); |
493 |
535 |
494 // Automatically grant user capabilities. |
536 // Automatically grant user capabilities. |
495 // See also iUntrusted above. |
537 // See also KSifInParam_AllowUntrusted above. |
496 options.iCapabilities = SwiUI::EPolicyAllowed; |
538 aOptions->AddIntL( Usif::KSifInParam_GrantCapabilities, Usif::EAllowed ); |
497 |
539 |
498 // Open application will be closed. |
540 // Open application will be closed. |
499 options.iKillApp = SwiUI::EPolicyAllowed; |
541 aOptions->AddIntL( Usif::KSifInParam_AllowAppShutdown, Usif::EAllowed ); |
500 |
542 |
501 // Files can be overwritten. |
543 // Files can be overwritten. |
502 options.iOverwrite = SwiUI::EPolicyAllowed; |
544 aOptions->AddIntL( Usif::KSifInParam_AllowOverwrite, Usif::EAllowed ); |
|
545 |
|
546 // Incompatible allowed |
|
547 aOptions->AddIntL( Usif::KSifInParam_AllowIncompatible, Usif::EAllowed ); |
503 |
548 |
504 // This only affects Java applications. |
549 // This only affects Java applications. |
505 options.iDownload = SwiUI::EPolicyAllowed; |
550 aOptions->AddIntL( Usif::KSifInParam_AllowDownload, Usif::EAllowed ); |
506 |
551 |
507 // Where to save. |
552 // Where to save. |
508 IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::SilentInstallOptionsL() before DriveToInstallL"); |
553 //aOptions->AddIntL( Usif::KSifInParam_Drive, EDriveC ); |
509 TDriveUnit driveUnit; |
|
510 if ( aNode.Mime().Compare( IAUpdateProtocolConsts::KMimeWidget ) == 0 ) |
|
511 { |
|
512 driveUnit = IAUpdateUtils::DriveToInstallWidgetL( aNode.Identifier() ); |
|
513 } |
|
514 else |
|
515 { |
|
516 driveUnit = IAUpdateUtils::DriveToInstallL( aNode.Uid(), aNode.OwnContentSizeL() ); |
|
517 } |
|
518 IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::SilentInstallOptionsL() after DriveToInstallL"); |
|
519 |
|
520 TDriveName driveName = driveUnit.Name(); |
|
521 IAUPDATE_TRACE_1("[IAUPDATE] IAUpdateUtils::SilentInstallOptionsL() driveName: %S", &driveName ); |
|
522 options.iDrive = driveName[0]; |
|
523 |
554 |
524 // Choose the phone language. |
555 // Choose the phone language. |
525 options.iLang = User::Language(); |
556 TLanguage lang = User::Language(); |
526 |
557 //aOptions->AddIntL( Usif::KSifInParam_Languages, lang ); // User::Language() ); |
527 // If language is asked, then use the current phone language. |
558 |
528 options.iUsePhoneLang = ETrue; |
559 //aOptions->AddIntL( Usif::KSifInParam_Drive, IAUpdateUtils::DriveToInstallL( aUid, aSize ) ); |
529 |
560 } |
530 // Does not affect SISX. This is for Java. |
|
531 options.iUpgradeData = SwiUI::EPolicyAllowed; |
|
532 IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::SilentInstallOptionsL() end"); |
|
533 return options; |
|
534 } |
|
535 |
|
536 |
|
537 // ----------------------------------------------------------------------------- |
561 // ----------------------------------------------------------------------------- |
538 // IAUpdateUtils::InstalledDriveL |
562 // IAUpdateUtils::InstalledDriveL |
539 // |
563 // |
540 // ----------------------------------------------------------------------------- |
564 // ----------------------------------------------------------------------------- |
541 // |
565 // |
651 RWidgetRegistryClientSession& aWidgetRegistry, |
675 RWidgetRegistryClientSession& aWidgetRegistry, |
652 const TUid& aUid, |
676 const TUid& aUid, |
653 TDriveUnit& aLocationDrive ) |
677 TDriveUnit& aLocationDrive ) |
654 { |
678 { |
655 IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::InstalledDriveWidgetL() begin"); |
679 IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::InstalledDriveWidgetL() begin"); |
|
680 aLocationDrive = EDriveC; |
|
681 |
|
682 //HLa: Widget registry remove |
|
683 |
|
684 /* |
656 TFileName widgetPath; |
685 TFileName widgetPath; |
657 aWidgetRegistry.GetWidgetPath( aUid, widgetPath ); |
686 aWidgetRegistry.GetWidgetPath( aUid, widgetPath ); |
658 aLocationDrive = widgetPath.Mid( 0, 2 ); |
687 aLocationDrive = widgetPath.Mid( 0, 2 ); |
659 IAUPDATE_TRACE_1("[IAUPDATE] IAUpdateUtils::InstalledDriveWidgetL() Drive in registry: %S", &aLocationDrive.Name() ); |
688 IAUPDATE_TRACE_1("[IAUPDATE] IAUpdateUtils::InstalledDriveWidgetL() Drive in registry: %S", &aLocationDrive.Name() ); |
660 if ( aLocationDrive == EDriveZ ) |
689 if ( aLocationDrive == EDriveZ ) |