128 User::Leave( mdRes ); |
122 User::Leave( mdRes ); |
129 } |
123 } |
130 } |
124 } |
131 iMmcHistory = CCaSrvMmcHistory::NewL(); |
125 iMmcHistory = CCaSrvMmcHistory::NewL(); |
132 iMmcHistory->LoadL( iFs, KCaMmcHistoryFname() ); |
126 iMmcHistory->LoadL( iFs, KCaMmcHistoryFname() ); |
133 iNotifier = CApaAppListNotifier::NewL( |
|
134 this, CActive::EPriorityStandard ); |
|
135 iInstallNotifier = CCaInstallNotifier::NewL( |
|
136 *this, CCaInstallNotifier::ESisInstallNotification ); |
|
137 |
127 |
138 User::LeaveIfError( iApaLsSession.Connect() ); |
128 User::LeaveIfError( iApaLsSession.Connect() ); |
139 User::LeaveIfError( iApaLsSession.GetAllApps() ); // This is async. |
|
140 User::LeaveIfError( iSoftwareRegistry.Connect() ); |
129 User::LeaveIfError( iSoftwareRegistry.Connect() ); |
141 iApaLsSession.RegisterListPopulationCompleteObserver( iStatus ); |
130 iApaLsSession.SetNotify( EFalse, iStatus ); |
142 iCollectionDownloadId = 0; |
131 iCollectionDownloadId = 0; |
143 iAllCollectionId = 0; |
132 iAllCollectionId = 0; |
144 |
133 |
145 //TODO temporary sollution for fake uninstall progres notification |
134 UpdateApplicationEntriesL(); |
146 ClearUninstallFlagL(); |
135 MakeNotEmptyCollectionsVisibleL(); |
147 |
136 |
148 SetActive(); |
137 SetActive(); |
149 } |
138 } |
150 |
139 |
151 // --------------------------------------------------------- |
140 // --------------------------------------------------------- |
152 // |
141 // |
153 // --------------------------------------------------------- |
142 // --------------------------------------------------------- |
154 // |
143 // |
155 //TODO temporary sollution for fake uninstall progres notification |
|
156 void CCaSrvAppScanner::ClearUninstallFlagL() |
|
157 { |
|
158 CCaInnerQuery* uninstallQuery = CCaInnerQuery::NewLC(); |
|
159 uninstallQuery->SetFlagsOn( EUninstall ); |
|
160 |
|
161 RPointerArray<CCaInnerEntry> resultArray; |
|
162 CleanupResetAndDestroyPushL( resultArray ); |
|
163 iCaStorageProxy.GetEntriesL( uninstallQuery, resultArray ); |
|
164 for( TInt i = 0; i < resultArray.Count(); i++ ) |
|
165 { |
|
166 resultArray[i]->SetFlags( resultArray[i]->GetFlags() & ~EUninstall ); |
|
167 iCaStorageProxy.AddL( resultArray[i] ); |
|
168 } |
|
169 CleanupStack::PopAndDestroy( &resultArray ); |
|
170 |
|
171 CleanupStack::PopAndDestroy( uninstallQuery ); |
|
172 } |
|
173 |
|
174 // --------------------------------------------------------- |
|
175 // |
|
176 // --------------------------------------------------------- |
|
177 // |
|
178 void CCaSrvAppScanner::RunL() |
144 void CCaSrvAppScanner::RunL() |
179 { |
145 { |
180 User::LeaveIfError( iStatus.Int() ); |
146 User::LeaveIfError( iStatus.Int() ); |
|
147 |
181 // AppArc app scan complete, we have the app list. |
148 // AppArc app scan complete, we have the app list. |
182 UpdateApplicationEntriesL(); |
149 RArray<TApaAppUpdateInfo> updatedAppsInfo; |
183 InstallationNotifyL(); |
150 CleanupClosePushL( updatedAppsInfo ); |
184 MakeNotEmptyCollectionsVisibleL(); |
151 iApaLsSession.UpdatedAppsInfoL( updatedAppsInfo ); |
|
152 |
|
153 for( TInt i = 0; i < updatedAppsInfo.Count(); i++ ) |
|
154 { |
|
155 TApaAppUpdateInfo::TApaAppAction action = updatedAppsInfo[i].iAction; |
|
156 RPointerArray<CCaInnerEntry> resultArray; |
|
157 CleanupResetAndDestroyPushL( resultArray ); |
|
158 GetCaAppEntriesL( updatedAppsInfo[i].iAppUid.iUid, resultArray ); |
|
159 if( action == TApaAppUpdateInfo::EAppPresent |
|
160 || action == TApaAppUpdateInfo::EAppInfoChanged ) |
|
161 { |
|
162 TInt id; |
|
163 if( !resultArray.Count() ) |
|
164 { |
|
165 id = AddAppEntryL( |
|
166 updatedAppsInfo[i].iAppUid.iUid, UpdateMmcHistoryL() ); |
|
167 } |
|
168 else |
|
169 { |
|
170 ASSERT( resultArray.Count() == 1 ); |
|
171 id = resultArray[0]->GetId(); |
|
172 UpdateAppEntryL( resultArray[0], UpdateMmcHistoryL(), ETrue ); |
|
173 AddEntryToPredefinedCollectionL( resultArray[0], ETrue ); |
|
174 } |
|
175 AddEntryToDownloadedCollectionL( id ); |
|
176 MakeNotEmptyCollectionsVisibleL(); |
|
177 } |
|
178 else if( action == TApaAppUpdateInfo::EAppNotPresent ) |
|
179 { |
|
180 HandleMissingItemsL( resultArray ); |
|
181 } |
|
182 else |
|
183 { |
|
184 User::Leave( KErrNotSupported ); |
|
185 } |
|
186 CleanupStack::PopAndDestroy( &resultArray ); |
|
187 } |
|
188 CleanupStack::PopAndDestroy( &updatedAppsInfo ); |
|
189 |
|
190 iApaLsSession.SetNotify( EFalse, iStatus ); |
|
191 SetActive(); |
185 } |
192 } |
186 |
193 |
187 // --------------------------------------------------------- |
194 // --------------------------------------------------------- |
188 // |
195 // |
189 // --------------------------------------------------------- |
196 // --------------------------------------------------------- |
190 // |
197 // |
191 void CCaSrvAppScanner::DoCancel() |
198 void CCaSrvAppScanner::DoCancel() |
192 { |
199 { |
193 iApaLsSession.CancelListPopulationCompleteObserver(); |
200 iApaLsSession.CancelNotify(); |
194 } |
201 } |
195 |
202 |
196 // --------------------------------------------------------- |
203 // --------------------------------------------------------- |
197 // |
204 // |
198 // --------------------------------------------------------- |
205 // --------------------------------------------------------- |
245 |
252 |
246 // --------------------------------------------------------- |
253 // --------------------------------------------------------- |
247 // |
254 // |
248 // --------------------------------------------------------- |
255 // --------------------------------------------------------- |
249 // |
256 // |
250 void CCaSrvAppScanner::UpdateAppEntryL( CCaInnerEntry* aEntry, TUint aMmcId ) |
257 void CCaSrvAppScanner::UpdateAppEntryL( |
|
258 CCaInnerEntry* aEntry, TUint aMmcId, TBool aAlwaysUpdate ) |
251 { |
259 { |
252 TBool toUpdate = HandleMmcAttrUpdateL( aEntry, aMmcId ); |
260 TBool toUpdate = HandleMmcAttrUpdateL( aEntry, aMmcId ); |
253 TBool missingVisibleFlagChanged = |
261 TBool missingVisibleFlagChanged = |
254 HandleMissingVisibleFlagsUpdate( aEntry ); |
262 HandleMissingVisibleFlagsUpdate( aEntry ); |
255 toUpdate = missingVisibleFlagChanged || toUpdate; |
263 toUpdate = missingVisibleFlagChanged || toUpdate; |
256 toUpdate = HandleRemovableVisibleFlagsUpdateL( aEntry ) || toUpdate; |
264 toUpdate = HandleRemovableVisibleFlagsUpdateL( aEntry ) || toUpdate; |
257 toUpdate = SetApaAppInfoL( aEntry ) || toUpdate; |
265 toUpdate = SetApaAppInfoL( aEntry ) || toUpdate; |
258 |
266 toUpdate = RemoveUninstallFlagL( aEntry ) || toUpdate; |
259 if( iInstalledPackages.Find( aEntry->GetUid() ) != KErrNotFound ) |
267 |
260 { |
268 if( toUpdate || aAlwaysUpdate ) |
261 AddEntryToDownloadedCollectionL( aEntry->GetId() ); |
|
262 toUpdate = HandleUsedFlagUpdate( aEntry ) || toUpdate; |
|
263 AddEntryToPredefinedCollectionL( aEntry, ETrue ); |
|
264 } |
|
265 if( toUpdate ) |
|
266 { |
269 { |
267 //update app in storage |
270 //update app in storage |
|
271 HandleUsedFlagUpdate( aEntry ); |
268 TItemAppearance itemAppearanceChange = EItemAppearanceNotChanged; |
272 TItemAppearance itemAppearanceChange = EItemAppearanceNotChanged; |
269 if( missingVisibleFlagChanged ) |
273 if( missingVisibleFlagChanged ) |
270 { |
274 { |
271 itemAppearanceChange = EItemAppeared; |
275 itemAppearanceChange = EItemAppeared; |
272 } |
276 } |
273 iCaStorageProxy.AddL( aEntry, EFalse, itemAppearanceChange ); |
277 iCaStorageProxy.AddL( aEntry, EFalse, itemAppearanceChange ); |
274 RemoveFromInstalledPackages( aEntry->GetUid() ); |
|
275 } |
278 } |
276 } |
279 } |
277 |
280 |
278 // --------------------------------------------------------- |
281 // --------------------------------------------------------- |
279 // |
282 // |
625 |
630 |
626 // --------------------------------------------------------- |
631 // --------------------------------------------------------- |
627 // |
632 // |
628 // --------------------------------------------------------- |
633 // --------------------------------------------------------- |
629 // |
634 // |
630 void CCaSrvAppScanner::HandleAppListEvent( TInt /*aEvent*/) |
|
631 { |
|
632 // We only have one event, EAppListChanged. |
|
633 // Call back RunL async, to requeue and initiate rescan. |
|
634 if( !IsActive() ) |
|
635 { |
|
636 ScheduleScan(); |
|
637 } |
|
638 } |
|
639 |
|
640 // --------------------------------------------------------- |
|
641 // |
|
642 // --------------------------------------------------------- |
|
643 // |
|
644 void CCaSrvAppScanner::HandleInstallNotifyL( TInt aUid ) |
|
645 { |
|
646 NotifyL( aUid ); |
|
647 RArray<TUid> uids; |
|
648 CleanupClosePushL( uids ); |
|
649 |
|
650 Swi::RSisRegistrySession iSisRegSession; |
|
651 CleanupClosePushL( iSisRegSession ); |
|
652 User::LeaveIfError( iSisRegSession.Connect() ); |
|
653 |
|
654 // Open sis package entry related to aUid |
|
655 Swi::RSisRegistryEntry packageEntry; |
|
656 if( KErrNone |
|
657 == packageEntry.Open( iSisRegSession, TUid::Uid( aUid ) ) ) |
|
658 { |
|
659 CleanupClosePushL( packageEntry ); |
|
660 |
|
661 // Get packageEntry's embedded sis' |
|
662 RPointerArray<Swi::CSisRegistryPackage> embedded; |
|
663 CleanupResetAndDestroyPushL( embedded ); |
|
664 packageEntry.EmbeddedPackagesL( embedded ); |
|
665 if( embedded.Count() ) |
|
666 { |
|
667 // For each embadded sis we notify storage - recursive call |
|
668 for( TInt i = 0; i < embedded.Count(); ++i ) |
|
669 { |
|
670 HandleInstallNotifyL( embedded[i]->Uid().iUid ); |
|
671 } |
|
672 } |
|
673 else |
|
674 { |
|
675 // There are no embaddes sis', so we can notify storage |
|
676 // of changes in apps included in packageEntry |
|
677 NotifyL( packageEntry ); |
|
678 } |
|
679 CleanupStack::PopAndDestroy( &embedded ); |
|
680 CleanupStack::PopAndDestroy( &packageEntry ); |
|
681 } |
|
682 CleanupStack::PopAndDestroy( &iSisRegSession ); |
|
683 CleanupStack::PopAndDestroy( &uids ); |
|
684 } |
|
685 |
|
686 // --------------------------------------------------------- |
|
687 // |
|
688 // --------------------------------------------------------- |
|
689 // |
|
690 void CCaSrvAppScanner::NotifyL( Swi::RSisRegistryEntry & aPackageEntry ) |
|
691 { |
|
692 // Get sids ( == uids of exetucables included in aPackageEntry ) |
|
693 RArray<TUid> sids; |
|
694 CleanupClosePushL( sids ); |
|
695 aPackageEntry.SidsL( sids ); |
|
696 if( sids.Count() ) |
|
697 { |
|
698 // For each sid we notify storage |
|
699 for( TInt i = 0; i < sids.Count(); ++i ) |
|
700 { |
|
701 iInstalledPackages.Append( sids[i].iUid ); |
|
702 } |
|
703 } |
|
704 CleanupStack::PopAndDestroy( &sids ); |
|
705 } |
|
706 |
|
707 // --------------------------------------------------------- |
|
708 // |
|
709 // --------------------------------------------------------- |
|
710 // |
|
711 void CCaSrvAppScanner::NotifyL( TInt aAppUid ) |
|
712 { |
|
713 // Get entries for given aAppUid |
|
714 RPointerArray<CCaInnerEntry> resultArray; |
|
715 CleanupResetAndDestroyPushL( resultArray ); |
|
716 GetCaAppEntriesL( aAppUid, resultArray ); |
|
717 if( resultArray.Count() && ( resultArray[0]->GetFlags() & EVisible ) ) |
|
718 {//TODO: this only for icons. This functionality should be change |
|
719 iCaStorageProxy.AddL( resultArray[0] ); |
|
720 } |
|
721 CleanupStack::PopAndDestroy( &resultArray ); |
|
722 } |
|
723 |
|
724 // --------------------------------------------------------- |
|
725 // |
|
726 // --------------------------------------------------------- |
|
727 // |
|
728 void CCaSrvAppScanner::AddEntryToDownloadedCollectionL( TInt aEntryId ) |
635 void CCaSrvAppScanner::AddEntryToDownloadedCollectionL( TInt aEntryId ) |
729 { |
636 { |
730 TCaOperationParams params; |
637 TCaOperationParams params; |
731 params.iOperationType = TCaOperationParams::EPrepend; |
638 params.iOperationType = TCaOperationParams::EPrepend; |
732 params.iGroupId = GetCollectionDownloadIdL(); |
639 params.iGroupId = GetCollectionDownloadIdL(); |
868 |
775 |
869 // --------------------------------------------------------- |
776 // --------------------------------------------------------- |
870 // |
777 // |
871 // --------------------------------------------------------- |
778 // --------------------------------------------------------- |
872 // |
779 // |
873 void CCaSrvAppScanner::ScheduleScan() |
780 TInt CCaSrvAppScanner::AddAppEntryL( TUint aUid, TUint aCurrentMmcId ) |
874 { |
781 { |
875 if( !IsActive() ) |
782 TInt id(KErrNotFound); |
876 { |
|
877 TRequestStatus* ownStatus = &iStatus; |
|
878 *ownStatus = KRequestPending; |
|
879 SetActive(); |
|
880 User::RequestComplete( ownStatus, KErrNone ); |
|
881 } |
|
882 } |
|
883 |
|
884 // --------------------------------------------------------- |
|
885 // |
|
886 // --------------------------------------------------------- |
|
887 // |
|
888 void CCaSrvAppScanner::AddAppEntryL( TUint aUid, TUint aCurrentMmcId ) |
|
889 { |
|
890 // Now add the app entry. |
783 // Now add the app entry. |
891 CCaInnerEntry* appEntry = CCaInnerEntry::NewLC(); |
784 CCaInnerEntry* appEntry = CCaInnerEntry::NewLC(); |
892 |
785 |
893 appEntry->SetEntryTypeNameL( KCaTypeApp ); |
786 appEntry->SetEntryTypeNameL( KCaTypeApp ); |
894 appEntry->SetUid( aUid ); |
787 appEntry->SetUid( aUid ); |
898 SetApaAppInfoL( appEntry ); |
791 SetApaAppInfoL( appEntry ); |
899 HandleRemovableVisibleFlagsUpdateL( appEntry ); |
792 HandleRemovableVisibleFlagsUpdateL( appEntry ); |
900 HandleMmcAttrUpdateL( appEntry, aCurrentMmcId ); |
793 HandleMmcAttrUpdateL( appEntry, aCurrentMmcId ); |
901 |
794 |
902 iCaStorageProxy.AddL( appEntry ); |
795 iCaStorageProxy.AddL( appEntry ); |
|
796 id = appEntry->GetId(); |
903 |
797 |
904 AddEntryToPredefinedCollectionL( appEntry ); |
798 AddEntryToPredefinedCollectionL( appEntry ); |
905 |
799 |
906 if( iInstalledPackages.Find( aUid ) != KErrNotFound ) |
|
907 { |
|
908 AddEntryToDownloadedCollectionL( appEntry->GetId() ); |
|
909 RemoveFromInstalledPackages( aUid ); |
|
910 } |
|
911 |
|
912 CleanupStack::PopAndDestroy( appEntry ); |
800 CleanupStack::PopAndDestroy( appEntry ); |
913 } |
801 return id; |
914 |
|
915 // --------------------------------------------------------- |
|
916 // |
|
917 // --------------------------------------------------------- |
|
918 // |
|
919 void CCaSrvAppScanner::RemoveFromInstalledPackages( TUint aUid ) |
|
920 { |
|
921 TInt appIndex = iInstalledPackages.Find( aUid ); |
|
922 if( appIndex != KErrNotFound ) |
|
923 { |
|
924 iInstalledPackages.Remove( appIndex ); |
|
925 } |
|
926 } |
802 } |
927 |
803 |
928 // --------------------------------------------------------------------------- |
804 // --------------------------------------------------------------------------- |
929 // |
805 // |
930 // --------------------------------------------------------------------------- |
806 // --------------------------------------------------------------------------- |
946 { |
822 { |
947 aEntry->SetTextL( info->iCaption ); |
823 aEntry->SetTextL( info->iCaption ); |
948 aEntry->AddAttributeL( KCaAttrShortName, info->iShortCaption ); |
824 aEntry->AddAttributeL( KCaAttrShortName, info->iShortCaption ); |
949 changed = ETrue; |
825 changed = ETrue; |
950 } |
826 } |
951 |
827 |
952 |
828 |
953 if ( UpdateComponentIdL( *aEntry ) ) |
829 if ( UpdateComponentIdL( *aEntry ) ) |
954 { |
830 { |
955 changed = ETrue; |
831 changed = ETrue; |
956 } |
832 } |
957 |
833 |
958 CleanupStack::PopAndDestroy( &attrVal ); |
834 CleanupStack::PopAndDestroy( &attrVal ); |
959 |
835 |
960 // check if its java app and add attr for entries |
836 // check if its java app and add attr for entries |
961 TUid appTypeUid; |
837 TUid appTypeUid; |
962 if( KErrNone == iApaLsSession.GetAppType( appTypeUid, info->iUid ) ) |
838 if( KErrNone == iApaLsSession.GetAppType( appTypeUid, info->iUid ) ) |
963 { |
839 { |
964 if( appTypeUid == KMidletApplicationTypeUid ) |
840 if( appTypeUid == KMidletApplicationTypeUid ) |
965 { |
841 { |
966 aEntry->AddAttributeL( |
842 aEntry->AddAttributeL( |
967 KCaAttrAppType, |
843 KCaAttrAppType, |
968 KCaAttrAppTypeValueJava ); |
844 KCaAttrAppTypeValueJava ); |
969 |
845 |
970 TComponentId compId = |
846 TComponentId compId = |
971 iSoftwareRegistry.GetComponentIdForAppL( info->iUid ); |
847 iSoftwareRegistry.GetComponentIdForAppL( info->iUid ); |
972 CPropertyEntry* propertyEntry = |
848 CPropertyEntry* propertyEntry = |
973 iSoftwareRegistry.GetComponentPropertyL( compId, KCaScrPropertyAppSettings ); |
849 iSoftwareRegistry.GetComponentPropertyL( compId, KCaScrPropertyAppSettings ); |
974 CleanupStack::PushL( propertyEntry ); |
850 CleanupStack::PushL( propertyEntry ); |
975 if ( propertyEntry && |
851 if ( propertyEntry && |
976 propertyEntry->PropertyType() == CPropertyEntry::ELocalizedProperty ) |
852 propertyEntry->PropertyType() == CPropertyEntry::ELocalizedProperty ) |
977 { |
853 { |
978 aEntry->AddAttributeL( |
854 aEntry->AddAttributeL( |
979 KCaAttrAppSettingsPlugin, |
855 KCaAttrAppSettingsPlugin, |
980 static_cast<CLocalizablePropertyEntry*>(propertyEntry)->StrValue() ); |
856 static_cast<CLocalizablePropertyEntry*>(propertyEntry)->StrValue() ); |
981 } |
857 } |
984 else if ( appTypeUid == KCWRTApplicationTypeUid ) |
860 else if ( appTypeUid == KCWRTApplicationTypeUid ) |
985 { |
861 { |
986 aEntry->AddAttributeL( |
862 aEntry->AddAttributeL( |
987 KCaAttrAppType, |
863 KCaAttrAppType, |
988 KCaAttrAppTypeValueCWRT ); |
864 KCaAttrAppTypeValueCWRT ); |
989 TComponentId compId = |
865 TComponentId compId = |
990 iSoftwareRegistry.GetComponentIdForAppL( info->iUid ); |
866 iSoftwareRegistry.GetComponentIdForAppL( info->iUid ); |
991 CPropertyEntry* isMiniview = |
867 CPropertyEntry* isMiniview = |
992 iSoftwareRegistry.GetComponentPropertyL( compId, |
868 iSoftwareRegistry.GetComponentPropertyL( compId, |
993 KCaScrPropertyIsMiniviewSupported ); |
869 KCaScrPropertyIsMiniviewSupported ); |
994 CleanupStack::PushL( isMiniview ); |
870 CleanupStack::PushL( isMiniview ); |
995 // check first if we support mini view |
871 // check first if we support mini view |
996 if (isMiniview && isMiniview->PropertyType() == CPropertyEntry::EIntProperty && |
872 if (isMiniview && isMiniview->PropertyType() == CPropertyEntry::EIntProperty && |
997 static_cast<CIntPropertyEntry*>(isMiniview)->IntValue()) |
873 static_cast<CIntPropertyEntry*>(isMiniview)->IntValue()) |
998 { |
874 { |
999 CPropertyEntry* appId = |
875 CPropertyEntry* appId = |
1000 iSoftwareRegistry.GetComponentPropertyL( compId, KCaScrPropertyAppId ); |
876 iSoftwareRegistry.GetComponentPropertyL( compId, KCaScrPropertyAppId ); |
1001 CleanupStack::PushL( appId ); |
877 CleanupStack::PushL( appId ); |
1002 if ( appId && |
878 if ( appId && |
1003 appId->PropertyType() == CPropertyEntry::ELocalizedProperty ) |
879 appId->PropertyType() == CPropertyEntry::ELocalizedProperty ) |
1004 { |
880 { |
1005 aEntry->AddAttributeL( |
881 aEntry->AddAttributeL( |
1006 KCaAttrAppWidgetUri, |
882 KCaAttrAppWidgetUri, |
1007 KCaAttrAppWidgetUriCWRTValue ); |
883 KCaAttrAppWidgetUriCWRTValue ); |
1008 aEntry->AddAttributeL( |
884 aEntry->AddAttributeL( |
1009 KCaAttrAppWidgetParamWebAppId, |
885 KCaAttrAppWidgetParamWebAppId, |
1010 static_cast<CLocalizablePropertyEntry*>(appId)->StrValue() ); |
886 static_cast<CLocalizablePropertyEntry*>(appId)->StrValue() ); |
1011 } |
887 } |
1012 CleanupStack::PopAndDestroy( appId ); |
888 CleanupStack::PopAndDestroy( appId ); |
1013 } |
889 } |
1014 CleanupStack::PopAndDestroy( isMiniview ); |
890 CleanupStack::PopAndDestroy( isMiniview ); |
1015 } |
891 } |
1016 } |
892 } |
1017 } |
893 } |
1018 CleanupStack::PopAndDestroy( info ); |
894 CleanupStack::PopAndDestroy( info ); |
1034 if( aCaEntries[i]->FindAttribute( KCaAttrMmcId(), attrVal ) ) |
910 if( aCaEntries[i]->FindAttribute( KCaAttrMmcId(), attrVal ) ) |
1035 { |
911 { |
1036 TUint mmcId = 0; |
912 TUint mmcId = 0; |
1037 MenuUtils::GetTUint( attrVal, mmcId ); |
913 MenuUtils::GetTUint( attrVal, mmcId ); |
1038 if( ( mmcId && KErrNotFound != iMmcHistory->Find( mmcId ) |
914 if( ( mmcId && KErrNotFound != iMmcHistory->Find( mmcId ) |
1039 && mmcId != CurrentMmcId() ) |
915 && mmcId != CurrentMmcId() ) |
1040 || ( attrVal == KCaMassStorage() |
916 || ( attrVal == KCaMassStorage() |
1041 && IsDriveInUse( DriveInfo::EDefaultMassStorage ) ) ) |
917 && IsDriveInUse( DriveInfo::EDefaultMassStorage ) ) ) |
1042 { |
918 { |
1043 // This item is on an MMC which is currently |
919 // This item is on an MMC which is currently |
1044 // in the MMC history or on a mass storage in use. |
920 // in the MMC history or on a mass storage in use. |
1045 // Set it "missing" but keep it. |
921 // Set it "missing" but keep it. |
1284 // |
1160 // |
1285 // ---------------------------------------------------------// |
1161 // ---------------------------------------------------------// |
1286 TBool CCaSrvAppScanner::UpdateComponentIdL( CCaInnerEntry& aEntry ) const |
1162 TBool CCaSrvAppScanner::UpdateComponentIdL( CCaInnerEntry& aEntry ) const |
1287 { |
1163 { |
1288 TBool updated( EFalse ); |
1164 TBool updated( EFalse ); |
1289 |
1165 |
1290 TUid uid; |
1166 TUid uid; |
1291 TInt err(KErrNone); |
1167 TInt err(KErrNone); |
1292 TComponentId componentId( 0 ); |
1168 TComponentId componentId( 0 ); |
1293 TRAP(err, componentId = |
1169 TRAP(err, componentId = |
1294 iSoftwareRegistry.GetComponentIdForAppL( |
1170 iSoftwareRegistry.GetComponentIdForAppL( |
1295 uid.Uid( aEntry.GetUid() ) ) ) |
1171 uid.Uid( aEntry.GetUid() ) ) ) |
1296 |
1172 |
1297 if ( componentId > 0 && err == KErrNone ) |
1173 if ( componentId > 0 && err == KErrNone ) |
1298 { |
1174 { |
1299 RBuf newComponentId; |
1175 RBuf newComponentId; |
1300 newComponentId.CleanupClosePushL(); |
1176 newComponentId.CleanupClosePushL(); |
1301 newComponentId.CreateL( sizeof(TComponentId) + 1 ); |
1177 newComponentId.CreateL( sizeof(TComponentId) + 1 ); |
1302 newComponentId.AppendNum( componentId ); |
1178 newComponentId.AppendNum( componentId ); |
1303 |
1179 |
1304 RBuf oldComponentId; |
1180 RBuf oldComponentId; |
1305 oldComponentId.CleanupClosePushL(); |
1181 oldComponentId.CleanupClosePushL(); |
1306 oldComponentId.CreateL( KCaMaxAttrValueLen ); |
1182 oldComponentId.CreateL( KCaMaxAttrValueLen ); |
1307 |
1183 |
1308 const TBool componentIdAttributeFound = |
1184 const TBool componentIdAttributeFound = |
1309 aEntry.FindAttribute( KCaComponentId, oldComponentId ); |
1185 aEntry.FindAttribute( KCaComponentId, oldComponentId ); |
1310 |
1186 |
1311 if ( !componentIdAttributeFound |
1187 if ( !componentIdAttributeFound |
1312 || oldComponentId.Compare( newComponentId ) != 0 ) |
1188 || oldComponentId.Compare( newComponentId ) != 0 ) |
1313 { |
1189 { |
1314 // 'add' or 'update' the component id attribute value |
1190 // 'add' or 'update' the component id attribute value |
1315 aEntry.AddAttributeL( KCaComponentId, |
1191 aEntry.AddAttributeL( KCaComponentId, |
1316 newComponentId ); |
1192 newComponentId ); |
1317 |
1193 |
1318 updated = ETrue; |
1194 updated = ETrue; |
1319 } |
1195 } |
1320 |
1196 |
1321 CleanupStack::PopAndDestroy( &oldComponentId ); |
1197 CleanupStack::PopAndDestroy( &oldComponentId ); |
1322 CleanupStack::PopAndDestroy( &newComponentId ); |
1198 CleanupStack::PopAndDestroy( &newComponentId ); |
1323 } |
1199 } |
1324 return updated; |
1200 return updated; |
1325 } |
1201 } |