diff -r 51c0f5edf5ef -r 3ba40be8e484 iaupdate/IAD/engine/controller/src/iaupdateutils.cpp --- a/iaupdate/IAD/engine/controller/src/iaupdateutils.cpp Fri Feb 19 22:57:02 2010 +0200 +++ b/iaupdate/IAD/engine/controller/src/iaupdateutils.cpp Fri Mar 12 15:43:14 2010 +0200 @@ -37,7 +37,7 @@ #include #include - +#include //Constants const TInt KSpaceMarginal( 100 * 1024 ); @@ -292,6 +292,53 @@ } } +// ----------------------------------------------------------------------------- +// IAUpdateUtils::IsWidgetInstalledL +// Check existance of widget and request the version info if the widget has been installed +// The Widget registry API is used here. +// ----------------------------------------------------------------------------- + +EXPORT_C TBool IAUpdateUtils::IsWidgetInstalledL(const TDesC& aIdentifier, TIAUpdateVersion& aVersion ) + { + RWidgetRegistryClientSession widgetRegistry; + + User::LeaveIfError( widgetRegistry.Connect() ); + + CleanupClosePushL( widgetRegistry ); + + RPointerArray widgetInfoArr; + CleanupResetAndDestroyPushL( widgetInfoArr ); + TInt err = widgetRegistry.InstalledWidgetsL(widgetInfoArr); + + for( TInt i( widgetInfoArr.Count() - 1 ); i >= 0; --i ) + { + CWidgetInfo* widgetInfo( widgetInfoArr[i] ); + + CWidgetPropertyValue* BundleId = widgetRegistry.GetWidgetPropertyValueL(widgetInfo->iUid, EBundleIdentifier ); + CleanupStack::PushL( BundleId ); + + if( aIdentifier.Compare( *(BundleId->iValue.s) )== 0 ) + { + CWidgetPropertyValue* version = widgetRegistry.GetWidgetPropertyValueL(widgetInfo->iUid, EBundleVersion ); + CleanupStack::PushL( version ); + + DesToVersionL(*(version->iValue.s), aVersion.iMajor, aVersion.iMinor, aVersion.iBuild ); + + CleanupStack::PopAndDestroy( version ); + CleanupStack::PopAndDestroy( BundleId ); + CleanupStack::PopAndDestroy( &widgetInfoArr ); + CleanupStack::PopAndDestroy( &widgetRegistry); + return ETrue; + } + CleanupStack::PopAndDestroy( BundleId ); + } + + CleanupStack::PopAndDestroy( &widgetInfoArr ); + CleanupStack::PopAndDestroy( &widgetRegistry); + return EFalse; + + + } // ----------------------------------------------------------------------------- // IAUpdateUtils::SpaceAvailableInInternalDrivesL