253 // --------------------------------------------------------- |
255 // --------------------------------------------------------- |
254 // |
256 // |
255 // --------------------------------------------------------- |
257 // --------------------------------------------------------- |
256 // |
258 // |
257 void CCaSrvAppScanner::UpdateAppEntryL( |
259 void CCaSrvAppScanner::UpdateAppEntryL( |
258 CCaInnerEntry* aEntry, TUint aMmcId, TBool aAlwaysUpdate ) |
260 CCaInnerEntry* aEntry, TUint aMmcId, TBool aAlwaysUpdate ) |
259 { |
261 { |
260 TBool toUpdate = HandleMmcAttrUpdateL( aEntry, aMmcId ); |
262 TBool missingFlagChanged = HandleMissingFlagsUpdate( aEntry ); |
261 TBool missingVisibleFlagChanged = |
263 TBool visibleFlagChanged = HandleVisibleFlagUpdate( aEntry ); |
262 HandleMissingVisibleFlagsUpdate( aEntry ); |
264 |
263 toUpdate = missingVisibleFlagChanged || toUpdate; |
265 |
264 toUpdate = HandleRemovableVisibleFlagsUpdateL( aEntry ) || toUpdate; |
266 // To handle case with mmc card. When mmc attritube is updated then |
|
267 // used flag should be change. When aplication is update but |
|
268 // it is not appear then this flag should be change too. |
|
269 if( aAlwaysUpdate && !missingFlagChanged ) |
|
270 { |
|
271 HandleUsedFlagUpdate( aEntry ); |
|
272 } |
|
273 TBool toUpdate = missingFlagChanged || visibleFlagChanged; |
265 toUpdate = SetApaAppInfoL( aEntry ) || toUpdate; |
274 toUpdate = SetApaAppInfoL( aEntry ) || toUpdate; |
|
275 toUpdate = HandleRemovableFlagAndMmcAttrUpdateL( aEntry, aMmcId ) || toUpdate; |
266 toUpdate = RemoveUninstallFlagL( aEntry ) || toUpdate; |
276 toUpdate = RemoveUninstallFlagL( aEntry ) || toUpdate; |
267 |
277 |
268 if( toUpdate || aAlwaysUpdate ) |
278 if( toUpdate || aAlwaysUpdate ) |
269 { |
279 { |
270 //update app in storage |
280 //update app in storage |
271 HandleUsedFlagUpdate( aEntry ); |
|
272 TItemAppearance itemAppearanceChange = EItemAppearanceNotChanged; |
281 TItemAppearance itemAppearanceChange = EItemAppearanceNotChanged; |
273 if( missingVisibleFlagChanged ) |
282 if( missingFlagChanged || visibleFlagChanged ) |
274 { |
283 { |
275 itemAppearanceChange = EItemAppeared; |
284 itemAppearanceChange = EItemAppeared; |
276 } |
285 } |
|
286 if( !missingFlagChanged ) |
|
287 { |
|
288 AddEntryToPredefinedCollectionL( aEntry, ETrue ); |
|
289 if ( aEntry->GetFlags() & ERemovable ) |
|
290 { |
|
291 AddEntryToDownloadedCollectionL( aEntry->GetId() ); |
|
292 } |
|
293 } |
277 iCaStorageProxy.AddL( aEntry, EFalse, itemAppearanceChange ); |
294 iCaStorageProxy.AddL( aEntry, EFalse, itemAppearanceChange ); |
278 } |
295 } |
279 } |
296 } |
280 |
297 |
281 // --------------------------------------------------------- |
298 // --------------------------------------------------------- |
282 // |
299 // |
283 // --------------------------------------------------------- |
300 // --------------------------------------------------------- |
284 // |
301 // |
285 TBool CCaSrvAppScanner::HandleMmcAttrUpdateL( |
302 TBool CCaSrvAppScanner::HandleMmcAttrUpdateL( |
|
303 const Usif::CComponentEntry* aEntry, |
286 CCaInnerEntry* aItem, TUint aMmcId ) |
304 CCaInnerEntry* aItem, TUint aMmcId ) |
287 { |
305 { |
288 TBool toUpdate( ETrue ); |
306 TBool toChange( EFalse ); |
289 if( IsInMmcL( TUid::Uid( aItem->GetUid() ) ) ) |
307 if( aEntry && aEntry->IsRemovable() ) |
290 { |
308 { |
291 //app is instaled on mmc - KCaAttrMmcId attribute update |
309 TChar currentDriveLetter; |
292 RBuf uidString; |
310 if ( aEntry->SoftwareType().Compare(KCaAttrAppTypeValueNative()) != 0 ) |
293 uidString.CleanupClosePushL(); |
311 { |
294 uidString.CreateL(KUidChars); |
312 TDriveList driveList = aEntry->InstalledDrives(); |
295 uidString.Format( KHexFormat, aMmcId ); |
313 for ( TInt driveNr=EDriveY; driveNr >= EDriveA; driveNr-- ) |
296 aItem->AddAttributeL( KCaAttrMmcId, uidString ); |
314 { |
297 CleanupStack::PopAndDestroy( &uidString ); |
315 if ( driveList[driveNr] ) |
298 } |
316 { |
299 else if ( IsInMassStorageL( TUid::Uid( aItem->GetUid() ) ) ) |
317 User::LeaveIfError( iFs.DriveToChar( driveNr, |
300 { |
318 currentDriveLetter ) ); |
301 //its app installed on mass storage, we need to leave it |
319 } |
302 //in case of connecting usb in mass storage mode |
320 } |
303 aItem->AddAttributeL( KCaAttrMmcId, KCaMassStorage ); |
321 } |
|
322 else |
|
323 { |
|
324 TApaAppInfo* appInfo = new ( ELeave ) TApaAppInfo(); |
|
325 if( !iApaLsSession.GetAppInfo( *appInfo, |
|
326 TUid::Uid( aItem->GetUid() ) ) ) |
|
327 { |
|
328 currentDriveLetter = appInfo->iFullName[0]; |
|
329 } |
|
330 } |
|
331 |
|
332 if( IsCharInDrive( currentDriveLetter, |
|
333 DriveInfo::EDefaultRemovableMassStorage ) ) |
|
334 { |
|
335 //app is instaled on mmc - KCaAttrMmcId attribute update |
|
336 RBuf uidString; |
|
337 uidString.CleanupClosePushL(); |
|
338 uidString.CreateL( KUidChars ); |
|
339 uidString.Format( KHexFormat, aMmcId ); |
|
340 toChange = AddAttributeL( aItem, KCaAttrMmcId, uidString ); |
|
341 CleanupStack::PopAndDestroy( &uidString ); |
|
342 } |
|
343 else if ( IsCharInDrive( currentDriveLetter, DriveInfo::EDefaultMassStorage ) ) |
|
344 { |
|
345 //its app installed on mass storage, we need to leave it |
|
346 //in case of connecting usb in mass storage mode |
|
347 toChange = AddAttributeL( aItem, KCaAttrMmcId, KCaMassStorage ); |
|
348 } |
|
349 else |
|
350 { |
|
351 toChange = RemoveAttributeL( aItem, KCaAttrMmcId ); |
|
352 } |
304 } |
353 } |
305 else |
354 else |
306 { |
355 { |
307 RBuf attrVal; |
356 toChange = RemoveAttributeL( aItem, KCaAttrMmcId ); |
308 attrVal.CleanupClosePushL(); |
|
309 attrVal.CreateL( KCaMaxAttrValueLen ); |
|
310 if( aItem->FindAttribute( KCaAttrMmcId, attrVal ) ) |
|
311 { |
|
312 aItem->RemoveAttributeL( KCaAttrMmcId ); |
|
313 } |
|
314 else |
|
315 { |
|
316 toUpdate = EFalse; |
|
317 } |
|
318 CleanupStack::PopAndDestroy( &attrVal ); |
|
319 //its installed on c: drive - remove attribute |
357 //its installed on c: drive - remove attribute |
320 } |
358 } |
321 return toUpdate; |
359 return toChange; |
322 } |
360 } |
323 |
361 |
324 // --------------------------------------------------------- |
362 // --------------------------------------------------------- |
325 // |
363 // |
326 // --------------------------------------------------------- |
364 // --------------------------------------------------------- |
810 TBool changed( EFalse ); |
858 TBool changed( EFalse ); |
811 TApaAppInfo* info = new ( ELeave ) TApaAppInfo(); |
859 TApaAppInfo* info = new ( ELeave ) TApaAppInfo(); |
812 CleanupStack::PushL(info); |
860 CleanupStack::PushL(info); |
813 if( KErrNone == iSrvEngUtils.GetAppInfo( *aEntry, *info ) ) |
861 if( KErrNone == iSrvEngUtils.GetAppInfo( *aEntry, *info ) ) |
814 { |
862 { |
815 RBuf attrVal; |
863 changed = SetAppCaptionL( aEntry, info ) || changed; |
816 attrVal.CleanupClosePushL(); |
864 changed = UpdateComponentIdL( *aEntry ) || changed; |
817 attrVal.CreateL( KCaMaxAttrValueLen ); |
|
818 aEntry->FindAttribute( KCaAttrShortName, attrVal ); |
|
819 if( attrVal.Compare( info->iShortCaption ) != KErrNone |
|
820 || aEntry->GetText().Compare( info->iCaption ) |
|
821 != KErrNone ) |
|
822 { |
|
823 aEntry->SetTextL( info->iCaption ); |
|
824 aEntry->AddAttributeL( KCaAttrShortName, info->iShortCaption ); |
|
825 changed = ETrue; |
|
826 } |
|
827 |
|
828 |
|
829 if ( UpdateComponentIdL( *aEntry ) ) |
|
830 { |
|
831 changed = ETrue; |
|
832 } |
|
833 |
|
834 CleanupStack::PopAndDestroy( &attrVal ); |
|
835 |
865 |
836 // check if its java app and add attr for entries |
866 // check if its java app and add attr for entries |
837 TUid appTypeUid; |
867 TUid appTypeUid; |
838 if( KErrNone == iApaLsSession.GetAppType( appTypeUid, info->iUid ) ) |
868 if( KErrNone == iApaLsSession.GetAppType( appTypeUid, info->iUid ) ) |
839 { |
869 { |
840 if( appTypeUid == KMidletApplicationTypeUid ) |
870 if( appTypeUid == KMidletApplicationTypeUid ) |
841 { |
871 { |
842 aEntry->AddAttributeL( |
872 changed = SetJavaAppL( aEntry ) || changed; |
843 KCaAttrAppType, |
|
844 KCaAttrAppTypeValueJava ); |
|
845 |
|
846 TComponentId compId = |
|
847 iSoftwareRegistry.GetComponentIdForAppL( info->iUid ); |
|
848 CPropertyEntry* propertyEntry = |
|
849 iSoftwareRegistry.GetComponentPropertyL( compId, KCaScrPropertyAppSettings ); |
|
850 CleanupStack::PushL( propertyEntry ); |
|
851 if ( propertyEntry && |
|
852 propertyEntry->PropertyType() == CPropertyEntry::ELocalizedProperty ) |
|
853 { |
|
854 aEntry->AddAttributeL( |
|
855 KCaAttrAppSettingsPlugin, |
|
856 static_cast<CLocalizablePropertyEntry*>(propertyEntry)->StrValue() ); |
|
857 } |
|
858 CleanupStack::PopAndDestroy( propertyEntry ); |
|
859 } |
873 } |
860 else if ( appTypeUid == KCWRTApplicationTypeUid ) |
874 else if( appTypeUid == KCWRTApplicationTypeUid ) |
861 { |
875 { |
862 aEntry->AddAttributeL( |
876 changed = SetCWRTAppL( aEntry ) || changed; |
863 KCaAttrAppType, |
|
864 KCaAttrAppTypeValueCWRT ); |
|
865 TComponentId compId = |
|
866 iSoftwareRegistry.GetComponentIdForAppL( info->iUid ); |
|
867 CPropertyEntry* isMiniview = |
|
868 iSoftwareRegistry.GetComponentPropertyL( compId, |
|
869 KCaScrPropertyIsMiniviewSupported ); |
|
870 CleanupStack::PushL( isMiniview ); |
|
871 // check first if we support mini view |
|
872 if (isMiniview && isMiniview->PropertyType() == CPropertyEntry::EIntProperty && |
|
873 static_cast<CIntPropertyEntry*>(isMiniview)->IntValue()) |
|
874 { |
|
875 CPropertyEntry* appId = |
|
876 iSoftwareRegistry.GetComponentPropertyL( compId, KCaScrPropertyAppId ); |
|
877 CleanupStack::PushL( appId ); |
|
878 if ( appId && |
|
879 appId->PropertyType() == CPropertyEntry::ELocalizedProperty ) |
|
880 { |
|
881 aEntry->AddAttributeL( |
|
882 KCaAttrAppWidgetUri, |
|
883 KCaAttrAppWidgetUriCWRTValue ); |
|
884 aEntry->AddAttributeL( |
|
885 KCaAttrAppWidgetParamWebAppId, |
|
886 static_cast<CLocalizablePropertyEntry*>(appId)->StrValue() ); |
|
887 } |
|
888 CleanupStack::PopAndDestroy( appId ); |
|
889 } |
|
890 CleanupStack::PopAndDestroy( isMiniview ); |
|
891 } |
877 } |
892 } |
878 } |
893 } |
879 } |
894 CleanupStack::PopAndDestroy( info ); |
880 CleanupStack::PopAndDestroy( info ); |
895 return changed; |
881 return changed; |
|
882 } |
|
883 |
|
884 // --------------------------------------------------------------------------- |
|
885 // |
|
886 // --------------------------------------------------------------------------- |
|
887 // |
|
888 TBool CCaSrvAppScanner::SetAppCaptionL( |
|
889 CCaInnerEntry* aEntry, TApaAppInfo* info ) |
|
890 { |
|
891 TBool changed(EFalse); |
|
892 if( aEntry->GetText().Compare( info->iCaption ) != KErrNone ) |
|
893 { |
|
894 aEntry->SetTextL( info->iCaption ); |
|
895 changed = ETrue; |
|
896 } |
|
897 changed = AddAttributeL( aEntry, KCaAttrShortName, info->iShortCaption ) |
|
898 || changed; |
|
899 |
|
900 return changed; |
|
901 } |
|
902 |
|
903 // --------------------------------------------------------------------------- |
|
904 // |
|
905 // --------------------------------------------------------------------------- |
|
906 // |
|
907 TBool CCaSrvAppScanner::SetJavaAppL( CCaInnerEntry* aEntry ) |
|
908 { |
|
909 TBool changed = AddAttributeL( |
|
910 aEntry, KCaAttrAppType, KCaAttrAppTypeValueJava ); |
|
911 TComponentId compId = GetComponentIdFromEntryL( aEntry ); |
|
912 CPropertyEntry* propertyEntry = iSoftwareRegistry.GetComponentPropertyL( |
|
913 compId, KCaScrPropertyAppSettings ); |
|
914 CleanupStack::PushL( propertyEntry ); |
|
915 |
|
916 if( propertyEntry |
|
917 && propertyEntry->PropertyType() |
|
918 == CPropertyEntry::ELocalizedProperty ) |
|
919 { |
|
920 changed = AddAttributeL( aEntry, KCaAttrAppSettingsPlugin, |
|
921 static_cast<CLocalizablePropertyEntry*>( |
|
922 propertyEntry)->StrValue() ) || changed; |
|
923 } |
|
924 CleanupStack::PopAndDestroy( propertyEntry ); |
|
925 return changed; |
|
926 } |
|
927 |
|
928 // --------------------------------------------------------------------------- |
|
929 // |
|
930 // --------------------------------------------------------------------------- |
|
931 // |
|
932 TBool CCaSrvAppScanner::SetCWRTAppL( CCaInnerEntry* aEntry ) |
|
933 { |
|
934 TBool changed = AddAttributeL( aEntry, KCaAttrAppType, KCaAttrAppTypeValueCWRT ); |
|
935 TComponentId compId = GetComponentIdFromEntryL( aEntry ); |
|
936 |
|
937 CPropertyEntry* isMiniview = iSoftwareRegistry.GetComponentPropertyL( |
|
938 compId, KCaScrPropertyIsMiniviewSupported ); |
|
939 CleanupStack::PushL( isMiniview ); |
|
940 |
|
941 // check first if we support mini view |
|
942 if( isMiniview && isMiniview->PropertyType() == CPropertyEntry::EIntProperty |
|
943 && static_cast<CIntPropertyEntry*>( isMiniview)->IntValue() ) |
|
944 { |
|
945 CPropertyEntry* appId = iSoftwareRegistry.GetComponentPropertyL( |
|
946 compId, KCaScrPropertyAppId ); |
|
947 CleanupStack::PushL( appId ); |
|
948 |
|
949 if ( appId |
|
950 && appId->PropertyType() == CPropertyEntry::ELocalizedProperty ) |
|
951 { |
|
952 changed = AddAttributeL( |
|
953 aEntry, KCaAttrAppWidgetUri, KCaAttrAppWidgetUriCWRTValue ) |
|
954 || changed; |
|
955 changed = AddAttributeL( aEntry, KCaAttrAppWidgetParamWebAppId, |
|
956 static_cast<CLocalizablePropertyEntry*>( |
|
957 appId)->StrValue() ) || changed; |
|
958 } |
|
959 CleanupStack::PopAndDestroy( appId ); |
|
960 } |
|
961 CleanupStack::PopAndDestroy( isMiniview ); |
|
962 return changed; |
|
963 } |
|
964 |
|
965 // --------------------------------------------------------- |
|
966 // |
|
967 // --------------------------------------------------------- |
|
968 // |
|
969 TBool CCaSrvAppScanner::AddAttributeL( CCaInnerEntry* aEntry, const TDesC& aKey, |
|
970 const TDesC& aValue ) |
|
971 { |
|
972 TBool changed(EFalse); |
|
973 RBuf attrValue; |
|
974 attrValue.CleanupClosePushL(); |
|
975 attrValue.CreateL( KCaMaxAttrValueLen ); |
|
976 |
|
977 TBool found = aEntry->FindAttribute( aKey, attrValue ); |
|
978 if( !( found && attrValue.Compare( aValue ) == KErrNone ) ) |
|
979 { |
|
980 aEntry->AddAttributeL( aKey, aValue ); |
|
981 changed = ETrue; |
|
982 } |
|
983 CleanupStack::PopAndDestroy( &attrValue ); |
|
984 return changed; |
|
985 } |
|
986 |
|
987 // --------------------------------------------------------- |
|
988 // |
|
989 // --------------------------------------------------------- |
|
990 // |
|
991 TBool CCaSrvAppScanner::RemoveAttributeL( CCaInnerEntry* aEntry, |
|
992 const TDesC& aKey ) |
|
993 { |
|
994 TBool toChange( EFalse ); |
|
995 RBuf attrVal; |
|
996 attrVal.CleanupClosePushL(); |
|
997 attrVal.CreateL( KCaMaxAttrValueLen ); |
|
998 if( aEntry->FindAttribute( KCaAttrMmcId, attrVal ) ) |
|
999 { |
|
1000 aEntry->RemoveAttributeL( aKey ); |
|
1001 toChange = ETrue; |
|
1002 } |
|
1003 CleanupStack::PopAndDestroy( &attrVal ); |
|
1004 return toChange; |
896 } |
1005 } |
897 |
1006 |
898 // --------------------------------------------------------- |
1007 // --------------------------------------------------------- |
899 // |
1008 // |
900 // --------------------------------------------------------- |
1009 // --------------------------------------------------------- |
1006 |
1110 |
1007 // --------------------------------------------------------- |
1111 // --------------------------------------------------------- |
1008 // |
1112 // |
1009 // --------------------------------------------------------- |
1113 // --------------------------------------------------------- |
1010 // |
1114 // |
1011 TBool CCaSrvAppScanner::IsFileInDrive( |
1115 TBool CCaSrvAppScanner::IsCharInDrive( const TChar& aDriveLetter, |
1012 const TDesC& aFileName, |
1116 const DriveInfo::TDefaultDrives& aDefaultDrive ) const |
1013 const DriveInfo::TDefaultDrives& aDefaultDrive ) const |
|
1014 { |
1117 { |
1015 TBool retVal( EFalse ); |
1118 TBool retVal( EFalse ); |
1016 if ( aFileName.Length()>0 ) |
1119 TInt mmcDrive; |
1017 { |
1120 TInt err = DriveInfo::GetDefaultDrive( aDefaultDrive, mmcDrive ); |
1018 TInt mmcDrive; |
1121 if( !err ) |
1019 TInt err = DriveInfo::GetDefaultDrive( aDefaultDrive, mmcDrive ); |
1122 { |
1020 if( !err ) |
1123 TInt fileDrive; |
1021 { |
1124 err = RFs::CharToDrive( aDriveLetter, fileDrive ); |
1022 TInt fileDrive; |
1125 if( !err && fileDrive == mmcDrive ) |
1023 err = RFs::CharToDrive( aFileName[0], fileDrive ); |
1126 { |
1024 if( !err && fileDrive == mmcDrive ) |
1127 retVal = ETrue; |
1025 { |
|
1026 retVal = ETrue; |
|
1027 } |
|
1028 } |
1128 } |
1029 } |
1129 } |
1030 return retVal; |
1130 return retVal; |
1031 } |
|
1032 |
|
1033 // --------------------------------------------------------- |
|
1034 // |
|
1035 // --------------------------------------------------------- |
|
1036 // |
|
1037 TBool CCaSrvAppScanner::IsAppInDriveL( |
|
1038 const TUid aUid, |
|
1039 const DriveInfo::TDefaultDrives& aDefaultDrive ) const |
|
1040 { |
|
1041 TBool ret( EFalse ); |
|
1042 TApaAppInfo* appInfo = new ( ELeave ) TApaAppInfo(); |
|
1043 TInt err = iApaLsSession.GetAppInfo( *appInfo, aUid ); |
|
1044 if( !err && IsFileInDrive( appInfo->iFullName, aDefaultDrive ) ) |
|
1045 { |
|
1046 ret = ETrue; |
|
1047 } |
|
1048 delete appInfo; |
|
1049 return ret; |
|
1050 } |
|
1051 |
|
1052 // --------------------------------------------------------- |
|
1053 // |
|
1054 // --------------------------------------------------------- |
|
1055 // |
|
1056 TBool CCaSrvAppScanner::IsInMmcL( const TUid aUid ) const |
|
1057 { |
|
1058 return IsAppInDriveL( aUid, DriveInfo::EDefaultRemovableMassStorage ); |
|
1059 } |
|
1060 |
|
1061 // --------------------------------------------------------- |
|
1062 // |
|
1063 // --------------------------------------------------------- |
|
1064 // |
|
1065 TBool CCaSrvAppScanner::IsInMassStorageL( const TUid aUid ) const |
|
1066 { |
|
1067 return IsAppInDriveL( aUid, DriveInfo::EDefaultMassStorage ); |
|
1068 } |
|
1069 |
|
1070 // --------------------------------------------------------- |
|
1071 // |
|
1072 // --------------------------------------------------------- |
|
1073 // |
|
1074 TBool CCaSrvAppScanner::IsInRomL( TInt aUid ) |
|
1075 { |
|
1076 return IsAppInDriveL( TUid::Uid( aUid ), DriveInfo::EDefaultRom ); |
|
1077 } |
1131 } |
1078 |
1132 |
1079 // --------------------------------------------------------- |
1133 // --------------------------------------------------------- |
1080 // |
1134 // |
1081 // --------------------------------------------------------- |
1135 // --------------------------------------------------------- |
1156 CleanupStack::PopAndDestroy( &resultEntriesArray ); |
1210 CleanupStack::PopAndDestroy( &resultEntriesArray ); |
1157 } |
1211 } |
1158 |
1212 |
1159 // --------------------------------------------------------- |
1213 // --------------------------------------------------------- |
1160 // |
1214 // |
1161 // ---------------------------------------------------------// |
1215 // --------------------------------------------------------- |
1162 TBool CCaSrvAppScanner::UpdateComponentIdL( CCaInnerEntry& aEntry ) const |
1216 // |
|
1217 TInt CCaSrvAppScanner::GetComponentIdFromEntryL( CCaInnerEntry* aEntry ) |
|
1218 { |
|
1219 TInt id(0); |
|
1220 RBuf componentId; |
|
1221 componentId.CleanupClosePushL(); |
|
1222 componentId.CreateL( KCaMaxAttrValueLen ); |
|
1223 |
|
1224 TBool found = aEntry->FindAttribute( KCaComponentId, componentId ); |
|
1225 if( found ) |
|
1226 { |
|
1227 TLex parser; |
|
1228 parser.Assign( componentId ); |
|
1229 parser.Val( id ); |
|
1230 } |
|
1231 CleanupStack::PopAndDestroy( &componentId ); |
|
1232 |
|
1233 return id; |
|
1234 } |
|
1235 |
|
1236 // --------------------------------------------------------- |
|
1237 // |
|
1238 // --------------------------------------------------------- |
|
1239 // |
|
1240 TBool CCaSrvAppScanner::UpdateComponentIdL( CCaInnerEntry& aEntry ) |
1163 { |
1241 { |
1164 TBool updated( EFalse ); |
1242 TBool updated( EFalse ); |
1165 |
|
1166 TUid uid; |
|
1167 TInt err(KErrNone); |
|
1168 TComponentId componentId( 0 ); |
1243 TComponentId componentId( 0 ); |
1169 TRAP(err, componentId = |
1244 |
1170 iSoftwareRegistry.GetComponentIdForAppL( |
1245 TRAPD(err, componentId = iSoftwareRegistry.GetComponentIdForAppL( |
1171 uid.Uid( aEntry.GetUid() ) ) ) |
1246 TUid::Uid( aEntry.GetUid() ) ) ) |
1172 |
1247 |
1173 if ( componentId > 0 && err == KErrNone ) |
1248 if ( componentId > 0 && err == KErrNone ) |
1174 { |
1249 { |
1175 RBuf newComponentId; |
1250 RBuf newComponentId; |
1176 newComponentId.CleanupClosePushL(); |
1251 newComponentId.CleanupClosePushL(); |
1177 newComponentId.CreateL( sizeof(TComponentId) + 1 ); |
1252 newComponentId.CreateL( sizeof(TComponentId) + 1 ); |
1178 newComponentId.AppendNum( componentId ); |
1253 newComponentId.AppendNum( componentId ); |
1179 |
1254 |
1180 RBuf oldComponentId; |
1255 // 'add' or 'update' the component id attribute value |
1181 oldComponentId.CleanupClosePushL(); |
1256 updated = AddAttributeL( &aEntry, KCaComponentId, newComponentId ); |
1182 oldComponentId.CreateL( KCaMaxAttrValueLen ); |
1257 |
1183 |
|
1184 const TBool componentIdAttributeFound = |
|
1185 aEntry.FindAttribute( KCaComponentId, oldComponentId ); |
|
1186 |
|
1187 if ( !componentIdAttributeFound |
|
1188 || oldComponentId.Compare( newComponentId ) != 0 ) |
|
1189 { |
|
1190 // 'add' or 'update' the component id attribute value |
|
1191 aEntry.AddAttributeL( KCaComponentId, |
|
1192 newComponentId ); |
|
1193 |
|
1194 updated = ETrue; |
|
1195 } |
|
1196 |
|
1197 CleanupStack::PopAndDestroy( &oldComponentId ); |
|
1198 CleanupStack::PopAndDestroy( &newComponentId ); |
1258 CleanupStack::PopAndDestroy( &newComponentId ); |
1199 } |
1259 } |
1200 return updated; |
1260 return updated; |
1201 } |
1261 } |