iaupdate/IAD/engine/controller/src/iaupdateutils.cpp
branchRCL_3
changeset 27 e8965914fac7
parent 26 8b7f4e561641
equal deleted inserted replaced
26:8b7f4e561641 27:e8965914fac7
   300 // Check existance of widget and request the version info if the widget has been installed
   300 // Check existance of widget and request the version info if the widget has been installed
   301 // The Widget registry API is used here.
   301 // The Widget registry API is used here.
   302 // -----------------------------------------------------------------------------
   302 // -----------------------------------------------------------------------------
   303 
   303 
   304 EXPORT_C TBool IAUpdateUtils::IsWidgetInstalledL(const TDesC& aIdentifier, TIAUpdateVersion& aVersion )
   304 EXPORT_C TBool IAUpdateUtils::IsWidgetInstalledL(const TDesC& aIdentifier, TIAUpdateVersion& aVersion )
   305     {
   305     { 
   306     RWidgetRegistryClientSession widgetRegistry;
   306     RWidgetRegistryClientSession widgetRegistry;
   307 
   307 
   308     User::LeaveIfError( widgetRegistry.Connect() );
   308     User::LeaveIfError( widgetRegistry.Connect() );
   309     
   309     
   310     CleanupClosePushL( widgetRegistry );
   310     CleanupClosePushL( widgetRegistry );
   315     
   315     
   316     for( TInt i( widgetInfoArr.Count() - 1 ); i >= 0; --i ) 
   316     for( TInt i( widgetInfoArr.Count() - 1 ); i >= 0; --i ) 
   317         {
   317         {
   318         CWidgetInfo* widgetInfo( widgetInfoArr[i] );  
   318         CWidgetInfo* widgetInfo( widgetInfoArr[i] );  
   319         
   319         
   320         CWidgetPropertyValue* BundleId = widgetRegistry.GetWidgetPropertyValueL(widgetInfo->iUid, EBundleIdentifier );
   320         CWidgetPropertyValue* BundleId = 
       
   321                 widgetRegistry.GetWidgetPropertyValueL(widgetInfo->iUid, EBundleIdentifier );
   321         CleanupStack::PushL( BundleId );
   322         CleanupStack::PushL( BundleId );
   322         
   323         
   323         if( aIdentifier.Compare( *(BundleId->iValue.s) )== 0 )
   324         if( aIdentifier.Compare( *(BundleId->iValue.s) )== 0 )
   324             {
   325             {
   325             CWidgetPropertyValue* version = widgetRegistry.GetWidgetPropertyValueL(widgetInfo->iUid, EBundleVersion );
   326             // Get version
       
   327             CWidgetPropertyValue* version = 
       
   328                     widgetRegistry.GetWidgetPropertyValueL(widgetInfo->iUid, EBundleVersion );
   326             CleanupStack::PushL( version );
   329             CleanupStack::PushL( version );
   327             
   330             
   328             DesToVersionL(*(version->iValue.s), aVersion.iMajor, aVersion.iMinor, aVersion.iBuild );
   331             // Convert version
       
   332             if (version->iValue.s)
       
   333                 {
       
   334                 DesToVersionL(*(version->iValue.s), aVersion.iMajor, aVersion.iMinor, aVersion.iBuild );
       
   335                 }
       
   336             else
       
   337                 {
       
   338                 // version does not exist, set default (0.0.1)
       
   339                 aVersion.iMajor = 0;
       
   340                 aVersion.iMinor = 0;
       
   341                 aVersion.iBuild = 1;
       
   342                 }
   329             
   343             
   330             CleanupStack::PopAndDestroy( version );
   344             CleanupStack::PopAndDestroy( version );
   331             CleanupStack::PopAndDestroy( BundleId );
   345             CleanupStack::PopAndDestroy( BundleId );
   332             CleanupStack::PopAndDestroy( &widgetInfoArr );
   346             CleanupStack::PopAndDestroy( &widgetInfoArr );
   333             CleanupStack::PopAndDestroy( &widgetRegistry);
   347             CleanupStack::PopAndDestroy( &widgetRegistry);