Revision: 201007 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 12 Mar 2010 15:43:14 +0200
branchRCL_3
changeset 11 3ba40be8e484
parent 9 51c0f5edf5ef
child 12 7ca52d38f8c3
Revision: 201007 Kit: 201008
appinstaller/AppMngr2/Sisx/src/appmngr2sisxappinfo.cpp
iaupdate/IAD/engine/bwins/iaupdateengineu.def
iaupdate/IAD/engine/controller/inc/iaupdatebasenodeimpl.h
iaupdate/IAD/engine/controller/inc/iaupdatectrlconsts.h
iaupdate/IAD/engine/controller/inc/iaupdatenodecontainer.h
iaupdate/IAD/engine/controller/inc/iaupdateprotocolconsts.h
iaupdate/IAD/engine/controller/src/iaupdatebasenodeimpl.cpp
iaupdate/IAD/engine/controller/src/iaupdatenodecontainer.cpp
iaupdate/IAD/engine/controller/src/iaupdatenodeimpl.cpp
iaupdate/IAD/engine/controller/src/iaupdateutils.cpp
iaupdate/IAD/engine/eabi/iaupdateengineu.def
iaupdate/IAD/engine/group/iaupdateengine.mmp
iaupdate/IAD/engine/inc/iaupdatebasenode.h
iaupdate/IAD/engine/inc/iaupdatenode.h
iaupdate/IAD/engine/inc/iaupdateutils.h
iaupdate/IAD/ui/group/iaupdate.mmp
iaupdate/IAD/ui/group/iaupdate.rss
iaupdate/IAD/ui/inc/iaupdatenodeid.h
iaupdate/IAD/ui/inc/iaupdateuicontroller.h
iaupdate/IAD/ui/src/iaupdatedetailsdialog.cpp
iaupdate/IAD/ui/src/iaupdatefwdetailsdialog.cpp
iaupdate/IAD/ui/src/iaupdatemaincontainer.cpp
iaupdate/IAD/ui/src/iaupdatenodeid.cpp
iaupdate/IAD/ui/src/iaupdateuicontroller.cpp
iaupdate/group/bld.inf
iaupdate/rom/iaupdate_stub.SIS
iaupdate/rom/iaupdate_stub.pkg
iaupdateapi_stub/group/bld.inf
iaupdateapi_stub/group/iaupdateapi.mmp
iaupdateapi_stub/rom/iaupdateapi.iby
installationservices/swi/inc/switextshell.iby
installationservices/swi/source/securitymanager/certchainconstraints.cpp
ncdengine/engine/group/config.xml
ncdengine/engine/transport/inc/catalogshttpdownload.h
ncdengine/engine/transport/src/catalogshttpdownload.cpp
ncdengine/group/bld.inf
ncdengine/inc/catalogsconstants.h
ncdengine/inc/ncdnodecontentinfo.h
ncdengine/provider/client/inc/ncdnodecontentinfoproxy.h
ncdengine/provider/client/src/ncdnodecontentinfoproxy.cpp
ncdengine/provider/client/src/ncdsilentinstalloperationproxy.cpp
ncdengine/provider/deviceinteraction/inc/ncdinstallationservice.h
ncdengine/provider/deviceinteraction/inc/ncdinstallationserviceimpl.h
ncdengine/provider/deviceinteraction/inc/ncdwidgetregistrydata.h
ncdengine/provider/deviceinteraction/src/ncdinstallationserviceimpl.cpp
ncdengine/provider/server/inc/ncdinstallinfo.h
ncdengine/provider/server/inc/ncdnodecontentinfoimpl.h
ncdengine/provider/server/inc/ncdproviderutils.h
ncdengine/provider/server/src/ncdinstalloperationimpl.cpp
ncdengine/provider/server/src/ncdnodecontentinfoimpl.cpp
ncdengine/provider/server/src/ncdnodeinstallimpl.cpp
ncdengine/provider/server/src/ncdnodemetadataimpl.cpp
ncdengine/provider/server/src/ncdproviderutils.cpp
ncdengine/rom/altair-engine-stub.pkg
ncdengine/rom/altair-engine-stub.sis
ncdengine/rom/make_romstub.bat
--- a/appinstaller/AppMngr2/Sisx/src/appmngr2sisxappinfo.cpp	Fri Feb 19 22:57:02 2010 +0200
+++ b/appinstaller/AppMngr2/Sisx/src/appmngr2sisxappinfo.cpp	Fri Mar 12 15:43:14 2010 +0200
@@ -294,11 +294,13 @@
             iIsDRMProtected = TAppMngr2DRMUtils::IsDRMProtected( *fileName );
             if( iIsDRMProtected )
                 {
-                FLOG( "CAppMngr2SisxAppInfo::ConstructL, protected file %S", fileName );
+                FLOG( "CAppMngr2SisxAppInfo::ConstructL, iProtectedFile %S", fileName );
                 iProtectedFile = fileName;  // takes ownership
                 files.Remove( fileIndex );
                 iIsRightsObjectMissingOrExpired =
                     TAppMngr2DRMUtils::IsDRMRightsObjectExpiredOrMissingL( *fileName );
+                FLOG( "CAppMngr2SisxAppInfo::ConstructL, iIsRightsObjectMissingOrExpired %d",
+                        iIsRightsObjectMissingOrExpired );
                 }
             }
         CleanupStack::PopAndDestroy( &files );
@@ -326,12 +328,21 @@
     FLOG( "CAppMngr2SisxAppInfo::ShowDetailsL, isDRM %d, noRightsObj %d, CertCount %d",
             iIsDRMProtected, iIsRightsObjectMissingOrExpired, iCertificates.Count() );
 
+    RFile fileHandle;
+    TInt fileOpenError = KErrNone;
     if( iIsDRMProtected && !iIsRightsObjectMissingOrExpired )
         {
-        RFile fileHandle;
-        TInt err = fileHandle.Open( iFs, *iProtectedFile, EFileShareReadersOnly | EFileRead );
-        CleanupClosePushL( fileHandle );
+        FLOG( "CAppMngr2SisxAppInfo::ShowDetailsL, iProtecteFile %S", iProtectedFile );
+        fileOpenError = fileHandle.Open( iFs, *iProtectedFile, EFileShareReadersOnly | EFileRead );
+        FLOG( "CAppMngr2SisxAppInfo::ShowDetailsL, fileOpenError %d", fileOpenError );
+        if( !fileOpenError )
+            {
+            CleanupClosePushL( fileHandle );
+            }
+        }
 
+    if( iIsDRMProtected && !iIsRightsObjectMissingOrExpired && !fileOpenError )
+        {
         if( iCertificates.Count() )
             {
             details->ExecuteLD( *iterator, iCertificates, fileHandle );
@@ -340,8 +351,6 @@
             {
             details->ExecuteLD( *iterator, fileHandle );
             }
-
-        CleanupStack::PopAndDestroy( &fileHandle );
         }
     else
         {
@@ -355,6 +364,11 @@
             }
         }
 
+    if( !fileOpenError )
+        {
+        CleanupStack::PopAndDestroy( &fileHandle );
+        }
+
     CleanupStack::PopAndDestroy( iterator );
     }
 
--- a/iaupdate/IAD/engine/bwins/iaupdateengineu.def	Fri Feb 19 22:57:02 2010 +0200
+++ b/iaupdate/IAD/engine/bwins/iaupdateengineu.def	Fri Mar 12 15:43:14 2010 +0200
@@ -87,4 +87,5 @@
 	?InternalizeL@TIAUpdateVersion@@QAEXABVTDesC16@@@Z @ 86 NONAME ; void TIAUpdateVersion::InternalizeL(class TDesC16 const &)
 	?SetToFloor@TIAUpdateVersion@@QAEXXZ @ 87 NONAME ; void TIAUpdateVersion::SetToFloor(void)
 	?SetToRoof@TIAUpdateVersion@@QAEXXZ @ 88 NONAME ; void TIAUpdateVersion::SetToRoof(void)
+	?IsWidgetInstalledL@IAUpdateUtils@@YAHABVTDesC16@@AAVTIAUpdateVersion@@@Z @ 89 NONAME ; int IAUpdateUtils::IsWidgetInstalledL(class TDesC16 const &, class TIAUpdateVersion &)
 
--- a/iaupdate/IAD/engine/controller/inc/iaupdatebasenodeimpl.h	Fri Feb 19 22:57:02 2010 +0200
+++ b/iaupdate/IAD/engine/controller/inc/iaupdatebasenodeimpl.h	Fri Mar 12 15:43:14 2010 +0200
@@ -64,6 +64,11 @@
      * @see MIAUpdateBaseNode::Uid
      **/
     virtual const TUid& Uid() const;
+	
+	/**
+     * @see MIAUpdateBaseNode::Identifier
+     **/
+    virtual const TDesC& Identifier() const;
 
     /**
      * @see MIAUpdateBaseNode::Name
@@ -136,6 +141,11 @@
     virtual void SetInstallStatusToPurchaseHistoryL( 
         TInt aErrorCode, TBool aForceVisibleInHistory );
     
+    /**
+     * @see MIAUpdateBaseNode::Mime
+     */
+    virtual const TDesC& Mime() const;
+    
     
 public: // ** New functions
 
@@ -277,6 +287,7 @@
     HBufC*                              iDescription;
     HBufC*                              iMime;
     TUid                                iUid;
+    HBufC*                              iIdentifier;
     TIAUpdateVersion                    iVersion;
     CIAUpdateNodeDetails*               iDetails;
     TBool                               iSelected;
--- a/iaupdate/IAD/engine/controller/inc/iaupdatectrlconsts.h	Fri Feb 19 22:57:02 2010 +0200
+++ b/iaupdate/IAD/engine/controller/inc/iaupdatectrlconsts.h	Fri Mar 12 15:43:14 2010 +0200
@@ -55,7 +55,7 @@
      *
      * @since S60 v3.2
      */
-    _LIT( KSoftwareVersion, "2.0.8" );
+    _LIT( KSoftwareVersion, "2.1.0" );
     
     /**
      * Product code value that is used when emulator is used.
--- a/iaupdate/IAD/engine/controller/inc/iaupdatenodecontainer.h	Fri Feb 19 22:57:02 2010 +0200
+++ b/iaupdate/IAD/engine/controller/inc/iaupdatenodecontainer.h	Fri Mar 12 15:43:14 2010 +0200
@@ -200,6 +200,9 @@
     // If same version of the node is installed, makes it hidden.
     TBool InstallCheckL( CIAUpdateNode& aNode ) const;
 
+    // Checks if  the head node ids / identifers are equal
+    TBool NodeExists( const CIAUpdateNode& aNode, 
+                      const CIAUpdateNode& tmpNode ) const;
     
 private: // data
 
--- a/iaupdate/IAD/engine/controller/inc/iaupdateprotocolconsts.h	Fri Feb 19 22:57:02 2010 +0200
+++ b/iaupdate/IAD/engine/controller/inc/iaupdateprotocolconsts.h	Fri Mar 12 15:43:14 2010 +0200
@@ -199,6 +199,11 @@
      * MIME for FOTA DP2 firmware update.
      */
     _LIT( KMimeFotiNsu, "application/x-nokia-foti-nsu" );
+    
+    /**
+     * MIME for widgets
+     */
+    _LIT( KMimeWidget, "application/x-nokia-widget" );
 
     }
     
--- a/iaupdate/IAD/engine/controller/src/iaupdatebasenodeimpl.cpp	Fri Feb 19 22:57:02 2010 +0200
+++ b/iaupdate/IAD/engine/controller/src/iaupdatebasenodeimpl.cpp	Fri Mar 12 15:43:14 2010 +0200
@@ -33,8 +33,11 @@
 #include "iaupdatecontentoperationmanager.h"
 #include "iaupdateutils.h"
 #include "iaupdatectrlnodeconsts.h"
+#include "iaupdateprotocolconsts.h"
 #include "iaupdatedebug.h"
-#include "iaupdateprotocolconsts.h"
+
+
+
 
 
 // -----------------------------------------------------------------------------
@@ -102,7 +105,20 @@
         {
         iMime = contentInfo->MimeType().AllocL();
         iVersion.InternalizeL( contentInfo->Version() );
-        iUid = contentInfo->Uid(); 
+
+        //Initialize iUid or iIdentifier according to the mime-type
+        iUid = KNullUid;
+
+        if ( iMime->Compare( IAUpdateProtocolConsts::KMimeWidget ) == 0 )
+            {
+            iIdentifier = contentInfo->Identifier().AllocL();
+            }
+        else
+           {
+           iUid = contentInfo->Uid();
+           iIdentifier = KNullDesC().AllocL();
+           }
+
         // Release content info.
         // So, we can later check if it still exists and then get 
         // new one if it exists.
@@ -144,6 +160,7 @@
     delete iName;    
     delete iDescription;
     delete iMime;
+	delete iIdentifier;
     delete iDetails;
     
     IAUPDATE_TRACE("[IAUPDATE] CIAUpdateBaseNode::~CIAUpdateBaseNode() end");
@@ -191,7 +208,17 @@
     IAUPDATE_TRACE_1("[IAUPDATE] CIAUpdateBaseNode::Uid() = %x", iUid);
     return iUid;
     }
-   
+
+
+// ---------------------------------------------------------------------------
+// CIAUpdateBaseNode::Identifier
+// 
+// ---------------------------------------------------------------------------
+//
+const TDesC& CIAUpdateBaseNode::Identifier() const
+    {
+    return *iIdentifier;
+    }
     
 // ---------------------------------------------------------------------------
 // CIAUpdateBaseNode::Name
