ncdengine/provider/server/src/ncdnodemetadataimpl.cpp
branchRCL_3
changeset 11 3ba40be8e484
parent 0 ba25891c3a9e
equal deleted inserted replaced
9:51c0f5edf5ef 11:3ba40be8e484
     1 /*
     1 /*
     2 * Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
   880     
   880     
   881     
   881     
   882 void CNcdNodeMetaData::InternalizeInstallFromContentInfoL()
   882 void CNcdNodeMetaData::InternalizeInstallFromContentInfoL()
   883     {
   883     {
   884     DLTRACEIN((""));
   884     DLTRACEIN((""));
   885     if ( iContentInfo && iContentInfo->Uid() != TUid::Null() )
   885 
       
   886     // continue either UID or identifier exists.
       
   887     if ( iContentInfo && (iContentInfo->Uid() != TUid::Null() || iContentInfo->Identifier().Length() != 0 ) )
   886         {
   888         {
   887         TBool create = !iInstall;
   889         TBool create = !iInstall;
   888         if ( create ) 
   890         if ( create ) 
   889             {
   891             {
   890             DLTRACE(("No install, creating"));
   892             DLTRACE(("No install, creating"));
  1000                 if ( !iUpgrade ) 
  1002                 if ( !iUpgrade ) 
  1001                     {
  1003                     {
  1002                     DLTRACE(("Creating upgrade"));
  1004                     DLTRACE(("Creating upgrade"));
  1003                     iUpgrade = CNcdNodeUpgrade::NewL( *this );
  1005                     iUpgrade = CNcdNodeUpgrade::NewL( *this );
  1004                     }
  1006                     }
  1005                 
  1007              
  1006                 // content is an upgrade
  1008                 if ((iContentInfo->Uid() == KNullUid) &&
  1007                 iUpgrade->SetContentUpgradesL(
  1009                     (iContentInfo->MimeType().Compare( KMimeTypeMatchWidget ) == 0 ))
  1008                     ETrue,
  1010                     { 
  1009                     iContentInfo->Uid(),
  1011                     // Get widget Uid
  1010                     iContentInfo->Version() );  
  1012                         iUpgrade->SetContentUpgradesL(
       
  1013                         ETrue,
       
  1014                         CNcdProviderUtils::WidgetUidL(iContentInfo->Identifier()),
       
  1015                         iContentInfo->Version() );
       
  1016                     }
       
  1017                 else
       
  1018                     {
       
  1019                     // content is an application upgrade
       
  1020                     iUpgrade->SetContentUpgradesL(
       
  1021                         ETrue,
       
  1022                         iContentInfo->Uid(),
       
  1023                         iContentInfo->Version() );
       
  1024                     }
       
  1025                     
  1011                 return ETrue;                  
  1026                 return ETrue;                  
  1012                 }
  1027                 }
  1013             }        
  1028             }        
  1014         // If content is an application, check if it upgrades. "Else if" is necessary
  1029         // If content is an application, check if it upgrades. "Else if" is necessary
  1015         // because otherwise content version check could be overridden by application version
  1030         // because otherwise content version check could be overridden by application version
  1041                     iContentInfo->Uid(), 
  1056                     iContentInfo->Uid(), 
  1042                     iContentInfo->Version() );
  1057                     iContentInfo->Version() );
  1043                 
  1058                 
  1044                 DLTRACEOUT(("Content upgrades"));    
  1059                 DLTRACEOUT(("Content upgrades"));    
  1045                 return ETrue;
  1060                 return ETrue;
       
  1061                 }
       
  1062             }
       
  1063         // Widget?
       
  1064         else if (iContentInfo->Identifier() != KNullDesC) 
       
  1065             {
       
  1066             TNcdApplicationStatus contentVersion( 
       
  1067             ENcdApplicationNotInstalled );
       
  1068 
       
  1069             TRAPD( err, 
       
  1070                 contentVersion = CNcdProviderUtils::IsWidgetInstalledL( 
       
  1071                 iContentInfo->Identifier(), 
       
  1072                 iContentInfo->Version() ) );
       
  1073 
       
  1074             // Ignore errors in version conversion                
       
  1075             LeaveIfNotErrorL( err, KErrArgument, KErrGeneral );
       
  1076                         
       
  1077             if ( contentVersion == ENcdApplicationOlderVersionInstalled ) 
       
  1078                 {
       
  1079                 if ( !iUpgrade ) 
       
  1080                     {
       
  1081                     DLTRACE(("Creating upgrade"));
       
  1082                     iUpgrade = CNcdNodeUpgrade::NewL( *this );
       
  1083                     }
       
  1084                             
       
  1085                 // Set upgrade data which will be available through the API
       
  1086                 iUpgrade->SetContentUpgradesL( 
       
  1087                     ETrue, 
       
  1088                     CNcdProviderUtils::WidgetUidL(iContentInfo->Identifier()), 
       
  1089                     iContentInfo->Version() );
       
  1090                         
       
  1091                     DLTRACEOUT(("Content upgrades"));    
       
  1092                     return ETrue;
  1046                 }
  1093                 }
  1047             }
  1094             }
  1048         }
  1095         }
  1049     
  1096     
  1050     if ( iUpgrade )
  1097     if ( iUpgrade )