302 // The Widget registry API is used here. |
301 // The Widget registry API is used here. |
303 // ----------------------------------------------------------------------------- |
302 // ----------------------------------------------------------------------------- |
304 |
303 |
305 EXPORT_C TBool IAUpdateUtils::IsWidgetInstalledL(const TDesC& aIdentifier, TIAUpdateVersion& aVersion ) |
304 EXPORT_C TBool IAUpdateUtils::IsWidgetInstalledL(const TDesC& aIdentifier, TIAUpdateVersion& aVersion ) |
306 { |
305 { |
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 /* |
|
348 RWidgetRegistryClientSession widgetRegistry; |
306 RWidgetRegistryClientSession widgetRegistry; |
349 |
307 |
350 User::LeaveIfError( widgetRegistry.Connect() ); |
308 User::LeaveIfError( widgetRegistry.Connect() ); |
351 |
309 |
352 CleanupClosePushL( widgetRegistry ); |
310 CleanupClosePushL( widgetRegistry ); |
502 } |
459 } |
503 CleanupStack::PopAndDestroy( ®istrySession ); |
460 CleanupStack::PopAndDestroy( ®istrySession ); |
504 return exeFound; |
461 return exeFound; |
505 } |
462 } |
506 |
463 |
|
464 |
507 // --------------------------------------------------------------------------- |
465 // --------------------------------------------------------------------------- |
508 // IAUpdateUtils::UsifSilentInstallOptionsL |
466 // IAUpdateUtils::SilentInstallOptionsL |
509 // |
467 // |
510 // --------------------------------------------------------------------------- |
468 // --------------------------------------------------------------------------- |
511 |
469 // |
512 void IAUpdateUtils::UsifSilentInstallOptionsL( |
470 SwiUI::TInstallOptions IAUpdateUtils::SilentInstallOptionsL( |
513 Usif::COpaqueNamedParams * aOptions ) |
471 const CIAUpdateBaseNode& aNode ) |
514 { |
472 { |
515 |
473 IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::SilentInstallOptionsL() begin"); |
516 aOptions->AddIntL( Usif::KSifInParam_InstallSilently, ETrue ); |
474 SwiUI::TInstallOptions options; |
517 |
475 |
518 // Upgrades are allowed |
476 // Upgrades are allowed |
519 aOptions->AddIntL( Usif::KSifInParam_AllowUpgrade, Usif::EAllowed ); |
477 options.iUpgrade = SwiUI::EPolicyAllowed; |
520 |
478 |
521 // Install all if optional packets exist. |
479 // Install all if optional packets exist. |
522 aOptions->AddIntL( Usif::KSifInParam_InstallOptionalItems, Usif::EAllowed ); |
480 options.iOptionalItems = SwiUI::EPolicyAllowed; |
523 |
481 |
524 // Prevent online cert revocation check. |
482 // Prevent online cert revocation check. |
525 aOptions->AddIntL( Usif::KSifInParam_PerformOCSP, Usif::ENotAllowed ); |
483 options.iOCSP = SwiUI::EPolicyNotAllowed; |
526 |
484 |
527 // See iOCSP setting above |
485 // See iOCSP setting above |
528 aOptions->AddIntL( Usif::KSifInParam_IgnoreOCSPWarnings, Usif::EAllowed ); |
486 options.iIgnoreOCSPWarnings = SwiUI::EPolicyAllowed; |
529 |
487 |
530 // Do not allow installation of uncertified packages. |
488 // Do not allow installation of uncertified packages. |
531 aOptions->AddIntL( Usif::KSifInParam_AllowUntrusted, Usif::ENotAllowed ); |
489 options.iUntrusted = SwiUI::EPolicyNotAllowed; |
532 |
490 |
533 // If filetexts are included in SIS package, show them. |
491 // If filetexts are included in SIS package. Then, show them. |
534 aOptions->AddIntL( Usif::KSifInParam_PackageInfo, Usif::EAllowed ); |
492 options.iPackageInfo = SwiUI::EPolicyUserConfirm; |
535 |
493 |
536 // Automatically grant user capabilities. |
494 // Automatically grant user capabilities. |
537 // See also KSifInParam_AllowUntrusted above. |
495 // See also iUntrusted above. |
538 aOptions->AddIntL( Usif::KSifInParam_GrantCapabilities, Usif::EAllowed ); |
496 options.iCapabilities = SwiUI::EPolicyAllowed; |
539 |
497 |
540 // Open application will be closed. |
498 // Open application will be closed. |
541 aOptions->AddIntL( Usif::KSifInParam_AllowAppShutdown, Usif::EAllowed ); |
499 options.iKillApp = SwiUI::EPolicyAllowed; |
542 |
500 |
543 // Files can be overwritten. |
501 // Files can be overwritten. |
544 aOptions->AddIntL( Usif::KSifInParam_AllowOverwrite, Usif::EAllowed ); |
502 options.iOverwrite = SwiUI::EPolicyAllowed; |
545 |
|
546 // Incompatible allowed |
|
547 aOptions->AddIntL( Usif::KSifInParam_AllowIncompatible, Usif::EAllowed ); |
|
548 |
503 |
549 // This only affects Java applications. |
504 // This only affects Java applications. |
550 aOptions->AddIntL( Usif::KSifInParam_AllowDownload, Usif::EAllowed ); |
505 options.iDownload = SwiUI::EPolicyAllowed; |
551 |
506 |
552 // Where to save. |
507 // Where to save. |
553 //aOptions->AddIntL( Usif::KSifInParam_Drive, EDriveC ); |
508 IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::SilentInstallOptionsL() before DriveToInstallL"); |
|
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]; |
554 |
523 |
555 // Choose the phone language. |
524 // Choose the phone language. |
556 TLanguage lang = User::Language(); |
525 options.iLang = User::Language(); |
557 //aOptions->AddIntL( Usif::KSifInParam_Languages, lang ); // User::Language() ); |
526 |
558 |
527 // If language is asked, then use the current phone language. |
559 //aOptions->AddIntL( Usif::KSifInParam_Drive, IAUpdateUtils::DriveToInstallL( aUid, aSize ) ); |
528 options.iUsePhoneLang = ETrue; |
560 } |
529 |
|
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 |
561 // ----------------------------------------------------------------------------- |
537 // ----------------------------------------------------------------------------- |
562 // IAUpdateUtils::InstalledDriveL |
538 // IAUpdateUtils::InstalledDriveL |
563 // |
539 // |
564 // ----------------------------------------------------------------------------- |
540 // ----------------------------------------------------------------------------- |
565 // |
541 // |
675 RWidgetRegistryClientSession& aWidgetRegistry, |
651 RWidgetRegistryClientSession& aWidgetRegistry, |
676 const TUid& aUid, |
652 const TUid& aUid, |
677 TDriveUnit& aLocationDrive ) |
653 TDriveUnit& aLocationDrive ) |
678 { |
654 { |
679 IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::InstalledDriveWidgetL() begin"); |
655 IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::InstalledDriveWidgetL() begin"); |
680 aLocationDrive = EDriveC; |
|
681 |
|
682 //HLa: Widget registry remove |
|
683 |
|
684 /* |
|
685 TFileName widgetPath; |
656 TFileName widgetPath; |
686 aWidgetRegistry.GetWidgetPath( aUid, widgetPath ); |
657 aWidgetRegistry.GetWidgetPath( aUid, widgetPath ); |
687 aLocationDrive = widgetPath.Mid( 0, 2 ); |
658 aLocationDrive = widgetPath.Mid( 0, 2 ); |
688 IAUPDATE_TRACE_1("[IAUPDATE] IAUpdateUtils::InstalledDriveWidgetL() Drive in registry: %S", &aLocationDrive.Name() ); |
659 IAUPDATE_TRACE_1("[IAUPDATE] IAUpdateUtils::InstalledDriveWidgetL() Drive in registry: %S", &aLocationDrive.Name() ); |
689 if ( aLocationDrive == EDriveZ ) |
660 if ( aLocationDrive == EDriveZ ) |