iaupdate/IAD/engine/controller/src/iaupdateutils.cpp
changeset 52 92f864ef0288
parent 33 8110bf1194d1
child 53 ae54820ef82c
equal deleted inserted replaced
42:d17dc5398051 52:92f864ef0288
    37 #include <ncdnodepurchase.h>
    37 #include <ncdnodepurchase.h>
    38 #include <ncdnodecontentinfo.h>
    38 #include <ncdnodecontentinfo.h>
    39 #include <ncdpurchaseoption.h>
    39 #include <ncdpurchaseoption.h>
    40 
    40 
    41 #include <catalogsutils.h>
    41 #include <catalogsutils.h>
    42 #include <WidgetRegistryClient.h>
    42 //#include <WidgetRegistryClient.h>
       
    43 #include <usif/scr/scr.h>
    43 
    44 
    44 //Constants
    45 //Constants
    45 const TText KVersionSeparator( '.' );
    46 const TText KVersionSeparator( '.' );
    46 
    47 
    47 _LIT( KExe, ".exe" );
    48 _LIT( KExe, ".exe" );
   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 );
   337         }
   379         }
   338     
   380     
   339     CleanupStack::PopAndDestroy( &widgetInfoArr );
   381     CleanupStack::PopAndDestroy( &widgetInfoArr );
   340     CleanupStack::PopAndDestroy( &widgetRegistry);
   382     CleanupStack::PopAndDestroy( &widgetRegistry);
   341     return EFalse;
   383     return EFalse;
       
   384     */
   342       
   385       
   343      
   386      
   344     }
   387     }
   345 
   388 
   346 // -----------------------------------------------------------------------------
   389 // -----------------------------------------------------------------------------
   459         }
   502         }
   460     CleanupStack::PopAndDestroy( &registrySession );
   503     CleanupStack::PopAndDestroy( &registrySession );
   461     return exeFound;
   504     return exeFound;
   462     }
   505     }
   463 
   506 
   464 
   507 // ---------------------------------------------------------------------------
       
   508 // IAUpdateUtils::UsifSilentInstallOptionsL
       
   509 // 
       
   510 // ---------------------------------------------------------------------------
       
   511 
       
   512 EXPORT_C void  IAUpdateUtils::UsifSilentInstallOptionsL( 
       
   513         Usif::COpaqueNamedParams * aOptions )
       
   514     {
       
   515 
       
   516     aOptions->AddIntL( Usif::KSifInParam_InstallSilently, ETrue );
       
   517 
       
   518     // Upgrades are allowed 
       
   519     aOptions->AddIntL( Usif::KSifInParam_AllowUpgrade, ETrue );
       
   520     
       
   521     // Install all if optional packets exist.
       
   522     aOptions->AddIntL( Usif::KSifInParam_InstallOptionalItems, ETrue );
       
   523     
       
   524     // Prevent online cert revocation check.
       
   525     aOptions->AddIntL( Usif::KSifInParam_PerformOCSP, EFalse );
       
   526     
       
   527     // See iOCSP setting above
       
   528     aOptions->AddIntL( Usif::KSifInParam_IgnoreOCSPWarnings, ETrue );
       
   529     
       
   530     // Do not allow installation of uncertified packages.
       
   531     aOptions->AddIntL( Usif::KSifInParam_AllowUntrusted, EFalse );
       
   532     
       
   533     // If filetexts are included in SIS package, show them.
       
   534     aOptions->AddIntL( Usif::KSifInParam_PackageInfo, ETrue );
       
   535     
       
   536     // Automatically grant user capabilities.
       
   537     // See also KSifInParam_AllowUntrusted above.
       
   538     aOptions->AddIntL( Usif::KSifInParam_GrantCapabilities, EFalse );
       
   539     
       
   540     // Open application will be closed.
       
   541     aOptions->AddIntL( Usif::KSifInParam_AllowAppShutdown, ETrue );
       
   542     
       
   543     // Files can be overwritten.
       
   544     aOptions->AddIntL( Usif::KSifInParam_AllowOverwrite, ETrue );
       
   545     
       
   546     // This only affects Java applications.
       
   547     aOptions->AddIntL( Usif::KSifInParam_AllowDownload, ETrue );
       
   548     
       
   549     // Where to save.
       
   550     aOptions->AddIntL( Usif::KSifInParam_Drive, EDriveC );
       
   551     
       
   552     // Choose the phone language.
       
   553     TLanguage lang = User::Language();
       
   554     // aOptions->AddIntL( Usif::KSifInParam_Languages, lang ); // User::Language() );
       
   555     
       
   556     //aOptions->AddIntL( Usif::KSifInParam_Drive, IAUpdateUtils::DriveToInstallL( aUid, aSize ) );
       
   557     }
   465 // ---------------------------------------------------------------------------
   558 // ---------------------------------------------------------------------------
   466 // IAUpdateUtils::SilentInstallOptionsL
   559 // IAUpdateUtils::SilentInstallOptionsL
   467 // 
   560 // 
   468 // ---------------------------------------------------------------------------
   561 // ---------------------------------------------------------------------------
   469 //
   562 //
   651                                            RWidgetRegistryClientSession& aWidgetRegistry, 
   744                                            RWidgetRegistryClientSession& aWidgetRegistry, 
   652                                            const TUid& aUid, 
   745                                            const TUid& aUid, 
   653                                            TDriveUnit& aLocationDrive )
   746                                            TDriveUnit& aLocationDrive )
   654     {
   747     {
   655     IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::InstalledDriveWidgetL() begin");
   748     IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::InstalledDriveWidgetL() begin");
       
   749     aLocationDrive = EDriveC;
       
   750     
       
   751     //HLa: Widget registry remove
       
   752     
       
   753     /*
   656     TFileName widgetPath;
   754     TFileName widgetPath;
   657     aWidgetRegistry.GetWidgetPath( aUid, widgetPath );
   755     aWidgetRegistry.GetWidgetPath( aUid, widgetPath );
   658     aLocationDrive = widgetPath.Mid( 0, 2 );
   756     aLocationDrive = widgetPath.Mid( 0, 2 );
   659     IAUPDATE_TRACE_1("[IAUPDATE] IAUpdateUtils::InstalledDriveWidgetL() Drive in registry: %S", &aLocationDrive.Name() );
   757     IAUPDATE_TRACE_1("[IAUPDATE] IAUpdateUtils::InstalledDriveWidgetL() Drive in registry: %S", &aLocationDrive.Name() );
   660     if ( aLocationDrive == EDriveZ )
   758     if ( aLocationDrive == EDriveZ )
   672             {
   770             {
   673             aLocationDrive = EDriveC;
   771             aLocationDrive = EDriveC;
   674             IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::InstalledDriveWidgetL() Physically removable drive not present, install to C:");
   772             IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::InstalledDriveWidgetL() Physically removable drive not present, install to C:");
   675             }
   773             }
   676         }
   774         }
       
   775     */
       
   776     
   677     IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::InstalledDriveWidgetL() begin");
   777     IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::InstalledDriveWidgetL() begin");
   678     }
   778     }
   679 
   779 
   680 
   780 
   681 // -----------------------------------------------------------------------------
   781 // -----------------------------------------------------------------------------
   760 //   
   860 //   
   761 TDriveUnit IAUpdateUtils::DriveToInstallWidgetL( const TDesC& aIdentifier )
   861 TDriveUnit IAUpdateUtils::DriveToInstallWidgetL( const TDesC& aIdentifier )
   762     {
   862     {
   763     IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::DriveToInstallWidgetL() begin");
   863     IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::DriveToInstallWidgetL() begin");
   764     IAUPDATE_TRACE_1("[IAUPDATE] IAUpdateUtils::DriveToInstallWidgetL() identifier: %S", &aIdentifier );
   864     IAUPDATE_TRACE_1("[IAUPDATE] IAUpdateUtils::DriveToInstallWidgetL() identifier: %S", &aIdentifier );
       
   865     
       
   866 
   765     TDriveUnit targetDriveUnit( EDriveC );
   867     TDriveUnit targetDriveUnit( EDriveC );
       
   868     
       
   869     //HLa: Widget registry remove
       
   870     /*
   766     RWidgetRegistryClientSession widgetRegistry;
   871     RWidgetRegistryClientSession widgetRegistry;
   767 
   872 
   768     User::LeaveIfError( widgetRegistry.Connect() );
   873     User::LeaveIfError( widgetRegistry.Connect() );
   769         
   874         
   770     CleanupClosePushL( widgetRegistry );
   875     CleanupClosePushL( widgetRegistry );
   794         CleanupStack::PopAndDestroy( BundleId );
   899         CleanupStack::PopAndDestroy( BundleId );
   795         }
   900         }
   796         
   901         
   797     CleanupStack::PopAndDestroy( &widgetInfoArr );
   902     CleanupStack::PopAndDestroy( &widgetInfoArr );
   798     CleanupStack::PopAndDestroy( &widgetRegistry);
   903     CleanupStack::PopAndDestroy( &widgetRegistry);
       
   904     */
   799     IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::DriveToInstallWidgetL() end");
   905     IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::DriveToInstallWidgetL() end");
       
   906 
   800     return targetDriveUnit;
   907     return targetDriveUnit;
       
   908 
   801     }
   909     }
   802 
   910 
   803 
   911 
   804 
   912 
   805 // -----------------------------------------------------------------------------
   913 // -----------------------------------------------------------------------------