iaupdate/IAD/engine/controller/src/iaupdateutils.cpp
branchRCL_3
changeset 18 3ba40be8e484
parent 0 ba25891c3a9e
child 28 98a43fae6e2b
equal deleted inserted replaced
15:51c0f5edf5ef 18:3ba40be8e484
    35 #include <ncdnodepurchase.h>
    35 #include <ncdnodepurchase.h>
    36 #include <ncdnodecontentinfo.h>
    36 #include <ncdnodecontentinfo.h>
    37 #include <ncdpurchaseoption.h>
    37 #include <ncdpurchaseoption.h>
    38 
    38 
    39 #include <catalogsutils.h>
    39 #include <catalogsutils.h>
    40 
    40 #include <widgetregistryclient.h>
    41 
    41 
    42 //Constants
    42 //Constants
    43 const TInt KSpaceMarginal( 100 * 1024 );
    43 const TInt KSpaceMarginal( 100 * 1024 );
    44 const TInt KSizeMultiplier( 1 );
    44 const TInt KSizeMultiplier( 1 );
    45 const TText KVersionSeparator( '.' );
    45 const TText KVersionSeparator( '.' );
   290         {
   290         {
   291         return EFalse;
   291         return EFalse;
   292         }
   292         }
   293     }
   293     }
   294 
   294 
       
   295 // -----------------------------------------------------------------------------
       
   296 // IAUpdateUtils::IsWidgetInstalledL
       
   297 // Check existance of widget and request the version info if the widget has been installed
       
   298 // The Widget registry API is used here.
       
   299 // -----------------------------------------------------------------------------
       
   300 
       
   301 EXPORT_C TBool IAUpdateUtils::IsWidgetInstalledL(const TDesC& aIdentifier, TIAUpdateVersion& aVersion )
       
   302     {
       
   303     RWidgetRegistryClientSession widgetRegistry;
       
   304 
       
   305     User::LeaveIfError( widgetRegistry.Connect() );
       
   306     
       
   307     CleanupClosePushL( widgetRegistry );
       
   308     
       
   309     RPointerArray<CWidgetInfo> widgetInfoArr;
       
   310     CleanupResetAndDestroyPushL( widgetInfoArr );
       
   311     TInt err = widgetRegistry.InstalledWidgetsL(widgetInfoArr); 
       
   312     
       
   313     for( TInt i( widgetInfoArr.Count() - 1 ); i >= 0; --i ) 
       
   314         {
       
   315         CWidgetInfo* widgetInfo( widgetInfoArr[i] );  
       
   316         
       
   317         CWidgetPropertyValue* BundleId = widgetRegistry.GetWidgetPropertyValueL(widgetInfo->iUid, EBundleIdentifier );
       
   318         CleanupStack::PushL( BundleId );
       
   319         
       
   320         if( aIdentifier.Compare( *(BundleId->iValue.s) )== 0 )
       
   321             {
       
   322             CWidgetPropertyValue* version = widgetRegistry.GetWidgetPropertyValueL(widgetInfo->iUid, EBundleVersion );
       
   323             CleanupStack::PushL( version );
       
   324             
       
   325             DesToVersionL(*(version->iValue.s), aVersion.iMajor, aVersion.iMinor, aVersion.iBuild );
       
   326             
       
   327             CleanupStack::PopAndDestroy( version );
       
   328             CleanupStack::PopAndDestroy( BundleId );
       
   329             CleanupStack::PopAndDestroy( &widgetInfoArr );
       
   330             CleanupStack::PopAndDestroy( &widgetRegistry);
       
   331             return ETrue;
       
   332             }
       
   333         CleanupStack::PopAndDestroy( BundleId );
       
   334         }
       
   335     
       
   336     CleanupStack::PopAndDestroy( &widgetInfoArr );
       
   337     CleanupStack::PopAndDestroy( &widgetRegistry);
       
   338     return EFalse;
       
   339       
       
   340      
       
   341     }
   295 
   342 
   296 // -----------------------------------------------------------------------------
   343 // -----------------------------------------------------------------------------
   297 // IAUpdateUtils::SpaceAvailableInInternalDrivesL
   344 // IAUpdateUtils::SpaceAvailableInInternalDrivesL
   298 // 
   345 // 
   299 // -----------------------------------------------------------------------------
   346 // -----------------------------------------------------------------------------