@@ -370,6 +397,17 @@
     return;
     }
 
+// ---------------------------------------------------------------------------
+// CIAUpdateBaseNode::Mime
+// 
+// ---------------------------------------------------------------------------
+// 
+const TDesC& CIAUpdateBaseNode::Mime() const
+    {
+    return *iMime;
+    }
+
+
 
 // ---------------------------------------------------------------------------
 // Public functions
@@ -435,18 +473,29 @@
 // 
 TBool CIAUpdateBaseNode::Equals( const CIAUpdateBaseNode& aNode ) const
     {
-    if ( aNode.MetaNamespace() == MetaNamespace()
-            && aNode.MetaId() == MetaId()
-         || ( aNode.Uid() == Uid()
-            && aNode.Version() == Version() 
-            && aNode.iMime->Match( IAUpdateProtocolConsts::KMimeServicePackPattern()) == KErrNotFound ) ) 
+    TBool equals = EFalse;
+    if ( iMime->Compare( IAUpdateProtocolConsts::KMimeWidget ) == 0 )
         {
-        return ETrue;
+        if ( aNode.MetaNamespace() == MetaNamespace()
+                && aNode.MetaId() == MetaId()
+             || ( aNode.Identifier() == Identifier() 
+                && aNode.Version() == Version() ) )
+            {
+            equals = ETrue;
+            }
         }
-    else 
+    else
         {
-        return EFalse;
+        if ( aNode.MetaNamespace() == MetaNamespace()
+                && aNode.MetaId() == MetaId()
+             || ( aNode.Uid() == Uid()
+                && aNode.Version() == Version() 
+                && aNode.iMime->Match( IAUpdateProtocolConsts::KMimeServicePackPattern()) == KErrNotFound ) ) 
+            {
+            equals = ETrue;
+            }
         }
+    return equals;
     }
 
 
--- a/iaupdate/IAD/engine/controller/src/iaupdatenodecontainer.cpp	Fri Feb 19 22:57:02 2010 +0200
+++ b/iaupdate/IAD/engine/controller/src/iaupdatenodecontainer.cpp	Fri Mar 12 15:43:14 2010 +0200
@@ -32,6 +32,11 @@
 #include "iaupdatedebug.h"
 
 
+#include "ncdnodecontentinfo.h"
+#include "ncdnode.h"
+#include "iaupdateprotocolconsts.h"
+
+
 // Constant that is used to inform that dependency node
 // was not found when dependencies were checked.
 const TInt KDependencyNotFound( -1 );
