ncdengine/provider/server/src/ncdnodemetadataimpl.cpp
branchRCL_3
changeset 18 3ba40be8e484
parent 0 ba25891c3a9e
--- 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 )