@@ -665,8 +670,10 @@
         
         for ( TInt i = 0; i < iHeadNodes.Count(); ++i )
             {
-            CIAUpdateNode& tmpNode( *iHeadNodes[ i ] );            
-            if( aNode.Uid() == tmpNode.Uid() && aNode.Type() != MIAUpdateNode::EPackageTypeServicePack ) 
+            CIAUpdateNode& tmpNode( *iHeadNodes[ i ] );   
+            
+            if( NodeExists( aNode, tmpNode ) &&  
+                  aNode.Type() != MIAUpdateNode::EPackageTypeServicePack ) 
                 {
                 IAUPDATE_TRACE("[IAUPDATE] Head node already in the list.");
                 
@@ -726,7 +733,8 @@
     {
     IAUPDATE_TRACE("[IAUPDATE] CIAUpdateNodeContainer::ReplaceRecommendedL() begin");
     
-    if ( aCurrentNode.Uid() != aNewNode.Uid() )
+    
+    if ( !NodeExists( aCurrentNode, aNewNode ) )
         {
         IAUPDATE_TRACE("[IAUPDATE] LEAVE: Nodes do not match.");
         User::Leave( KErrArgument );
@@ -766,10 +774,11 @@
     IAUPDATE_TRACE("[IAUPDATE] CIAUpdateNodeContainer::PackageTypeAcceptedL() begin");
     
     if ( aNode.Type() == MIAUpdateNode::EPackageTypeServicePack
-         || aNode.Type() == MIAUpdateNode::EPackageTypeSA )
+         || aNode.Type() == MIAUpdateNode::EPackageTypeSA 
+         || aNode.Type() == MIAUpdateNode::EPackageTypeWidget )
         {
-        // Service packs and SA type always accepted.
-        IAUPDATE_TRACE("[IAUPDATE] Upgrade packet type SA or node is service pack");
+        // Service packs, SA types and Widgets are always accepted.
+        IAUPDATE_TRACE("[IAUPDATE] Upgrade packet type SA, service pack or widget");
         IAUPDATE_TRACE("[IAUPDATE] CIAUpdateNodeContainer::PackageTypeAcceptedL() end: ETrue");
         return ETrue;
         }
@@ -1053,9 +1062,17 @@
         {
         IAUPDATE_TRACE("[IAUPDATE] Not a service pack");
 
+     
         TIAUpdateVersion installedVersion;
-        TBool installed( 
-            IAUpdateUtils::IsAppInstalledL( aNode.Uid(), installedVersion ) );
+        TBool installed = EFalse;
+        if ( aNode.Mime().Compare( IAUpdateProtocolConsts::KMimeWidget ) == 0 )
+            {
+            installed = IAUpdateUtils::IsWidgetInstalledL( aNode.Identifier(), installedVersion );
+            }
+        else
+            {
+            installed = IAUpdateUtils::IsAppInstalledL( aNode.Uid(), installedVersion );
+            }
         // Notice that here we let the check pass also if node has the same version
         // as the installed content. By accepting same version, the dependency chains
         // will contain the currently installed node dependency information. Then,
@@ -1087,3 +1104,33 @@
 
     return checkPassed;
     }
+
+// Checks if  the head node ids / identifers are equal
+TBool CIAUpdateNodeContainer::NodeExists( const CIAUpdateNode& aNode, 
+                                          const CIAUpdateNode& tmpNode )const 
+    {
+    IAUPDATE_TRACE("[IAUPDATE] CIAUpdateNodeContainer::NodeExists begin");
+    
+    TBool exists = EFalse;
+
+    if ( aNode.Mime().Compare( IAUpdateProtocolConsts::KMimeWidget ) == 0 )
+        {
+        if ( aNode.Identifier() == tmpNode.Identifier() )
+            {
+            exists = ETrue;
+            }
+        }
+    else
+        {
+        if ( aNode.Uid() == tmpNode.Uid() )
+            {
+            exists = ETrue;
+            }
+        }
+    
+    
+    IAUPDATE_TRACE_1("[IAUPDATE] CIAUpdateNodeContainer::NodeExists end: %d",
+                     exists);
+    
+    return exists;
+    }
--- a/iaupdate/IAD/engine/controller/src/iaupdatenodeimpl.cpp	Fri Feb 19 22:57:02 2010 +0200
+++ b/iaupdate/IAD/engine/controller/src/iaupdatenodeimpl.cpp	Fri Mar 12 15:43:14 2010 +0200
@@ -20,6 +20,7 @@
 #include <ncdnodepurchase.h>
 #include <ncdnodedownload.h>
 #include <ncdnodeinstall.h>
+#include <ncdnodecontentinfo.h>
 
 #include "iaupdatenodeimpl.h"
 #include "iaupdatenodeobserver.h"
@@ -28,9 +29,11 @@
 #include "iaupdatecontrollerimpl.h"
 #include "iaupdateutils.h"
 #include "iaupdatecontentoperationmanager.h"
+#include "iaupdateprotocolconsts.h"
 #include "iaupdatedebug.h"
 
 
+
 // -----------------------------------------------------------------------------
 // CIAUpdateNode::NewLC
 // Two-phased constructor.
@@ -150,9 +153,18 @@
 //    
 MIAUpdateNode::TPackageType CIAUpdateNode::Type() const
     {
+    MIAUpdateNode::TPackageType packageType;
+    if ( Mime().Compare( IAUpdateProtocolConsts::KMimeWidget ) == 0 )
+        {
+        packageType = MIAUpdateNode::EPackageTypeWidget;
+        }
+    else
+        {
+        packageType = Details().ContentType();
+        }
     IAUPDATE_TRACE_1("[IAUPDATE] CIAUpdateNode::Type() = %d", 
-                     Details().ContentType());
-    return Details().ContentType();
+                             packageType );
+    return packageType;
     }
 
 
@@ -758,14 +770,26 @@
 void CIAUpdateNode::AddDependantL( CIAUpdateNode& aDependantNode ) 
     {
 	IAUPDATE_TRACE("[IAUPDATE] CIAUpdateNode::AddDependantL() begin");
+	
 
 	for ( TInt i = 0; i < iDependants.Count(); ++i )
 	    {
 	    CIAUpdateNode* node( iDependants[ i ] );
-	    if ( node->Uid() == aDependantNode.Uid() )
+	    if ( node->Mime().Compare( IAUpdateProtocolConsts::KMimeWidget) == 0 )
 	        {
-	        // Corresponding node is already in the array.
-	        return;
+	        if ( node->Identifier() == aDependantNode.Identifier() )
+	            {
+	            // Corresponding node is already in the array.
+	            return;
+	            }
+	        }
+	    else 
+	        {
+	        if ( node->Uid() == aDependantNode.Uid() )
+	            {
+	            // Corresponding node is already in the array.
+	            return;
+	            }
 	        }
 	    }
 
@@ -898,7 +922,18 @@
     IAUPDATE_TRACE("[IAUPDATE] CIAUpdateNode::IsInstalledL() begin");
 
     TIAUpdateVersion installedVersion;
-    TBool installed( IAUpdateUtils::IsAppInstalledL( Uid(), installedVersion ) );
+
+    TBool installed = EFalse;
+        
+    if ( Mime().Compare( IAUpdateProtocolConsts::KMimeWidget ) == 0 )
+        {
+        installed = IAUpdateUtils::IsWidgetInstalledL( Identifier(), installedVersion );
+        }
+    else 
+        {
+        installed = IAUpdateUtils::IsAppInstalledL( Uid(), installedVersion );
+        }    
+		
     IAUPDATE_TRACE_3("CIAUpdateNode::IsInstalledL() Installed version  %d.%d.%d", 
             installedVersion.iMajor, 
             installedVersion.iMinor, 
--- 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 <ncdpurchaseoption.h>
 
 #include <catalogsutils.h>
-
+#include <widgetregistryclient.h>
 
 //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<CWidgetInfo> 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
--- a/iaupdate/IAD/engine/eabi/iaupdateengineu.def	Fri Feb 19 22:57:02 2010 +0200
+++ b/iaupdate/IAD/engine/eabi/iaupdateengineu.def	Fri Mar 12 15:43:14 2010 +0200
@@ -217,4 +217,5 @@
 	_ZThn4_N21CIAUpdateXmlSubParser22OnIgnorableWhiteSpaceLERK6TDesC8i @ 216 NONAME ; #<thunk>#
 	_ZThn4_N21CIAUpdateXmlSubParser24OnProcessingInstructionLERK6TDesC8S2_i @ 217 NONAME ; #<thunk>#
 	_ZThn4_N21CIAUpdateXmlSubParser7OnErrorEi @ 218 NONAME ; #<thunk>#
+	_ZN13IAUpdateUtils18IsWidgetInstalledLERK7TDesC16R16TIAUpdateVersion @ 219 NONAME
 
--- a/iaupdate/IAD/engine/group/iaupdateengine.mmp	Fri Feb 19 22:57:02 2010 +0200
+++ b/iaupdate/IAD/engine/group/iaupdateengine.mmp	Fri Mar 12 15:43:14 2010 +0200
@@ -124,6 +124,9 @@
 // Updater files dll
 LIBRARY         iaupdaterfiles.lib
 
+// widget registry API library
+LIBRARY         widgetregistryclient.lib
+
 // NCD Engine
 LIBRARY         ncdengine_20019119.lib
 LIBRARY         ncdutils_20019119.lib
--- a/iaupdate/IAD/engine/inc/iaupdatebasenode.h	Fri Feb 19 22:57:02 2010 +0200
+++ b/iaupdate/IAD/engine/inc/iaupdatebasenode.h	Fri Mar 12 15:43:14 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -63,7 +63,13 @@
      * @return const TUid& Uid of this node
      **/
     virtual const TUid& Uid() const = 0;
-        
+	
+	/*
+	 * This returns the identifier of widget. Normally it is a string --> "com.yiibu.hue"
+	 * This is the unique identifier of widget before installing on top of Symbian platform.
+     */
+     virtual const TDesC& Identifier() const = 0;    
+
     /**
      * @return const TDesC& The name of this node
      **/
@@ -161,6 +167,11 @@
      */
     virtual void SetInstallStatusToPurchaseHistoryL( 
         TInt aErrorCode, TBool aForceVisibleInHistory ) = 0;
+    
+    /**
+    * @return const TDesC& The mime type of this node
+    **/
+    virtual const TDesC& Mime() const = 0;
 
     
 protected:
--- a/iaupdate/IAD/engine/inc/iaupdatenode.h	Fri Feb 19 22:57:02 2010 +0200
+++ b/iaupdate/IAD/engine/inc/iaupdatenode.h	Fri Mar 12 15:43:14 2010 +0200
@@ -69,8 +69,13 @@
          * So, its content is given as separate packages
          * that are included in this service pack.
          */
-        EPackageTypeServicePack
-
+        EPackageTypeServicePack,
+        
+       /** 
+        * The node content is widget.
+        */
+        EPackageTypeWidget
+       
         };
 
 
--- a/iaupdate/IAD/engine/inc/iaupdateutils.h	Fri Feb 19 22:57:02 2010 +0200
+++ b/iaupdate/IAD/engine/inc/iaupdateutils.h	Fri Mar 12 15:43:14 2010 +0200
@@ -96,6 +96,11 @@
  **/
 IMPORT_C TBool IsAppInstalledL( const TUid& aUid, TIAUpdateVersion &aVersion );
 
+/**
+ * This function is added to check whether certain widget with given identifier are installed
+ * the function calls widget registry API
+ **/
+IMPORT_C TBool IsWidgetInstalledL( const TDesC& aIdentifier, TIAUpdateVersion &aVersion );
 
 IMPORT_C TBool SpaceAvailableInInternalDrivesL( 
                                          RPointerArray<MIAUpdateNode>& aNodes );
--- a/iaupdate/IAD/ui/group/iaupdate.mmp	Fri Feb 19 22:57:02 2010 +0200
+++ b/iaupdate/IAD/ui/group/iaupdate.mmp	Fri Mar 12 15:43:14 2010 +0200
@@ -69,6 +69,7 @@
 SOURCE            iaupdateinstallationlistener.cpp
 SOURCE            iaupdatedeputils.cpp
 SOURCE            iaupdateuitimer.cpp
+SOURCE            iaupdatenodeid.cpp
 
 USERINCLUDE       ../inc
 USERINCLUDE       ../../tools/inc
--- a/iaupdate/IAD/ui/group/iaupdate.rss	Fri Feb 19 22:57:02 2010 +0200
+++ b/iaupdate/IAD/ui/group/iaupdate.rss	Fri Mar 12 15:43:14 2010 +0200
@@ -698,6 +698,11 @@
     buf = qtn_swupdate_cannot_omit;
     }
 
+RESOURCE TBUF r_iaupdate_main_device_fw
+    {
+    buf  = qtn_swupdate_main_device_fw;
+    }
+
 //background check strings
 
 RESOURCE LBUF r_iaupdate_update_available
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/iaupdate/IAD/ui/inc/iaupdatenodeid.h	Fri Mar 12 15:43:14 2010 +0200
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   This module contains the header file of CIAUpdateNodeId
+*                class.
+*/
+
+
+
+
+#ifndef IAUPDATENODEID_H
+#define IAUPDATENODEID_H
+
+//INCLUDES
+#include <e32base.h>
+
+#include "iaupdateanynode.h"
+
+
+/**
+ *
+ */
+class CIAUpdateNodeId : public CBase
+    {
+
+public:
+
+    static CIAUpdateNodeId* NewL();
+
+    static CIAUpdateNodeId* NewLC();
+    
+    
+    virtual ~CIAUpdateNodeId();
+
+    const TDesC& Id() const;
+    void SetIdL( const TDesC& aId );
+    
+    const TDesC& Namespace() const;
+    void SetNamespaceL( const TDesC& aNamespace );
+    
+    MIAUpdateAnyNode::TNodeType NodeType() const;
+    void SetNodeType( MIAUpdateAnyNode::TNodeType aNodeType );
+    
+    TBool Selected() const;
+    void SetSelected( TInt aSelected );
+    
+
+private:
+
+    // Prevent these if not implemented
+    CIAUpdateNodeId( const CIAUpdateNodeId& aObject );
+    CIAUpdateNodeId& operator =( const CIAUpdateNodeId& aObject );
+
+
+    CIAUpdateNodeId();
+    
+    void ConstructL();
+
+
+private: // data
+    
+    HBufC* iId;
+    HBufC* iNamespace;
+    MIAUpdateAnyNode::TNodeType  iNodeType;
+    TBool                        iSelected;
+    
+    };
+		
+#endif // IAUPDATENODEID_H
+
--- a/iaupdate/IAD/ui/inc/iaupdateuicontroller.h	Fri Feb 19 22:57:02 2010 +0200
+++ b/iaupdate/IAD/ui/inc/iaupdateuicontroller.h	Fri Mar 12 15:43:14 2010 +0200
@@ -47,15 +47,7 @@
 class MIAUpdateUiControllerObserver;
 class MIAUpdateHistory;
 class MIAUpdateFwNode;
-
-
-struct SIAUpdateNodeId
-    {
-    MIAUpdateAnyNode::TNodeType  iNodeType;
-    TUid                         iPackageUid;
-    TIAUpdateVersion             iVersion;	
-    TBool                        iSelected;
-    };
+class CIAUpdateNodeId;
 
 
 // CLASS DECLARATION
@@ -559,7 +551,7 @@
 
     RPointerArray< MIAUpdateFwNode > iFwNodes;   
    
-    CArrayFix<SIAUpdateNodeId>* iPreviousSelections;
+    RPointerArray<CIAUpdateNodeId> iPreviousSelections;
     
     RPointerArray<MIAUpdateNode> iServicePackNodes;
  
--- a/iaupdate/IAD/ui/src/iaupdatedetailsdialog.cpp	Fri Feb 19 22:57:02 2010 +0200
+++ b/iaupdate/IAD/ui/src/iaupdatedetailsdialog.cpp	Fri Mar 12 15:43:14 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -143,13 +143,13 @@
 
     TPtr ptr = iBuf->Des();
     
-    //TPtrC name =         iParam->iNode->Base().Name();
+    TPtrC name =         iParam->iNode->Base().Name();
     TPtrC description =  iParam->iNode->Base().Description();
     TIAUpdateVersion version = iParam->iNode->Base().Version();
     TInt contentSize =   iParam->iNode->Base().ContentSizeL();
     
     
-    /*HBufC* hBuf = StringLoader::LoadLC( R_IAUPDATE_DETAILS_DIALOG_APP_NAME );
+    HBufC* hBuf = StringLoader::LoadLC( R_IAUPDATE_DETAILS_DIALOG_APP_NAME );
     ptr.Append( KOpeningBoldTag );
     ptr.Append( *hBuf );
     ptr.Append( KClosingBoldTag );
@@ -158,9 +158,9 @@
     ptr.Append( KNewLine );
     ptr.Append( name );
     ptr.Append( KNewLine );
-    ptr.Append( KNewLine );*/
-    
-    HBufC* hBuf = StringLoader::LoadLC( R_IAUPDATE_DETAILS_DIALOG_DESCRIPTION );
+    ptr.Append( KNewLine );
+       
+    hBuf = StringLoader::LoadLC( R_IAUPDATE_DETAILS_DIALOG_DESCRIPTION );
     ptr.Append( KOpeningBoldTag );
     ptr.Append( *hBuf );
     ptr.Append( KClosingBoldTag );
@@ -211,9 +211,9 @@
 	{
 	ConstructTextL();
 
-	//HBufC* hBuf = StringLoader::LoadLC( R_IAUPDATE_DETAILS_DIALOG_TITLE );
-	IAUpdateDialogUtil::ShowMessageQueryL( iParam->iNode->Base().Name(), *iBuf );
-	//CleanupStack::PopAndDestroy( hBuf );
+	HBufC* hBuf = StringLoader::LoadLC( R_IAUPDATE_DETAILS_DIALOG_TITLE );
+	IAUpdateDialogUtil::ShowMessageQueryL( *hBuf, *iBuf );
+	CleanupStack::PopAndDestroy( hBuf );
     
     return ETrue;
 	}
--- a/iaupdate/IAD/ui/src/iaupdatefwdetailsdialog.cpp	Fri Feb 19 22:57:02 2010 +0200
+++ b/iaupdate/IAD/ui/src/iaupdatefwdetailsdialog.cpp	Fri Mar 12 15:43:14 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -35,6 +35,8 @@
 const TInt KMegaByte = 1024 * 1024;
 const TInt KMaxShownInKiloBytes = 10 * KMegaByte;
 
+_LIT( KSpace, " ");
+
 
 /*******************************************************************************
  * class CIAUpdateDetailsDialog
@@ -139,8 +141,29 @@
  
     TInt contentSize =   iFwNode->Base().ContentSizeL();
      
+    HBufC* hBuf = StringLoader::LoadLC( R_IAUPDATE_DETAILS_DIALOG_APP_NAME );
+    ptr.Append( KOpeningBoldTag );
+    ptr.Append( *hBuf );
+    ptr.Append( KClosingBoldTag );
+    CleanupStack::PopAndDestroy( hBuf );
     
-    HBufC* hBuf = StringLoader::LoadLC( R_IAUPDATE_DETAILS_DIALOG_DESCRIPTION );
+    HBufC* firmwareHeader = StringLoader::LoadLC(R_IAUPDATE_MAIN_DEVICE_FW);
+    HBufC* firmwarename = HBufC::NewLC( iFwNode->Base().Name().Length() +
+                                        KSpace.iTypeLength + 
+                                        firmwareHeader->Length() );
+    firmwarename->Des() = iFwNode->Base().Name();
+    firmwarename->Des() += KSpace();
+    firmwarename->Des() += *firmwareHeader;
+     
+    ptr.Append( KNewLine );
+    ptr.Append( *firmwarename );
+    CleanupStack::PopAndDestroy( firmwarename );
+    CleanupStack::PopAndDestroy( firmwareHeader );
+    ptr.Append( KNewLine );
+    ptr.Append( KNewLine );
+  
+    
+    hBuf = StringLoader::LoadLC( R_IAUPDATE_DETAILS_DIALOG_DESCRIPTION );
     ptr.Append( KOpeningBoldTag );
     ptr.Append( *hBuf );
     ptr.Append( KClosingBoldTag );
@@ -195,13 +218,12 @@
 TBool CIAUpdateFwDetailsDialog::ShowDialogL()
 	{
 	ConstructTextL();
-	HBufC* firmwarename = iFwNode->Base().Name().AllocLC();
-	IAUpdateDialogUtil::ShowMessageQueryL( *firmwarename, *iBuf );
-    CleanupStack::PopAndDestroy( firmwarename );
+	HBufC* hBuf = StringLoader::LoadLC( R_IAUPDATE_DETAILS_DIALOG_TITLE );
+	IAUpdateDialogUtil::ShowMessageQueryL( *hBuf, *iBuf );
+	CleanupStack::PopAndDestroy( hBuf );
     return ETrue;
 	}
 
-
 // -----------------------------------------------------------------------------
 // CIAUpdateFwDetailsDialog::FileSizeTextLC
 // 
--- a/iaupdate/IAD/ui/src/iaupdatemaincontainer.cpp	Fri Feb 19 22:57:02 2010 +0200
+++ b/iaupdate/IAD/ui/src/iaupdatemaincontainer.cpp	Fri Mar 12 15:43:14 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -426,19 +426,17 @@
             CleanupStack::PopAndDestroy( buffer );
             CleanupStack::PopAndDestroy( name );
             }
-
         
         if ( node->NodeType() == MIAUpdateAnyNode::ENodeTypeFw ) 
             {
-            MIAUpdateFwNode* fwnode = static_cast<MIAUpdateFwNode*>( node );
+            HBufC* firmwareHeader = StringLoader::LoadLC(R_IAUPDATE_MAIN_DEVICE_FW);
             HBufC* firmwarename = HBufC::NewLC( node->Base().Name().Length() +
-                                                KSpace.iTypeLength +
-                                                fwnode->FwVersion1().Length() );  
+                                                KSpace.iTypeLength + 
+                                                firmwareHeader->Length() );
             firmwarename->Des() = node->Base().Name();
             firmwarename->Des() += KSpace();
-            firmwarename->Des() += fwnode->FwVersion1();
-            
-            
+            firmwarename->Des() += *firmwareHeader;
+                     
             HBufC* buffer = HBufC::NewLC( KOne.iTypeLength +
                                           KTabulator.iTypeLength + 
                                           firmwarename->Length() + 
@@ -457,6 +455,7 @@
             iItemTextArray->AppendL( *buffer );
             CleanupStack::PopAndDestroy( buffer );
             CleanupStack::PopAndDestroy( firmwarename );
+            CleanupStack::PopAndDestroy( firmwareHeader );
             }
         
         CleanupStack::PopAndDestroy( importanceDescription );
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/iaupdate/IAD/ui/src/iaupdatenodeid.cpp	Fri Mar 12 15:43:14 2010 +0200
@@ -0,0 +1,179 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   This module contains the implementation of CIAUpdateNodeId
+*                class member functions.
+*/
+
+
+
+
+#include "iaupdatenodeid.h"
+
+
+// -----------------------------------------------------------------------------
+// CIAUpdateNodeId::NewL
+//
+// -----------------------------------------------------------------------------
+//
+CIAUpdateNodeId* CIAUpdateNodeId::NewL()
+    {
+    CIAUpdateNodeId* self =
+        CIAUpdateNodeId::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CIAUpdateNodeId::NewLC
+//
+// -----------------------------------------------------------------------------
+//
+CIAUpdateNodeId* CIAUpdateNodeId::NewLC()
+    {
+    CIAUpdateNodeId* self =
+        new( ELeave) CIAUpdateNodeId();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;    
+    }
+
+
+// -----------------------------------------------------------------------------
+// CIAUpdateNodeId::CIAUpdateNodeId
+//
+// -----------------------------------------------------------------------------
+//
+CIAUpdateNodeId::CIAUpdateNodeId()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CIAUpdateNodeId::ConstructL
+//
+// -----------------------------------------------------------------------------
+//
+void CIAUpdateNodeId::ConstructL()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CIAUpdateNodeId::~CIAUpdateNodeId
+//
+// -----------------------------------------------------------------------------
+//
+CIAUpdateNodeId::~CIAUpdateNodeId()
+    {
+    delete iId;
+    delete iNamespace;
+    }
+
+// -----------------------------------------------------------------------------
+// CIAUpdateNodeId::Id
+//
+// -----------------------------------------------------------------------------
+//
+const TDesC& CIAUpdateNodeId::Id() const
+    {
+    if ( !iId )
+        {
+        return KNullDesC;
+        }
+        
+    return *iId;
+    }
+    
+
+// -----------------------------------------------------------------------------
+// CIAUpdateNodeId::SetIdL
+//
+// -----------------------------------------------------------------------------
+//
+void CIAUpdateNodeId::SetIdL( const TDesC& aId )
+    {
+    HBufC* tmp( aId.AllocL() );
+    delete iId;
+    iId = tmp;
+    }
+    
+    
+// -----------------------------------------------------------------------------
+// CIAUpdateNodeId::Namespace
+//
+// -----------------------------------------------------------------------------
+//
+const TDesC& CIAUpdateNodeId::Namespace() const
+    {
+    if ( !iNamespace )
+        {
+        return KNullDesC;
+        }
+    
+    return *iNamespace;
+    }
+    
+
+// -----------------------------------------------------------------------------
+// CIAUpdateNodeId::SetNamespaceL
+//
+// -----------------------------------------------------------------------------
+//
+void CIAUpdateNodeId::SetNamespaceL( const TDesC& aNamespace )
+    {
+    HBufC* tmp( aNamespace.AllocL() );
+    delete iNamespace;
+    iNamespace = tmp;
+    }
+
+// -----------------------------------------------------------------------------
+// CIAUpdateNodeId::NodeType
+//
+// -----------------------------------------------------------------------------
+//
+MIAUpdateAnyNode::TNodeType CIAUpdateNodeId::NodeType() const
+    {
+    return iNodeType;
+    }
+
+// -----------------------------------------------------------------------------
+// CIAUpdateNodeId::SetNodeType
+//
+// -----------------------------------------------------------------------------
+//
+void CIAUpdateNodeId::SetNodeType( MIAUpdateAnyNode::TNodeType aNodeType )
+    {
+    iNodeType = aNodeType;
+    }
+
+// -----------------------------------------------------------------------------
+// CIAUpdateNodeId::Selected
+//
+// -----------------------------------------------------------------------------
+//
+TBool CIAUpdateNodeId::Selected() const
+    {
+    return iSelected;
+    }
+    
+// -----------------------------------------------------------------------------
+// CIAUpdateNodeId::SetSelected
+//
+// -----------------------------------------------------------------------------
+//    
+void CIAUpdateNodeId::SetSelected( TInt aSelected )
+    {
+    iSelected = aSelected; 
+    }
--- a/iaupdate/IAD/ui/src/iaupdateuicontroller.cpp	Fri Feb 19 22:57:02 2010 +0200
+++ b/iaupdate/IAD/ui/src/iaupdateuicontroller.cpp	Fri Mar 12 15:43:14 2010 +0200
@@ -63,6 +63,7 @@
 #include "iaupdatefileconsts.h"
 #include "iaupdatefirsttimeinfo.h"
 #include "iaupdaterefreshhandler.h"
+#include "iaupdatenodeid.h"
 #include "iaupdatedebug.h"
 
 
@@ -256,6 +257,7 @@
     iFwNodes.Reset();
     iSelectedNodesArray.Reset();
     iServicePackNodes.Reset();
+    iPreviousSelections.Reset();
     delete iFilter;
     delete iControllerFile;
     delete iIdle;
@@ -264,7 +266,6 @@
     delete iRoamingHandler;
     delete iParams;
     delete iRefreshHandler;
-    delete iPreviousSelections;
 
     // If dialogs have not been released yet, release them now.
     // ProcessFinishedL() should normally be used for dialogs but
@@ -1576,29 +1577,32 @@
         if ( appUi->UiRefreshAllowed() )
 		    {
 	    	iState = EUiRefreshing;
-	        // store node identification (package UID and version) of currently selected nodes
+	        // store node identification (Id and namespace) of currently selected nodes
 	        // to restore selections after refresh
-	        delete iPreviousSelections;
-	        iPreviousSelections = NULL;
-	        iPreviousSelections = new( ELeave ) CArrayFixFlat<SIAUpdateNodeId>( iNodes.Count() + 1 );
-	        for ( TInt i = 0; i < iNodes.Count(); ++i )
+	        iPreviousSelections.Reset();
+	    	for ( TInt i = 0; i < iNodes.Count(); ++i )
                 {
                 MIAUpdateNode* node( iNodes[ i ] );
-                SIAUpdateNodeId nodeId;
-                nodeId.iNodeType = MIAUpdateAnyNode::ENodeTypeNormal;
-                nodeId.iPackageUid = node->Base().Uid();
-                nodeId.iVersion = node->Base().Version();
-                nodeId.iSelected = node->Base().IsSelected();
-                iPreviousSelections->AppendL( nodeId );
+                CIAUpdateNodeId* nodeId = CIAUpdateNodeId::NewLC();
+                nodeId->SetIdL( node->Base().MetaId() );
+                nodeId->SetNamespaceL( node->Base().MetaNamespace() );
+                nodeId->SetNodeType( MIAUpdateAnyNode::ENodeTypeNormal );
+                nodeId->SetSelected( node->Base().IsSelected() );
+                iPreviousSelections.AppendL( nodeId );
+                CleanupStack::Pop( nodeId );
+                
                 }
 
             if ( iFwNodes.Count() > 0 )
-                {   
+                {
                 MIAUpdateFwNode* fwNode( iFwNodes[ 0 ] );
-                SIAUpdateNodeId nodeId;
-                nodeId.iNodeType = MIAUpdateAnyNode::ENodeTypeFw;
-                nodeId.iSelected = fwNode->Base().IsSelected();
-                iPreviousSelections->AppendL( nodeId );
+                CIAUpdateNodeId* nodeId = CIAUpdateNodeId::NewLC();
+                nodeId->SetIdL( fwNode->Base().MetaId() );
+                nodeId->SetNamespaceL( fwNode->Base().MetaNamespace() );
+                nodeId->SetNodeType( MIAUpdateAnyNode::ENodeTypeFw );
+                nodeId->SetSelected( fwNode->Base().IsSelected() );
+                iPreviousSelections.AppendL( nodeId );
+                CleanupStack::Pop( nodeId );
                 }
         
    	        iController->StartRefreshL( EFalse );
@@ -1717,10 +1721,10 @@
     // Find out if there was umarked firmware update in old selections,
     // that case needs special handling
     TBool unmarkedFw = EFalse;
-    for ( TInt i = 0; i < iPreviousSelections->Count(); ++i )
+    for ( TInt i = 0; i < iPreviousSelections.Count(); ++i )
         {
-        SIAUpdateNodeId prevNodeId = iPreviousSelections->At( i );
-        if ( prevNodeId.iNodeType == MIAUpdateAnyNode::ENodeTypeFw  && !prevNodeId.iSelected )
+        CIAUpdateNodeId* prevNodeId( iPreviousSelections[ i ] );
+        if ( prevNodeId->NodeType() == MIAUpdateAnyNode::ENodeTypeFw  && !prevNodeId->Selected() )
              {
              unmarkedFw = ETrue;
              }
@@ -1763,13 +1767,13 @@
     for ( TInt i = 0; i < iNodes.Count(); ++i )
         {
         MIAUpdateNode* node( iNodes[ i ] );
-        for ( TInt j = 0; j < iPreviousSelections->Count(); ++j )
+        for ( TInt j = 0; j < iPreviousSelections.Count(); ++j )
             {
-            SIAUpdateNodeId prevNodeId = iPreviousSelections->At(j);
-        	if ( node->Base().Uid() == prevNodeId.iPackageUid &&
-        	     node->Base().Version() == prevNodeId.iVersion )
-                {
-        		node->Base().SetSelected( prevNodeId.iSelected );
+            CIAUpdateNodeId* prevNodeId( iPreviousSelections[ j ] );
+        	if ( node->Base().MetaId() == prevNodeId->Id() && 
+        	     node->Base().MetaNamespace() == prevNodeId->Namespace() )
+        	    {
+        	    node->Base().SetSelected( prevNodeId->Selected() );
         	    }
             }
         }
@@ -1788,12 +1792,12 @@
     for ( TInt i = 0; i < iFwNodes.Count(); ++i )
         {
         MIAUpdateFwNode* fwNode( iFwNodes[ i ] );
-    	for ( TInt j = 0; j < iPreviousSelections->Count(); ++j )
+    	for ( TInt j = 0; j < iPreviousSelections.Count(); ++j )
     	    {
-    	    SIAUpdateNodeId prevNodeId = iPreviousSelections->At(j);
-    		if ( prevNodeId.iNodeType == MIAUpdateAnyNode::ENodeTypeFw )
+    	    CIAUpdateNodeId* prevNodeId( iPreviousSelections[ j ] );
+    		if ( prevNodeId->NodeType() == MIAUpdateAnyNode::ENodeTypeFw )
     		    {
-    			fwNode->Base().SetSelected( prevNodeId.iSelected );
+    			fwNode->Base().SetSelected( prevNodeId->Selected() );
     		    }
     	    }
     	if ( fwNode->Base().IsSelected() )
--- a/iaupdate/group/bld.inf	Fri Feb 19 22:57:02 2010 +0200
+++ b/iaupdate/group/bld.inf	Fri Mar 12 15:43:14 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -15,8 +15,6 @@
 *
 */
 
-#ifdef FF_IAUPDATE
-
 #include <platform_paths.hrh>
 
 PRJ_PLATFORMS
@@ -38,6 +36,5 @@
 ../rom/iaupdate.iby            CORE_MW_LAYER_IBY_EXPORT_PATH( iaupdate.iby )
 ../rom/iaupdateresources.iby   LANGUAGE_MW_LAYER_IBY_EXPORT_PATH( iaupdateresources.iby )
 
-#endif //FF_IAUPDATE
 
 
Binary file iaupdate/rom/iaupdate_stub.SIS has changed
--- a/iaupdate/rom/iaupdate_stub.pkg	Fri Feb 19 22:57:02 2010 +0200
+++ b/iaupdate/rom/iaupdate_stub.pkg	Fri Mar 12 15:43:14 2010 +0200
@@ -16,7 +16,7 @@
 &EN
 
 ;Header 
-#{"Software update"}, (0x2000f85a), 2, 0, 8, TYPE=SA
+#{"Application update"}, (0x2000f85a), 2, 1, 0, TYPE=SA
 
 ;Localised Vendor Name
 %{"Nokia"}
--- a/iaupdateapi_stub/group/bld.inf	Fri Feb 19 22:57:02 2010 +0200
+++ b/iaupdateapi_stub/group/bld.inf	Fri Mar 12 15:43:14 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -28,12 +28,9 @@
 
 ../rom/iaupdateapi.iby             CORE_MW_LAYER_IBY_EXPORT_PATH( iaupdateapi.iby )
 
-#ifndef FF_IAUPDATE
-../sis/iaupdate_stub.sis        /epoc32/data/z/system/install/iaupdate_stub.sis
-#endif //FF_IAUPDATE
+../sis/iaupdate_stub.sis        /epoc32/data/z/system/install/stub_iaupdate_stub.sis
 
 PRJ_MMPFILES
-#ifndef FF_IAUPDATE
 iaupdateapi.mmp
-#endif //FF_IAUPDATE
 
+
--- a/iaupdateapi_stub/group/iaupdateapi.mmp	Fri Feb 19 22:57:02 2010 +0200
+++ b/iaupdateapi_stub/group/iaupdateapi.mmp	Fri Mar 12 15:43:14 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -21,14 +21,10 @@
 
 CAPABILITY      CAP_GENERAL_DLL
 
-#if defined(WINS) || defined(WINSCW)
-TARGET          iaupdateapi.dll
-#else
 TARGET          iaupdateapi_stub.dll
-#endif
 
 LINKAS          iaupdateapi.dll
-EXPORTLIBRARY   iaupdateapi.lib
+EXPORTLIBRARY   iaupdateapi_stub.lib
 
 TARGETTYPE      dll
 UID             0x1000008d 0x2000F85C
--- a/iaupdateapi_stub/rom/iaupdateapi.iby	Fri Feb 19 22:57:02 2010 +0200
+++ b/iaupdateapi_stub/rom/iaupdateapi.iby	Fri Mar 12 15:43:14 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -23,7 +23,7 @@
 
 #ifndef FF_IAUPDATE 
 file=ABI_DIR\BUILD_DIR\iaupdateapi_stub.dll    SHARED_LIB_DIR\iaupdateapi.dll
-data=ZSYSTEM\install\iaupdate_stub.sis    System\Install\iaupdate_stub.sis
+data=ZSYSTEM\install\stub_iaupdate_stub.sis    System\Install\iaupdate_stub.sis
 #endif //FF_IAUPDATE 
 
 
--- a/installationservices/swi/inc/switextshell.iby	Fri Feb 19 22:57:02 2010 +0200
+++ b/installationservices/swi/inc/switextshell.iby	Fri Mar 12 15:43:14 2010 +0200
@@ -95,9 +95,6 @@
 file=ABI_DIR\BUILD_DIR\cafdataprovider.dll			sys\bin\cafdataprovider.dll
 file=ABI_DIR\BUILD_DIR\pkgremover.dll				sys\bin\pkgremover.dll
 
-// OMX IL component common(Temp Fix to Build navi text shell images)
-file=ABI_DIR\BUILD_DIR\omxilcomponentcommon.dll    System\Libs\omxilcomponentcommon.dll
-
 // Core SWI - 9.5
 REM Including swiplugin.iby instead explicitly mentioning the files to avoid duplicate includes 
 #include "swiplugin.iby"
--- a/installationservices/swi/source/securitymanager/certchainconstraints.cpp	Fri Feb 19 22:57:02 2010 +0200
+++ b/installationservices/swi/source/securitymanager/certchainconstraints.cpp	Fri Mar 12 15:43:14 2010 +0200
@@ -26,7 +26,6 @@
 #include "certchainconstraints.h"
 #include "x509constraintext.h"
 #include <x509certext.h>
-#include <collate.h> 
 //#include "log.h"
 
 using namespace Swi;
@@ -88,21 +87,17 @@
 	{
 	return iValidCapabilities.HasCapabilities(aRequestCapabilities);
 	}
-
+	
 EXPORT_C TBool CCertChainConstraints::DeviceIDIsValid(const HBufC* aRequestDeviceID) const
 	{
 	TBool ret=EFalse;
 	if (iDeviceIDsAreConstrained)
 		{
 		TInt deviceIDCount=iValidDeviceIDs.Count();
-
-		TCollationMethod m = *Mem::CollationMethodByIndex(0); // get the standard method
-		m.iFlags |= TCollationMethod::EFoldCase; // Convert to lowercase and compare.
-
 		//Check if request Device ID is in the valid device ID list
 		for(TInt i=0; i<deviceIDCount; i++)
 			{
-			if (iValidDeviceIDs[i]->CompareC(*aRequestDeviceID, 0, &m) ==0)
+			if (iValidDeviceIDs[i]->CompareF(*aRequestDeviceID)==0)
 				{
 				ret=ETrue;
 				break;
--- a/ncdengine/engine/group/config.xml	Fri Feb 19 22:57:02 2010 +0200
+++ b/ncdengine/engine/group/config.xml	Fri Mar 12 15:43:14 2010 +0200
@@ -5,7 +5,7 @@
 	<type>vanilla</type>
 	
 	<!-- Provider version -->
-	<version>5.1.920</version>
+	<version>9.2.1006</version>
 	
 	<!-- Provider provisioning -->
 	<!-- <provisioning>PoronVisio</provisioning> -->
--- a/ncdengine/engine/transport/inc/catalogshttpdownload.h	Fri Feb 19 22:57:02 2010 +0200
+++ b/ncdengine/engine/transport/inc/catalogshttpdownload.h	Fri Mar 12 15:43:14 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -480,6 +480,11 @@
     void UpdateExtensionL();
     
     /**
+     *  Replace current extension at aName with extension given (eExt).
+     */
+    void CCatalogsHttpDownload::ReplaceExtension( TDes& aName, const TDesC& aExt );
+    
+    /**
      * Checks the preset content-type and forces HEAD request if
      * content is OMA DD, JAD or some DRM file
      */
--- a/ncdengine/engine/transport/src/catalogshttpdownload.cpp	Fri Feb 19 22:57:02 2010 +0200
+++ b/ncdengine/engine/transport/src/catalogshttpdownload.cpp	Fri Mar 12 15:43:14 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -1044,7 +1044,8 @@
 
     // was >=, DL manager should give us proper errors but it doesn't always
     if ( ( statusCode == KHttpErrorStatus ||
-           globalErrorId == KGenericSymbianHttpError ) && 
+           globalErrorId == KGenericSymbianHttpError ||
+           globalErrorId == KErrDisMounted) && 
          aEvent.iDownloadState != EHttpDlFailed ) 
         {
         DLTRACE(("Setting download as failed because received a response >= 400" ));
@@ -2422,7 +2423,16 @@
     
     TFileName filename = iConfig->Filename();
     TDataType type( ContentType() );
-    iOwner.DocumentHandler().CheckFileNameExtension( filename, type );
+    
+    // Doc handler does not yet support Widget extension change
+    TFileName mimeType;
+    mimeType.Copy(type.Des8());
+    if ( mimeType.Compare(KMimeTypeMatchWidget) == 0 )
+            {
+            ReplaceExtension( filename, KWidgetExtension );
+            }
+    else
+       iOwner.DocumentHandler().CheckFileNameExtension( filename, type );
     
     iConfig->SetFilenameL( filename );        
     }
@@ -2650,3 +2660,18 @@
     return *iEncodedUri;
     }
 
+// ---------------------------------------------------------
+// CCatalogsHttpDownload::ReplaceExtension()
+// Replace current extension at aName with extension given (eExt).
+// ---------------------------------------------------------
+//      
+void CCatalogsHttpDownload::ReplaceExtension( TDes& aName, const TDesC& aExt )
+    {
+    
+    TInt dotPos = aName.LocateReverse( '.' );
+    if ( dotPos != KErrNotFound )
+       {
+       aName.Delete( dotPos, aName.Length()- dotPos );
+       aName.Append( aExt );
+       }
+    }
--- a/ncdengine/group/bld.inf	Fri Feb 19 22:57:02 2010 +0200
+++ b/ncdengine/group/bld.inf	Fri Mar 12 15:43:14 2010 +0200
@@ -41,7 +41,7 @@
 // This allows eclipsing the ROM base installation with normal SIS
 //****************************************************************************
 
-altair-engine-stub.SIS        /epoc32/data/z/system/install/altair-engine-stub.SIS
+../rom/altair-engine-stub.SIS   /epoc32/data/z/system/install/altair-engine-stub.SIS
 //altair-pcd-adapter-stub.SIS   /epoc32/data/z/system/install/altair-pcd-adapter-stub.SIS
 
 //****************************************************************************
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ncdengine/inc/catalogsconstants.h	Fri Mar 12 15:43:14 2010 +0200
@@ -0,0 +1,167 @@
+/*
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   Constants and definitions.
+*
+*/
+
+
+#ifndef CATALOGS_CONSTANTS_H
+#define CATALOGS_CONSTANTS_H
+
+#include <e32base.h>
+#include <e32msgqueue.h>
+
+#include "catalogsuids.h"
+
+// Replaced with USE_BUILD_SCRIPT when using build script
+#define DUMMY_DEFINE
+
+
+/**
+ * Catalogs engine mutex name. All engine object instances have a handle to the mutex.
+ * This can be used to determine if there are engine objects in use.
+ */
+#ifdef USE_BUILD_SCRIPT
+_LIT( KCatalogsEngineMutex, "ncd-engine-mutex_APP_NAME_POSTFIX" );
+#else
+_LIT( KCatalogsEngineMutex, "ncd-engine-mutex_20019119" ); 
+#endif // USE_BUILD_SCRIPT
+
+/**
+ * Note on RProperty usage.
+ * RProperty is defined by category and key.
+ * 
+ * The engine server side process defines RProperty that is defined
+ * to have category value equal to SID of the process.
+ * Two kinds of info are published using RProperty. 
+ * - general settings (currently only maintenance lock status)
+ * - client specific connection activity indicator
+ * 
+ * Connection activity uses RProperty with key that is same as client SID.
+ * Because both information are published within the same category, we must ensure
+ * that there are no conflicts in key values. To ensure this, following assumptions
+ * about keys are used:
+ * - all settings values (such as maintenance lock) must be from protected UID
+ * range class 0 (0x00000000 - 0x0FFFFFFF)
+ * - all engine clients must use UIDs from class 2 (0x20000000 - 0x2FFFFFFF)
+ */
+
+/** Catalogs engine property category */
+const TUid KCatalogsEnginePropertyCategory = { KCatalogsServerUid };
+
+/** 
+ * Catalogs engine maintenance lock property key. Written when locking/releasing
+ * (0 = released).
+ */
+const TUint KCatalogsEnginePropertyKeyMaintenanceLock = 1;
+
+/**
+ * Catalogs update message queue name format string. Global message queue with this
+ * name is created 
+ */
+_LIT( KCatalogsUpdateQueueNameFormat, "CatalogsUpdate-%08x" );
+
+/** Catalogs OTA update message queue message size */
+const TInt KCatalogsUpdateQueueMessageSize = RMsgQueueBase::KMaxLength;
+const TInt KCatalogsUpdateQueueSlotCount = 32;
+
+/** Catalogs engine ECom implementation uid */
+const TUid KCCatalogsEngineImplUid = { KCatalogsEngineImplementationUid };
+
+/** Catalogs OTA update information maximum field sizes */
+const TInt KCatalogsUpdateInformationMaxSize = 3*1024;
+const TInt KCatalogsUpdateTargetMaxSize = 256;
+const TInt KCatalogsUpdateIdMaxSize = 1024;
+const TInt KCatalogsUpdateVersionMaxSize = 256;
+const TInt KCatalogsUpdateUriMaxSize = 1024;
+
+
+/**
+ * Mime type match strings. 
+ */
+
+_LIT( KMimeTypeMatchSymbianInstall,   "application/vnd.symbian.install" );
+_LIT( KMimeTypeMatch1JavaApplication, "*java?archive" );
+_LIT( KMimeTypeMatch2JavaApplication, "application/java-archive" );
+_LIT( KMimeTypeMatchRealMedia,        "application/vnd.rn-realmedia" );
+_LIT( KMimeTypeMatchApplicationStream,"application/octet-stream" );
+_LIT( KMimeTypeMatchApplication,      "application/*" );
+
+_LIT( KMimeTypeMatchSis,  "x-epoc/x-app268436505" );
+_LIT( KMimeTypeMatchSisx, "x-epoc/x-sisx-app" );
+
+
+_LIT( KMimeTypeMatchHtml, "text/html" );
+_LIT( KMimeTypeMatchTxt,  "text/plain" );
+_LIT( KMimeTypeMatchCod,  "text/x-co-desc" );
+_LIT8( KMimeTypeXml, "text/xml" );
+
+_LIT( KMimeTypeMatchDrmMessage,     "application/vnd.oma.drm.message" );
+_LIT( KMimeTypeMatchDrmRightsXml,   "application/vnd.oma.drm.rights+xml" );
+_LIT( KMimeTypeMatchDrmRightsWbxml, "application/vnd.oma.drm.rights+wbxml" );
+_LIT8( KMimeTypeMatchDrmRightsXml8,   "application/vnd.oma.drm.rights+xml" );
+_LIT8( KMimeTypeMatchDrmRightsWbxml8, "application/vnd.oma.drm.rights+wbxml" );
+_LIT( KMimeTypeMatchDrmContent,     "application/vnd.oma.drm.content" );
+_LIT8( KMimeTypeMatchDrm8,            "application/vnd.oma.drm.*" );
+
+_LIT( KMimeTypeMatchOdd, "application/vnd.oma.dd*" );
+_LIT8( KMimeTypeMatchOdd8, "application/vnd.oma.dd*" );
+
+_LIT( KMimeTypeMatchWidget, "application/x-nokia-widget" );
+
+_LIT( KHttpMatchString, "http://*" );
+
+// Descriptor types
+_LIT( KDescriptorTypeOdd, "dd" );
+_LIT( KDescriptorTypeJad, "jad" );
+
+_LIT( KMimeTypeMatchJad, "text/vnd.sun.j2me.app-descriptor" );
+_LIT8( KMimeTypeMatchJad8, "text/vnd.sun.j2me.app-descriptor" );
+
+_LIT( KDirectorySeparator, "\\" );
+
+// List granularity used in initializing various lists and arrays.
+const TInt KListGranularity( 8 );
+
+// CBufFlat expansion size, should not be very small for good 
+// performance.
+const TInt KBufExpandSize( 256 );
+
+// Granularity for CCatalogsStringManager's string arrays
+const TInt KStringArrayGranularity( 256 );
+
+
+// Query id for payment method query.
+_LIT( KQueryIdPaymentMethod, "deadbeef" );
+
+
+// Engine configuration file
+_LIT( KCatalogsConfigFile, "config.xml" );
+
+// Download manager root dir
+_LIT( KCatalogsDownloadMgrPath, "C:\\system\\dmgr\\%S\\downloads\\*.*" );
+
+// Number of attempts before we give up on connecting to download manager
+const TInt KCatalogsDlMgrConnectRetryAttempts = 5;
+
+// tenth of a second, the time between download manager connect attemps
+const TInt KCatalogsDlMgrConnectRetryInterval = 100000; 
+
+// File extension for widget
+_LIT( KWidgetExtension, ".wgz" );
+
+// Default widget version number
+_LIT( KDefVersion, "000" );
+
+#endif // CATALOGS_CONSTANTS_H
--- a/ncdengine/inc/ncdnodecontentinfo.h	Fri Feb 19 22:57:02 2010 +0200
+++ b/ncdengine/inc/ncdnodecontentinfo.h	Fri Mar 12 15:43:14 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -78,7 +78,6 @@
      */
     virtual TUid Uid() const = 0;
 
-
     /**
      * Different versions of the content items may exist. Thus,
      * a version identifier may be defined for the item. When installing
@@ -102,6 +101,15 @@
      */
     virtual TInt Size() const = 0;
 
+    /**
+     * This function is the indicative Identifier for the
+     * contents that are widgets. This can be used e.g. for checking
+     * if the widget has already been installed to the phone.
+     *
+     * @return The Identifer of the application item.
+     */
+    virtual const TDesC& Identifier() const = 0;
+
 
 protected:
 
--- a/ncdengine/provider/client/inc/ncdnodecontentinfoproxy.h	Fri Feb 19 22:57:02 2010 +0200
+++ b/ncdengine/provider/client/inc/ncdnodecontentinfoproxy.h	Fri Mar 12 15:43:14 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -122,6 +122,11 @@
      */     
     virtual TInt Size() const;
 
+    /**
+     * @see MNcdNodeContent::Identifier
+     */ 
+    const TDesC& Identifier() const;
+    
 protected:
 
     /**
@@ -171,6 +176,7 @@
 
     TUint iPurpose;
     HBufC* iMimeType;
+    HBufC* iIdentifier;
     TUid iUid;
     HBufC* iVersion;
     TInt iSize;
--- a/ncdengine/provider/client/src/ncdnodecontentinfoproxy.cpp	Fri Feb 19 22:57:02 2010 +0200
+++ b/ncdengine/provider/client/src/ncdnodecontentinfoproxy.cpp	Fri Mar 12 15:43:14 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -27,6 +27,7 @@
 #include "catalogsutils.h"
 #include "catalogsdebug.h"
 #include "ncderrors.h"
+#include "catalogsconstants.h"
 
 
 // ======== PUBLIC MEMBER FUNCTIONS ========
@@ -86,7 +87,10 @@
 
     delete iMimeType;
     iMimeType = NULL;
-
+    
+    delete iIdentifier;
+    iIdentifier = NULL;
+    
     delete iVersion;
     iVersion = NULL;
     }
@@ -166,6 +170,11 @@
     return *iMimeType;
     }
 
+const TDesC& CNcdNodeContentInfoProxy::Identifier() const
+    {
+    return *iIdentifier;
+    }
+
 TUid CNcdNodeContentInfoProxy::Uid() const
     {
     return iUid;
@@ -209,9 +218,19 @@
     InternalizeDesL( iMimeType, aStream );    
     DLINFO(( _L("Mime: %S"), iMimeType ));
     
-    iUid.iUid = aStream.ReadInt32L();    
-    DLINFO(( "Uid: %x", iUid.iUid ));
-    
+    //The Internalization here must be consistant with the externalization in CNcdNodeContentInfo
+    if ( iMimeType->Compare( KMimeTypeMatchWidget ) == 0 )
+        {
+        //widget
+        InternalizeDesL( iIdentifier, aStream );
+        }
+    else
+        {
+        //sis
+        iUid.iUid = aStream.ReadInt32L();   
+        DLINFO(( "Uid: %x", iUid.iUid )); 
+        }
+   
     InternalizeDesL( iVersion, aStream );    
     DLINFO(( _L("Version: %S"), iVersion ));
 
--- a/ncdengine/provider/client/src/ncdsilentinstalloperationproxy.cpp	Fri Feb 19 22:57:02 2010 +0200
+++ b/ncdengine/provider/client/src/ncdsilentinstalloperationproxy.cpp	Fri Mar 12 15:43:14 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -204,7 +204,18 @@
                 SilentInstallOptionsPackage() );             
             break;
             }            
-        
+
+        // Call the corresponding installing function according to the type value.
+        // MimeType info is missing here but SWI will figure out the mimetype via file handler
+        // and call the corresponding plugin.
+        case CNcdInstallInfo::ENcdInstallWidget:
+            {
+            Installer().SilentInstallWidgetL(
+                    iFileHandle, 
+                    SilentInstallOptionsPackage() );
+   
+            break;
+            }
         
         default:
             {
--- a/ncdengine/provider/deviceinteraction/inc/ncdinstallationservice.h	Fri Feb 19 22:57:02 2010 +0200
+++ b/ncdengine/provider/deviceinteraction/inc/ncdinstallationservice.h	Fri Mar 12 15:43:14 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -135,6 +135,12 @@
                                      const TDesC& aMimeType,
                                      const TDesC8& aDescriptorData,
                                      const SwiUI::TInstallOptionsPckg& aInstallOptionsPckg ) = 0;
+    
+    /*
+     * Use SWI API to install widget silently. 
+     */     
+    virtual void SilentInstallWidgetL(RFile& aFile,
+                                      const SwiUI::TInstallOptionsPckg& aInstallOptionsPckg ) = 0;
 
     /**
      * Cancels the silent installation if it is going on.
@@ -184,7 +190,20 @@
 
     virtual TNcdApplicationStatus IsApplicationInstalledL( 
         const TUid& aUid, const TCatalogsVersion& aVersion ) = 0;
-
+    
+    /**
+     * Use widget registry API to check if certain widget with given identifier
+     * has been installed already.
+     */
+    virtual TNcdApplicationStatus IsWidgetInstalledL(
+        const TDesC& aIdentifier, const TCatalogsVersion& aVersion) = 0;
+    
+    /**
+     * Calling widget registry API to return the Uid of the widget 
+     * with given identifier.
+     */     
+    virtual TUid WidgetUidL( const TDesC& aIdentifier) = 0;
+    
     /**
      * Gets the first SID from the SIS registry package
      * by using application UID.
--- a/ncdengine/provider/deviceinteraction/inc/ncdinstallationserviceimpl.h	Fri Feb 19 22:57:02 2010 +0200
+++ b/ncdengine/provider/deviceinteraction/inc/ncdinstallationserviceimpl.h	Fri Mar 12 15:43:14 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -34,6 +34,8 @@
 #include "ncdasyncoperationobserver.h"
 #include "ncdasyncsilentinstallobserver.h"
 
+#include "ncdwidgetregistrydata.h"
+
 
 /**
  * New Java registry API was introduced in 3.2. We start using it 
@@ -148,6 +150,12 @@
                              const SwiUI::TInstallOptionsPckg& aInstallOptionsPckg );
     
     /**
+     * @see MNcdInstallationService::SilentInstallWidgetJavaL
+     */
+    void SilentInstallWidgetL( RFile& aFile,
+                               const SwiUI::TInstallOptionsPckg& aInstallOptionsPckg );
+    
+    /**
      * @see MNcdInstallationService::MNcdCancelSilentInstall
      */
     void CancelSilentInstall( HBufC*& aFileName,
@@ -178,6 +186,17 @@
         const TUid& aUid, const TCatalogsVersion& aVersion );
     
     /**
+     * @see MNcdInstallationService::IsWidgetInstalledL
+     */
+    TNcdApplicationStatus IsWidgetInstalledL(
+        const TDesC& aIdentifier, const TCatalogsVersion& aVersion);
+    
+    /**
+     * @see MNcdInstallationService::WidgetUidL
+     */
+    TUid WidgetUidL( const TDesC& aIdentifier);
+    
+    /**
      * @see MNcdInstallationService::SidFromSisRegistryL
      */
     TUid SidFromSisRegistryL( const TUid& aUid );
@@ -386,6 +405,8 @@
     
     void PopulateInstalledWidgetUidsL();
     
+    void PopulateInstalledWidgetsL(RExtendedWidgetInfoArray& aWidgets);
+    
     TUid InstalledWidgetUidL();
     
     HBufC* InstalledWidgetNameLC();
@@ -396,6 +417,10 @@
     
     TBool WidgetExistsL( const TUid& aUid );
     
+    TBool WidgetExistsL( const TDesC& aIdentifier, TCatalogsVersion& aVersion );
+    
+    TBool WidgetExistsL( const TUid& aUid, TCatalogsVersion& aVersion );
+    
 private:
     
     enum TInstallType
@@ -468,7 +493,9 @@
     
     
     RWidgetRegistryClientSession iWidgetRegistry;    
+    
     RWidgetInfoArray iInstalledWidgets;    
+    RPointerArray<CExtendedWidgetInfo> iInstalledWidgetsInfos; 
     };
 
 #endif // C_NCD_INSTALLATION_SERVICE_IMPL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ncdengine/provider/deviceinteraction/inc/ncdwidgetregistrydata.h	Fri Mar 12 15:43:14 2010 +0200
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   Declaration of CExtendedWidgetInfo
+*
+*/
+
+#ifndef NCDEXTENDEDWIDGETINFO_H
+#define NCDEXTENDEDWIDGETINFO_H
+
+// INCLUDES
+#include <f32file.h>
+#include <widgetregistryclient.h>
+#include "catalogsutils.h"
+
+// CONSTANTS
+
+// MACROS
+
+// FORWARD DECLARATIONS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// CLASS DECLARATION
+
+class CExtendedWidgetInfo : public CBase
+    {
+    public:
+        /**
+        * Constructor
+        */
+        inline CExtendedWidgetInfo()
+            {
+            iUid = TUid::Uid(0);
+            iVersion = HBufC::New( KWidgetRegistryVal + 1 );
+            
+            }
+        /**
+        * Destructor.
+        */
+        inline virtual ~CExtendedWidgetInfo()
+            {
+            delete iVersion;
+            }
+
+    public:
+        TUid             iUid;
+        HBufC*           iVersion;
+    };
+
+typedef RPointerArray<CExtendedWidgetInfo>  RExtendedWidgetInfoArray;
+
+#endif  //NCDEXTENDEDWIDGETINFO
--- a/ncdengine/provider/deviceinteraction/src/ncdinstallationserviceimpl.cpp	Fri Feb 19 22:57:02 2010 +0200
+++ b/ncdengine/provider/deviceinteraction/src/ncdinstallationserviceimpl.cpp	Fri Mar 12 15:43:14 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -71,8 +71,6 @@
 // length taken from WidgetRegistryData.h
 const TInt KWidgetBundleIdLength = KWidgetRegistryVal + 1;    
 
-_LIT( KWidgetExtension, ".wgz" );
-
 // ======== CALLBACK FUNCTION ========
  
 static TInt InstallationCompleteCallback( TAny* aData )
@@ -158,6 +156,7 @@
         iWidgetRegistry.Close();
         }
     iInstalledWidgets.ResetAndDestroy();
+    iInstalledWidgetsInfos.ResetAndDestroy();
     }
 
 // ---------------------------------------------------------------------------
@@ -298,7 +297,25 @@
     DLTRACEOUT((""));
     }
 
+// ---------------------------------------------------------------------------
+// Installs widget silently.
+// ---------------------------------------------------------------------------
+//
+void CNcdInstallationService::SilentInstallWidgetL( RFile& aFile,
+                                                    const SwiUI::TInstallOptionsPckg& aInstallOptionsPckg )
+    {
+    DLTRACEIN((""));
+    
+    if ( iSilentInstallActiveObserver == NULL )
+        {
+        DLINFO(("Create active observer for silent install"));
+        iSilentInstallActiveObserver = CNcdSilentInstallActiveObserver::NewL( *this );        
+        }
 
+    InstallWidgetL( aFile, &aInstallOptionsPckg );
+    
+    DLTRACEOUT((""));
+    }
 // ---------------------------------------------------------------------------
 // Cancell silent install.
 // ---------------------------------------------------------------------------
@@ -533,7 +550,55 @@
     }
 
 #endif
+
+// Check via widget registry API
+TNcdApplicationStatus CNcdInstallationService::IsWidgetInstalledL(const TDesC& aIdentifier, const TCatalogsVersion& aVersion)
+    {
+    DLTRACEIN((""));
     
+    TNcdApplicationStatus status( ENcdApplicationNotInstalled );
+    
+    if ( aIdentifier.Length() == 0 )
+        {
+        DLTRACEOUT(("Null identifier"));
+        return status;
+        }
+    
+    
+    TCatalogsVersion installedVersion;
+    
+    //check widget existance and get version number if it is installed
+    if ( WidgetExistsL( aIdentifier, installedVersion ) )
+        {
+        status = ENcdApplicationInstalled;
+        }
+           
+    //compare the version
+    if ( status == ENcdApplicationInstalled &&
+         aVersion != TCatalogsVersion() ) 
+            {
+            DLINFO(("Installed widget version: %d.%d.%d, comparing to: %d.%d.%d",
+                installedVersion.iMajor,
+                installedVersion.iMinor,
+                installedVersion.iBuild,
+                aVersion.iMajor,
+                aVersion.iMinor,
+                aVersion.iBuild ));
+                
+            if ( installedVersion > aVersion ) 
+                {
+                status = ENcdApplicationNewerVersionInstalled;
+                }
+            else if ( !( installedVersion == aVersion ) ) 
+                {
+                status = ENcdApplicationOlderVersionInstalled;
+                }
+            }
+        
+        DLTRACEOUT(("widget Status: %d", status));
+        return status;    
+    }
+
 // ---------------------------------------------------------------------------
 // Checks the application status
 // ---------------------------------------------------------------------------
@@ -580,9 +645,10 @@
     // SIS app not found, try to get java
     if ( err == KErrNotFound &&
          ( JavaAppExistsL( aUid ) ||
-           WidgetExistsL( aUid ) ) )
+           WidgetExistsL( aUid, installedVersion ) ) ) 
         {
         status = ENcdApplicationInstalled;
+        err = KErrNone;
         }
         
     LeaveIfNotErrorL( err, KErrNotFound );  
@@ -1540,10 +1606,10 @@
     
     iInstallType = EWidgetInstall;
 
-    // Get the list of installed widget uids so that we can
+    // Get the list of installed widgets so that we can
     // get the uid of the new widget after installation
-    PopulateInstalledWidgetUidsL();
-    
+    PopulateInstalledWidgetsL(iInstalledWidgetsInfos);
+
     TDataType dataType;    
     // Start application installation.
     DLINFO(( "Calling doc handler Open" ));
@@ -1653,6 +1719,19 @@
             aError = KErrCancel;
             }
         }
+    else if ( iInstallType == EWidgetInstall )
+        {    
+        // Set the midlet UID for the aAppUid variable.
+        aAppUid = InstalledWidgetUidL();
+        
+        if ( aAppUid == KNullUid )
+            {
+            DLINFO(("Installed widget was not found"));
+            // Because the new widget was not found, we can suppose that the
+            // application was not installed. So, set the error as KErrCancel.
+            aError = KErrCancel;
+            }
+        }
     else if ( iInstallType == ESisInstall )
         {
         // Get theme name if such was installed
@@ -2057,6 +2136,49 @@
     User::LeaveIfError( iWidgetRegistry.InstalledWidgetsL( iInstalledWidgets ) );    
     }
 
+// ---------------------------------------------------------------------------
+// Populates the list of installed widgets
+// ---------------------------------------------------------------------------
+//
+void CNcdInstallationService::PopulateInstalledWidgetsL
+         (RExtendedWidgetInfoArray& aWidgets) 
+    {
+    DLTRACEIN((""));
+    
+    // Get the list of installed widget uids 
+    PopulateInstalledWidgetUidsL();
+    
+    const TInt count = iInstalledWidgets.Count();
+    
+    // Create array with UID & Version infos
+    for ( TInt i = 0; i < count; ++i )
+        {
+        CExtendedWidgetInfo* tempInfo = new ( ELeave ) CExtendedWidgetInfo();
+        CleanupStack::PushL( tempInfo );
+        
+        CWidgetInfo* widgetInfo = iInstalledWidgets[i];
+        
+        CWidgetPropertyValue* version = iWidgetRegistry.GetWidgetPropertyValueL
+            (widgetInfo->iUid, EBundleVersion );
+        CleanupStack::PushL( version );
+
+        // Fill info
+        tempInfo->iUid = widgetInfo->iUid;
+        if (!version->iValue.s)
+            *(tempInfo->iVersion) = KDefVersion;
+        else
+            *(tempInfo->iVersion) = *(version->iValue.s);
+        
+        // Append to arrayt
+        aWidgets.AppendL( tempInfo );
+
+        CleanupStack::PopAndDestroy( version );
+        CleanupStack::Pop( tempInfo );
+        }
+   
+        DLTRACEOUT((""));
+
+    }
 
 // ---------------------------------------------------------------------------
 // Gets the name of widget that was installed last
@@ -2093,25 +2215,33 @@
     {
     DLTRACEIN((""));
     
-    RWidgetInfoArray widgets;
+    RExtendedWidgetInfoArray widgets;
+    PopulateInstalledWidgetsL(widgets);
     CleanupResetAndDestroyPushL( widgets );
         
-    User::LeaveIfError( iWidgetRegistry.InstalledWidgetsL( widgets ) );
+
     DLINFO(("widget count: %d", widgets.Count() ));
     
     TUid uid( KNullUid );
     
     const TInt count = widgets.Count();
-    const TInt installedCount = iInstalledWidgets.Count();
+    const TInt installedCount = iInstalledWidgetsInfos.Count();
     
     // Try to find a widget that was not installed earlier.
     for ( TInt i = 0; i < count; ++i )
         {
         TBool wasInstalled = EFalse;
-        CWidgetInfo* widgetInfo = widgets[ i ];
+        CExtendedWidgetInfo * widgetInfo = widgets[ i ];
         for ( TInt j = 0; j < installedCount; j++ )
             {
-            if ( iInstalledWidgets[ j ]->iUid == widgetInfo->iUid )
+          
+            TCatalogsVersion versionBefore, versionAfter;
+            TCatalogsVersion::ConvertL
+                ( versionBefore, *(iInstalledWidgetsInfos[ j ]->iVersion) );
+            TCatalogsVersion::ConvertL( versionAfter, *(widgetInfo->iVersion) );
+            
+            if ( iInstalledWidgetsInfos[ j ]->iUid == widgetInfo->iUid &&
+                 versionBefore >= versionAfter) 
                 {
                 wasInstalled = ETrue;
                 break;
@@ -2203,3 +2333,114 @@
         }
     return EFalse;         
     }
+
+// ---------------------------------------------------------------------------
+//Calling widget registry API to check if a widget with given uid is installed 
+//already
+// ---------------------------------------------------------------------------
+//
+TBool CNcdInstallationService::WidgetExistsL( 
+        const TUid& aUid, TCatalogsVersion& aVersion )
+    {
+    DLTRACEIN((""));
+    
+    if ( !iWidgetRegistry.Handle() )
+        {
+        User::LeaveIfError( iWidgetRegistry.Connect() );
+        }
+    
+    if ( iWidgetRegistry.IsWidget( aUid ) )
+        {
+        TBuf<KWidgetBundleIdLength> id;
+        iWidgetRegistry.GetWidgetBundleId( aUid, id );
+        if (iWidgetRegistry.WidgetExistsL( id ))
+            {
+            // Get version
+            CWidgetPropertyValue* version = 
+                iWidgetRegistry.GetWidgetPropertyValueL(aUid, EBundleVersion );
+            CleanupStack::PushL( version );
+            TCatalogsVersion::ConvertL( aVersion, *(version->iValue.s) );
+            CleanupStack::PopAndDestroy( version ); 
+            return (ETrue);
+            }
+        else
+            {
+            return (EFalse);
+            }
+        }
+    else
+       return(EFalse);
+
+    }
+    
+// ---------------------------------------------------------------------------
+// Calling widget registry API to check if a widget with given identifier is 
+// installed already
+// ---------------------------------------------------------------------------
+//
+TBool CNcdInstallationService::WidgetExistsL
+          ( const TDesC& aIdentifier, TCatalogsVersion& aVersion )
+    {
+    DLTRACEIN((""));
+    
+    if ( !iWidgetRegistry.Handle() )
+          {
+          User::LeaveIfError( iWidgetRegistry.Connect() );
+          }
+
+    RPointerArray<CWidgetInfo> widgetInfoArr;
+    
+    CleanupResetAndDestroyPushL( widgetInfoArr );
+    TInt err = iWidgetRegistry.InstalledWidgetsL(widgetInfoArr);
+    
+    for( TInt i( widgetInfoArr.Count() - 1 ); i >= 0; --i ) 
+        {
+        CWidgetInfo* widgetInfo( widgetInfoArr[i] );                  
+        CWidgetPropertyValue* bundleId = 
+            iWidgetRegistry.GetWidgetPropertyValueL
+                (widgetInfo->iUid, EBundleIdentifier );
+        CleanupStack::PushL( bundleId );
+        
+        if( aIdentifier.Compare( *(bundleId->iValue.s) )== 0 )
+            {
+            CWidgetPropertyValue* version = 
+                iWidgetRegistry.GetWidgetPropertyValueL
+                    (widgetInfo->iUid, EBundleVersion );
+            CleanupStack::PushL( version );
+            TCatalogsVersion::ConvertL( aVersion, *(version->iValue.s) );
+            
+            CleanupStack::PopAndDestroy( version );
+            CleanupStack::PopAndDestroy( bundleId );
+            CleanupStack::PopAndDestroy( &widgetInfoArr );
+                        
+            return ETrue;
+            }
+        CleanupStack::PopAndDestroy( bundleId );
+        }
+    CleanupStack::PopAndDestroy( &widgetInfoArr );
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+//  Calling widget registry API to return the Uid of the widget
+//  with given identifier.
+// ---------------------------------------------------------------------------
+//
+TUid CNcdInstallationService::WidgetUidL( const TDesC& aIdentifier)
+    {
+    DLTRACEIN((""));
+    
+    TUid id = TUid::Uid(0);
+    
+   if ( !iWidgetRegistry.Handle() )
+          {
+          User::LeaveIfError( iWidgetRegistry.Connect() );
+          }
+    
+    id.iUid = iWidgetRegistry.GetWidgetUidL( aIdentifier);
+
+    return id;
+    
+    }
+
+    
--- a/ncdengine/provider/server/inc/ncdinstallinfo.h	Fri Feb 19 22:57:02 2010 +0200
+++ b/ncdengine/provider/server/inc/ncdinstallinfo.h	Fri Mar 12 15:43:14 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -48,7 +48,12 @@
         /**
          * Jar install with a JAD descriptor
          */
-        ENcdInstallJad
+        ENcdInstallJad,
+        
+        /**
+         * Widget install
+         */
+        ENcdInstallWidget
         };
         
         
--- a/ncdengine/provider/server/inc/ncdnodecontentinfoimpl.h	Fri Feb 19 22:57:02 2010 +0200
+++ b/ncdengine/provider/server/inc/ncdnodecontentinfoimpl.h	Fri Mar 12 15:43:14 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -128,7 +128,15 @@
      * @return The UID of the application item.
      */
     const TUid& Uid() const;
-
+    
+    /**
+     * This function is the indicative identifier for the
+     * contents that are widgets. This can be used e.g. for checking
+     * if the widget has already been installed to the phone.
+     *
+     * @return The Identifier of the application item.
+     */
+    const TDesC& Identifier() const;
 
     /**
      * Different versions of the content items may exist. Thus,
@@ -261,7 +269,8 @@
 
     TUint iPurpose;
     HBufC* iMimeType;
-    TUid iUid;
+    TUid iUid;         // UID is an identifier for sis 
+    HBufC* iIdentifier; // a string identifier for widget
     HBufC* iVersion;
     TInt iSize;
 
--- a/ncdengine/provider/server/inc/ncdproviderutils.h	Fri Feb 19 22:57:02 2010 +0200
+++ b/ncdengine/provider/server/inc/ncdproviderutils.h	Fri Mar 12 15:43:14 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -111,8 +111,15 @@
      */
     static TNcdApplicationStatus IsApplicationInstalledL(
         const TUid& aUid, const TDesC& aVersion );
-        
+    
+    // check if a widget with given identifier is installed already    
+    static TNcdApplicationStatus IsWidgetInstalledL(
+        const TDesC& aIdentifier, const TDesC& aVersion );
+    
 
+    //  Calling widget registry API to return the Uid of the widget with given identifier
+    static TUid WidgetUidL( const TDesC& aIdentifier);
+    
     /**
      * Compares version number strings
      *
--- a/ncdengine/provider/server/src/ncdinstalloperationimpl.cpp	Fri Feb 19 22:57:02 2010 +0200
+++ b/ncdengine/provider/server/src/ncdinstalloperationimpl.cpp	Fri Mar 12 15:43:14 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -444,6 +444,13 @@
         installType = CNcdInstallInfo::ENcdInstallJad;                
         }
 
+    // compare with widget mimetype. If matching, assign ENcdInstallWidget to install type
+    // The type value will be checked later when installing starts.
+    else if( downloadInfo->ContentMimeType().MatchF( KMimeTypeMatchWidget ) != KErrNotFound )
+        {
+        purpose = ENcdItemPurposeApplication;        
+        installType = CNcdInstallInfo::ENcdInstallWidget;  
+        }
 
     DLTRACE(("Creating fileinfo"));
     // Create file info for proxy-side installer
--- a/ncdengine/provider/server/src/ncdnodecontentinfoimpl.cpp	Fri Feb 19 22:57:02 2010 +0200
+++ b/ncdengine/provider/server/src/ncdnodecontentinfoimpl.cpp	Fri Mar 12 15:43:14 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -33,6 +33,8 @@
 #include "ncdpurchasedetails.h"
 
 #include "catalogsdebug.h"
+#include "catalogsconstants.h"
+
 
 CNcdNodeContentInfo::CNcdNodeContentInfo( NcdNodeClassIds::TNcdNodeClassId aClassId )
 : CNcdCommunicable(),
@@ -44,7 +46,7 @@
     {
     iMimeType = KNullDesC().AllocL();
     iVersion = KNullDesC().AllocL();
-
+    iIdentifier = KNullDesC().AllocL();
     }
 
 
@@ -76,6 +78,9 @@
 
     delete iVersion;
     iVersion = NULL;
+    
+    delete iIdentifier;
+    iIdentifier = NULL;
 
     DLTRACEOUT((""));
     }        
@@ -100,6 +105,11 @@
     return iUid;
     }
 
+const TDesC& CNcdNodeContentInfo::Identifier() const
+    {
+    return *iIdentifier;
+    }
+
 const TDesC& CNcdNodeContentInfo::Version() const
     {
     return *iVersion;
@@ -134,7 +144,11 @@
     iMimeType = NULL;
 
     iUid = TUid::Null();
-
+    
+    delete iIdentifier;
+    iIdentifier = NULL;
+    iIdentifier = KNullDesC().AllocL();  
+    
     delete iVersion;
     iVersion = NULL;
 
@@ -194,22 +208,31 @@
             iPurpose |= ENcdItemPurposeUnknown;
             }
         }
-
     iMimeType = aData.DownloadableContent()->Mime().AllocL();
 
     if ( iPurpose & ENcdItemPurposeApplication )
         {
-        TInt uid = 0;
-        TRAPD( err, uid = DesHexToIntL( aData.DownloadableContent()->Id() ) );
-        if( err != KErrNone )
+        if ( iMimeType->Compare(KMimeTypeMatchSisx) == 0 )
             {
-            DLERROR(( _L("DownloadableContent()->Id() was not valid hex, using ZERO: %S"),
-                      &aData.DownloadableContent()->Id() ));
-            iUid.iUid = 0;
+            // sis package, convert the string to uid
+            TInt uid = 0;
+            TRAPD( err, uid = DesHexToIntL( aData.DownloadableContent()->Id() ) );
+            if( err != KErrNone )
+                {
+                DLERROR(( _L("DownloadableContent()->Id() was not valid hex, using ZERO: %S"),
+                           &aData.DownloadableContent()->Id() ));
+                iUid.iUid = 0;
+                }
+            else
+                {
+                iUid.iUid = uid;
+                }
             }
-        else
+         
+        if ( iMimeType->Compare( KMimeTypeMatchWidget ) == 0 )
             {
-            iUid.iUid = uid;
+            // widget, save identifier
+            iIdentifier = aData.DownloadableContent()->Id().AllocL();
             }
         }
 
@@ -230,7 +253,17 @@
     
     aStream.WriteUint16L( iPurpose );
     ExternalizeDesL( *iMimeType, aStream );
-    aStream.WriteInt32L( iUid.iUid );
+    
+    // The code here must be sync with the Internalization code in CNcdNodeContentInfoProxy
+    if ( iMimeType->Compare( KMimeTypeMatchWidget ) == 0 )
+        {
+        ExternalizeDesL( *iIdentifier, aStream );
+        }
+    else
+        {
+        aStream.WriteInt32L( iUid.iUid );
+        }
+    
     ExternalizeDesL( *iVersion, aStream );
     aStream.WriteInt32L( iSize );
 
@@ -255,7 +288,18 @@
     
     iPurpose = aStream.ReadUint16L();
     InternalizeDesL( iMimeType, aStream );
-    iUid.iUid = aStream.ReadInt32L();
+    
+    // This Internalize function is called when the node is loaded from cache. RReadStream is a sign of that.
+    // So same logic here also. Check mimetype and then decide to save uid or identifier.
+    if ( iMimeType->Compare( KMimeTypeMatchWidget ) == 0  )
+        {
+        InternalizeDesL( iIdentifier, aStream );
+        }
+    else
+        {
+        iUid.iUid = aStream.ReadInt32L();
+        }
+    
     InternalizeDesL( iVersion, aStream );
     iSize = aStream.ReadInt32L();
 
--- a/ncdengine/provider/server/src/ncdnodeinstallimpl.cpp	Fri Feb 19 22:57:02 2010 +0200
+++ b/ncdengine/provider/server/src/ncdnodeinstallimpl.cpp	Fri Mar 12 15:43:14 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -344,9 +344,11 @@
         }
 
     
-    if ( iInstalledContent ) 
+    // Identifier might be Null
+    if ( iInstalledContent && iInstalledContent->ApplicationUid() != TUid::Null() ) 
         {
-        DASSERT( iInstalledContent->ApplicationUid() != TUid::Null() );
+        
+         DASSERT( iInstalledContent->ApplicationUid() != TUid::Null() );
         
         // Disable launching if protocol says so. 
         // By default apps defined in content info are launchable
@@ -542,7 +544,6 @@
     return ETrue;
     }
 
-
 // ---------------------------------------------------------------------------
 // 
 // ---------------------------------------------------------------------------
@@ -561,13 +562,26 @@
     TRAPD( err, info = &iMetadata.ContentInfoL() );
     
     TBool installed = EFalse;
-    if ( err == KErrNone && info->Uid() != TUid::Null() ) 
+
+    // Either UID or Identifier exists, we can continue here
+    if ( err == KErrNone && ( info->Uid() != TUid::Null()|| info->Identifier().Length() != 0 ) ) 
         {
-        DLINFO(("Uid: %x", info->Uid().iUid ));
-        TNcdApplicationStatus status = 
-            CNcdProviderUtils::IsApplicationInstalledL(
-                info->Uid(), 
-                info->Version() );
+        TNcdApplicationStatus status = ENcdApplicationNotInstalled;
+        
+        if (info->MimeType().Compare( KMimeTypeMatchWidget ) == 0 && info->Identifier().Length() != 0  )
+            {
+            status = CNcdProviderUtils::IsWidgetInstalledL(
+                    info->Identifier(), 
+                    info->Version() );
+            }
+        else if ( info->Uid() != TUid::Null() ) 
+            {
+            DLINFO(("Uid: %x", info->Uid().iUid ));
+            status = 
+                CNcdProviderUtils::IsApplicationInstalledL(
+                                   info->Uid(), 
+                                   info->Version() );
+            }
         
         // Application can be older version for it to be considered installed
         // Upgrade will be available for the user
@@ -578,35 +592,43 @@
 
         iInstalled = installed;    
         iLaunchable = installed;
-                            
+                                        
         if ( installed ) 
             {
             DLTRACE(("Application installed"));
             CNcdExtendedInstallInfo* install = CNcdExtendedInstallInfo::NewLC();
-            install->SetApplicationUid( info->Uid() );
+
+            if (info->MimeType().Compare( KMimeTypeMatchWidget ) == 0 )
+                {                          
+                install->SetApplicationUid(CNcdProviderUtils::WidgetUidL(info->Identifier()));
+                }
+            else
+                {
+                install->SetApplicationUid( info->Uid() );
+                }
             
-            // This ensures that CNcdInstalledApplication actually checks the 
-            // application's version number when it checks if it's installed
-            // or not
-            install->SetUriExists( ETrue );
+             // This ensures that CNcdInstalledApplication actually checks the 
+             // application's version number when it checks if it's installed
+             // or not
+             install->SetUriExists( ETrue );
 
-            // This will be used to determine whether the app is actually installed
-            // or not
-            install->SetApplicationVersionL( info->Version() );
-            install->SetLaunchable( ETrue );
-            
-            // don't set because it can mess upgrade handling in 
-            // CNcdNodeMetadata::HandleContentUpgradeL
-            iContentVersion = TCatalogsVersion();
+             // This will be used to determine whether the app is actually installed
+             // or not
+             install->SetApplicationVersionL( info->Version() );
+             install->SetLaunchable( ETrue );
 
-            iInstalledContent = install;
-            CleanupStack::Pop( install );
+             // don't set because it can mess upgrade handling in 
+             // CNcdNodeMetadata::HandleContentUpgradeL
+              iContentVersion = TCatalogsVersion();
+
+              iInstalledContent = install;
+              CleanupStack::Pop( install );
+              }
+        
             }
-        }
     return installed;
     }
 
-
 // ---------------------------------------------------------------------------
 // Content version getter
 // ---------------------------------------------------------------------------
--- a/ncdengine/provider/server/src/ncdnodemetadataimpl.cpp	Fri Feb 19 22:57:02 2010 +0200
+++ b/ncdengine/provider/server/src/ncdnodemetadataimpl.cpp	Fri Mar 12 15:43:14 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -882,7 +882,9 @@
 void CNcdNodeMetaData::InternalizeInstallFromContentInfoL()
     {
     DLTRACEIN((""));
-    if ( iContentInfo && iContentInfo->Uid() != TUid::Null() )
+
+    // continue either UID or identifier exists.
+    if ( iContentInfo && (iContentInfo->Uid() != TUid::Null() || iContentInfo->Identifier().Length() != 0 ) )
         {
         TBool create = !iInstall;
         if ( create ) 
@@ -1002,12 +1004,25 @@
                     DLTRACE(("Creating upgrade"));
                     iUpgrade = CNcdNodeUpgrade::NewL( *this );
                     }
-                
-                // content is an upgrade
-                iUpgrade->SetContentUpgradesL(
-                    ETrue,
-                    iContentInfo->Uid(),
-                    iContentInfo->Version() );  
+             
+                if ((iContentInfo->Uid() == KNullUid) &&
+                    (iContentInfo->MimeType().Compare( KMimeTypeMatchWidget ) == 0 ))
+                    { 
+                    // Get widget Uid
+                        iUpgrade->SetContentUpgradesL(
+                        ETrue,
+                        CNcdProviderUtils::WidgetUidL(iContentInfo->Identifier()),
+                        iContentInfo->Version() );
+                    }
+                else
+                    {
+                    // content is an application upgrade
+                    iUpgrade->SetContentUpgradesL(
+                        ETrue,
+                        iContentInfo->Uid(),
+                        iContentInfo->Version() );
+                    }
+                    
                 return ETrue;                  
                 }
             }        
@@ -1045,6 +1060,38 @@
                 return ETrue;
                 }
             }
+        // Widget?
+        else if (iContentInfo->Identifier() != KNullDesC) 
+            {
+            TNcdApplicationStatus contentVersion( 
+            ENcdApplicationNotInstalled );
+
+            TRAPD( err, 
+                contentVersion = CNcdProviderUtils::IsWidgetInstalledL( 
+                iContentInfo->Identifier(), 
+                iContentInfo->Version() ) );
+
+            // Ignore errors in version conversion                
+            LeaveIfNotErrorL( err, KErrArgument, KErrGeneral );
+                        
+            if ( contentVersion == ENcdApplicationOlderVersionInstalled ) 
+                {
+                if ( !iUpgrade ) 
+                    {
+                    DLTRACE(("Creating upgrade"));
+                    iUpgrade = CNcdNodeUpgrade::NewL( *this );
+                    }
+                            
+                // Set upgrade data which will be available through the API
+                iUpgrade->SetContentUpgradesL( 
+                    ETrue, 
+                    CNcdProviderUtils::WidgetUidL(iContentInfo->Identifier()), 
+                    iContentInfo->Version() );
+                        
+                    DLTRACEOUT(("Content upgrades"));    
+                    return ETrue;
+                }
+            }
         }
     
     if ( iUpgrade )
--- a/ncdengine/provider/server/src/ncdproviderutils.cpp	Fri Feb 19 22:57:02 2010 +0200
+++ b/ncdengine/provider/server/src/ncdproviderutils.cpp	Fri Mar 12 15:43:14 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -279,8 +279,30 @@
     return InstallationServiceL().IsApplicationInstalledL( aUid, version );
     }
 
+// ---------------------------------------------------------------------------
+// Checks if the widget with the given identifier is installed
+// call CNcdInstallationService in deviceinteraction dll
+// ---------------------------------------------------------------------------
+//
+TNcdApplicationStatus CNcdProviderUtils::IsWidgetInstalledL( 
+    const TDesC& aIdentifier, const TDesC& aVersion )
+    {
+    TCatalogsVersion version;
+    TRAPD( err, TCatalogsVersion::ConvertL( version, aVersion ) );
+    LeaveIfNotErrorL( err, KErrArgument, KErrGeneral );
+                             
+    return InstallationServiceL().IsWidgetInstalledL( aIdentifier, version );
+    }
 
 // ---------------------------------------------------------------------------
+// Calling widget registry API to return the Uid of the widget with given ident
+// ---------------------------------------------------------------------------
+//
+TUid CNcdProviderUtils::WidgetUidL( const TDesC& aIdentifier)
+    {
+    return InstallationServiceL().WidgetUidL( aIdentifier );
+    }
+// ---------------------------------------------------------------------------
 // 
 // ---------------------------------------------------------------------------
 //
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ncdengine/rom/altair-engine-stub.pkg	Fri Mar 12 15:43:14 2010 +0200
@@ -0,0 +1,85 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description:
+;
+;;*****************************************************************************
+;;
+;; NCD Altair Catalogs PKG, engine
+;; PKG for creating ROM sis stub 
+;;
+;;*****************************************************************************
+
+;Language - standard language definitions
+&EN
+
+; standard SIS file header;
+#{"Altair Engine"},(0x20019119),9,2,1006,TYPE=SA
+ 
+
+;Localised Vendor name
+%{"Nokia"}
+
+;Unique Vendor name
+:"Nokia"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+; Backup & restore
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+; Backup & restore file for the engine side
+"" - "z:\private\20019119\backup_registration.xml"
+
+;;*****************************************************************************
+;; Server
+;;*****************************************************************************
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+; Engine config
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+"" - "z:\private\20019119\config.xml"
+
+;; Client side dll
+""
+         -"z:\sys\bin\ncdengine_20019119.dll"
+
+;; Server exe
+""
+         -"z:\sys\bin\ncdserver_20019119.exe"
+
+;; Utils dll
+""
+         -"z:\sys\bin\ncdutils_20019119.dll"
+
+;; Device management dll
+""
+         -"z:\sys\bin\ncddevicemgmt_20019119.dll"
+
+;; Debug util dll
+""
+         -"z:\sys\bin\ncddebug_20019119.dll"
+
+;; Undertaker utility
+""
+         -"z:\sys\bin\ncdundertaker_20019119.exe"
+
+;; ECOM dll+rss
+;; NEW NAMING to match the IBYs. Must be same on the stub sis
+;; and the IBY to allow eclipsing.
+""
+         -"z:\sys\bin\ncdproxy_20019119.dll"
+""
+         -"z:\resource\plugins\ncdproxy_20019119.rsc"
+
+
Binary file ncdengine/rom/altair-engine-stub.sis has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ncdengine/rom/make_romstub.bat	Fri Mar 12 15:43:14 2010 +0200
@@ -0,0 +1,1 @@
+makesis -s altair-engine-stub.pkg altair-engine-stub.sis