menucontentsrv/srvsrc/menusrvappscanner.cpp
branchRCL_3
changeset 31 8baec10861af
parent 30 a5a39a295112
equal deleted inserted replaced
30:a5a39a295112 31:8baec10861af
    71 //
    71 //
    72 CMenuSrvAppScanner::~CMenuSrvAppScanner()
    72 CMenuSrvAppScanner::~CMenuSrvAppScanner()
    73     {
    73     {
    74     Cancel();
    74     Cancel();
    75     delete iMcsSatNotifier;
    75     delete iMcsSatNotifier;
       
    76     delete iSisInstallNotifier;
       
    77     delete iJavaInstallNotifier;
    76     delete iNotifier;
    78     delete iNotifier;
    77     iEng.DequeueOperation( *this );
    79     iEng.DequeueOperation( *this );
    78     delete iMmcHistory;
    80     delete iMmcHistory;
    79     iFs.Close();
    81     iFs.Close();
    80 
    82 
    95         iCenRepNotifyHandlerCPHiddenFolders->StopListening();
    97         iCenRepNotifyHandlerCPHiddenFolders->StopListening();
    96         }
    98         }
    97     delete iCenRepNotifyHandlerCPHiddenFolders;
    99     delete iCenRepNotifyHandlerCPHiddenFolders;
    98   	delete iCenRepSession;
   100   	delete iCenRepSession;
    99   	delete iFreeSpaceObserver;
   101   	delete iFreeSpaceObserver;
   100 
   102     iInstalledPackages.Close();
   101     }
   103     }
   102 
   104 
   103 // ---------------------------------------------------------
   105 // ---------------------------------------------------------
   104 // CMenuSrvAppScanner::CMenuSrvAppScanner
   106 // CMenuSrvAppScanner::CMenuSrvAppScanner
   105 // ---------------------------------------------------------
   107 // ---------------------------------------------------------
   158 	iMcsSatNotifier = CMcsSatNotifier::NewL(
   160 	iMcsSatNotifier = CMcsSatNotifier::NewL(
   159 	                this, KCRUidMenu, KMenuShowSatUI );
   161 	                this, KCRUidMenu, KMenuShowSatUI );
   160 
   162 
   161 	iFreeSpaceObserver = CMcsFreeSpaceObserver::NewL( *this );
   163 	iFreeSpaceObserver = CMcsFreeSpaceObserver::NewL( *this );
   162 
   164 
   163     //SetActive();
   165 	iSisInstallNotifier = CMcsInstallNotifier::NewL(
       
   166             *this, CMcsInstallNotifier::ESisInstallNotification );
       
   167 	iJavaInstallNotifier = CMcsInstallNotifier::NewL(
       
   168             *this, CMcsInstallNotifier::EJavaInstallNotification );
       
   169 
   164 	ScheduleScan();
   170 	ScheduleScan();
   165     //iOpStatus = ETrue;
   171     //iOpStatus = ETrue;
   166     }
   172     }
   167 
   173 
   168 // ---------------------------------------------------------
   174 // ---------------------------------------------------------
   246 
   252 
   247 // ---------------------------------------------------------
   253 // ---------------------------------------------------------
   248 // CMenuSrvAppScanner::HideAppIfExists
   254 // CMenuSrvAppScanner::HideAppIfExists
   249 // ---------------------------------------------------------
   255 // ---------------------------------------------------------
   250 //
   256 //
   251 void CMenuSrvAppScanner::HideItemIfPresentL( TInt aFolder, TInt aId, const TDesC& aUid, TBool aWasHidden )
   257 void CMenuSrvAppScanner::HideItemIfPresentL(
       
   258         TInt aFolder, TInt aId, const TDesC& aUid, TBool aWasHidden )
   252     {
   259     {
   253     TBool hideItem = EFalse;
   260     TBool hideItem = EFalse;
   254     TMenuSrvAttrFilter uidAppFilter;
   261     TMenuSrvAttrFilter uidAppFilter;
   255     uidAppFilter.SetAttr( KMenuAttrUid(), aUid );
   262     uidAppFilter.SetAttr( KMenuAttrUid(), aUid );
   256 
   263 
   257     RArray<TMenuItem> appItems;
   264     RArray<TMenuItem> appItems;
   258     CleanupClosePushL( appItems );
   265     CleanupClosePushL( appItems );
   259     iEng.GetItemsL( appItems, aFolder, &uidAppFilter, ETrue );
   266     iEng.GetItemsL( appItems, aFolder, &uidAppFilter, ETrue );
   260 
   267 
   261     for (TInt i=0; i < appItems.Count(); i++)
   268     for( TInt i=0; i < appItems.Count(); i++ )
   262         {
   269         {
   263         if(appItems[i].Type() != KMenuTypeLink())
   270         if( appItems[i].Type() != KMenuTypeLink() )
   264         	{
   271         	{
   265             const TMenuItem& item = appItems[i];
   272             const TMenuItem& item = appItems[i];
   266 
   273 
   267             TBool itemHidden = (0 != (item.Flags() & TMenuItem::EHidden));
   274             TBool itemHidden = (0 != ( item.Flags() & TMenuItem::EHidden ) );
   268             TBool itemMissing = (0 != (item.Flags() & TMenuItem::EMissing));
   275             TBool itemMissing = ( 0 != ( item.Flags() & TMenuItem::EMissing ) );
   269             if ( !itemHidden && !itemMissing )
   276             if ( !itemHidden && !itemMissing )
   270                 {
   277                 {
   271                 hideItem = ETrue;
   278                 hideItem = ETrue;
   272                 }
   279                 }
   273         	}
   280         	}
   274         }
   281         }
   275 
       
   276     SetHiddenFlagL( aId, aWasHidden, hideItem );
   282     SetHiddenFlagL( aId, aWasHidden, hideItem );
   277 
   283 
   278     CleanupStack::PopAndDestroy( &appItems );
   284     CleanupStack::PopAndDestroy( &appItems );
   279     }
   285     }
   280 
   286 
   282 // CMenuSrvAppScanner::SetHiddenFlagL
   288 // CMenuSrvAppScanner::SetHiddenFlagL
   283 // ---------------------------------------------------------
   289 // ---------------------------------------------------------
   284 //
   290 //
   285 void CMenuSrvAppScanner::SetHiddenFlagL( TInt aId, TBool aWasHidden, TBool aHide )
   291 void CMenuSrvAppScanner::SetHiddenFlagL( TInt aId, TBool aWasHidden, TBool aHide )
   286     {
   292     {
   287     if ( aWasHidden ^ aHide )
   293     if ( aWasHidden != aHide )
   288         {
   294         {
   289         iEng.ModifiableObjectL( aId, RMenuNotifier::EItemsAddedRemoved ).
   295         iEng.ModifiableObjectL( aId, RMenuNotifier::EItemsAddedRemoved ).
   290             SetFlags( TMenuItem::EHidden, aHide );
   296             SetFlags( TMenuItem::EHidden, aHide );
   291         }
   297         }
   292     }
   298     }
   463         *ownStatus = KRequestPending;
   469         *ownStatus = KRequestPending;
   464         SetActive();
   470         SetActive();
   465         User::RequestComplete( ownStatus, KErrNone );
   471         User::RequestComplete( ownStatus, KErrNone );
   466         }
   472         }
   467     }
   473     }
       
   474 
       
   475 // ---------------------------------------------------------
       
   476 //
       
   477 // ---------------------------------------------------------
       
   478 //
       
   479 void CMenuSrvAppScanner::InstallationNotifyL()
       
   480     {
       
   481     TBool isLegacy = iEng.GetOnceLegacyFormat();
       
   482     for( TInt i = iInstalledPackages.Count() - 1; i >= 0; i-- )
       
   483         {
       
   484         RArray<TMenuItem> mcsUidItems;
       
   485         CleanupClosePushL( mcsUidItems );
       
   486         GetMcsAppItemsL( isLegacy, iInstalledPackages[i].iUid, mcsUidItems );
       
   487         if( mcsUidItems.Count() )
       
   488             {
       
   489             iEng.ModifiableObjectL( mcsUidItems[0].Id() );
       
   490             iInstalledPackages.Remove( i );
       
   491             }
       
   492         CleanupStack::PopAndDestroy( &mcsUidItems );
       
   493         }
       
   494     }
       
   495 
       
   496 // ---------------------------------------------------------
       
   497 //
       
   498 // ---------------------------------------------------------
       
   499 //
       
   500 void CMenuSrvAppScanner::RemoveFromInstalledPackages( TUid aUid )
       
   501     {
       
   502     TInt appIndex = iInstalledPackages.Find( aUid );
       
   503     if( appIndex != KErrNotFound )
       
   504         {
       
   505         iInstalledPackages.Remove( appIndex );
       
   506         }
       
   507     }
       
   508 
       
   509 // ---------------------------------------------------------
       
   510 //
       
   511 // ---------------------------------------------------------
       
   512 //
       
   513 CMenuEngObject& CMenuSrvAppScanner::ModifiableObjectL( TUid aUid, TInt aId,
       
   514             TInt aEvent )
       
   515     {
       
   516     if( aEvent != RMenuNotifier::EItemsNone )
       
   517         {
       
   518         RemoveFromInstalledPackages( aUid );
       
   519         }
       
   520     return iEng.ModifiableObjectL( aId, aEvent );
       
   521     }
       
   522 
       
   523 // ---------------------------------------------------------
       
   524 //
       
   525 // ---------------------------------------------------------
       
   526 //
       
   527 void CMenuSrvAppScanner::HandleInstallNotifyL( TUid aUid,
       
   528 		CMcsInstallNotifier::TNotificationType aNotificationType )
       
   529     {
       
   530     iInstalledPackages.AppendL( aUid );
       
   531     // when installing java, appscanner first gets notification from appArc,
       
   532     // and then it is notified with instal notifier(RProperty)
       
   533     // so we need another scan for java apps
       
   534     if( aNotificationType == CMcsInstallNotifier::EJavaInstallNotification )
       
   535     	{
       
   536 		ScheduleScan();
       
   537     	}
       
   538     }
       
   539 
   468 // ---------------------------------------------------------
   540 // ---------------------------------------------------------
   469 // CMenuSrvAppScanner::RunMenuEngOperationL
   541 // CMenuSrvAppScanner::RunMenuEngOperationL
   470 // ---------------------------------------------------------
   542 // ---------------------------------------------------------
   471 //
   543 //
   472 void CMenuSrvAppScanner::RunMenuEngOperationL()
   544 void CMenuSrvAppScanner::RunMenuEngOperationL()
   473     {
   545     {
   474     UpdateApplicationItemsL();
   546     UpdateApplicationItemsL();
   475     UpdateApplicationWithHideIfInstalledItemsL();
   547     UpdateApplicationWithHideIfInstalledItemsL();
   476     UpdateLinkItemsL();
   548     UpdateLinkItemsL();
       
   549     InstallationNotifyL();
   477     iOpStatus = EFalse;
   550     iOpStatus = EFalse;
   478     }
   551     }
   479 
       
   480 
   552 
   481 // ---------------------------------------------------------
   553 // ---------------------------------------------------------
   482 // CMenuSrvAppScanner::UpdateApplicationItemL
   554 // CMenuSrvAppScanner::UpdateApplicationItemL
   483 // ---------------------------------------------------------
   555 // ---------------------------------------------------------
   484 //
   556 //
   486 		RArray<TMenuItem>& aMcsItems, const CMenuSrvAppAttributes& aApaItem,
   558 		RArray<TMenuItem>& aMcsItems, const CMenuSrvAppAttributes& aApaItem,
   487 		TUint aMmcId, TBool isLegacy)
   559 		TUint aMmcId, TBool isLegacy)
   488     {
   560     {
   489     RArray<TMenuItem> mcsUidItems;
   561     RArray<TMenuItem> mcsUidItems;
   490     CleanupClosePushL( mcsUidItems );
   562     CleanupClosePushL( mcsUidItems );
   491     TUid appuid = aApaItem.GetUid();
   563     TUid appUid = aApaItem.GetUid();
   492     GetMcsAppItemsL( isLegacy, appuid.iUid, mcsUidItems );
   564     GetMcsAppItemsL( isLegacy, appUid.iUid, mcsUidItems );
   493     TBool isApaItemHidden( aApaItem.IsHidden() );
   565     TBool isApaItemHidden( aApaItem.IsHidden() );
   494 
   566 
   495     // This app is not in the menu, add it now.
   567     // This app is not in the menu, add it now.
   496     // We don't add hidden items, there are too many of them!
   568     // We don't add hidden items, there are too many of them!
   497     // do not display Menu app
   569     // do not display Menu app
   498     if ( !mcsUidItems.Count()
   570     if ( !mcsUidItems.Count()
   499     		&& !isApaItemHidden
   571     		&& !isApaItemHidden
   500     		&& appuid !=  KMmUid3  )
   572     		&& appUid !=  KMmUid3  )
   501         {
   573         {
   502         if( appuid == KSatUid )
   574         if( appUid == KSatUid )
   503             {
   575             {
   504             if( CMcsSatHandler::CheckVisibility() )
   576             if( CMcsSatHandler::CheckVisibility() )
   505              	{
   577              	{
   506               	AddAppItemL( aApaItem, aMmcId );
   578               	AddAppItemL( aApaItem, aMmcId );
   507                	}
   579                	}
   508             }
   580             }
   509         else
   581         else
   510           	{
   582           	{
   511           	AddAppItemL( aApaItem, aMmcId );
   583           	AddAppItemL( aApaItem, aMmcId );
   512             GetMcsAppItemsL( isLegacy, appuid.iUid, mcsUidItems );
   584             GetMcsAppItemsL( isLegacy, appUid.iUid, mcsUidItems );
       
   585             RemoveFromInstalledPackages( appUid );
   513            	}
   586            	}
   514         }//if
   587         }//if
   515 
   588 
   516     // if there are any items with legacy UID format
   589     // if there are any items with legacy UID format
   517     // update them to new uid format
   590     // update them to new uid format
   518     else if ( mcsUidItems.Count() && isLegacy )
   591     else if ( mcsUidItems.Count() && isLegacy )
   519         {
   592         {
   520         //for every item with matching UID
   593         //for every item with matching UID
   521         for (TInt j=0; j < mcsUidItems.Count(); j++)
   594         for (TInt j=0; j < mcsUidItems.Count(); j++)
   522      		{
   595      		{
   523        		CMenuEngObject& object =
       
   524       		                iEng.ModifiableObjectL( mcsUidItems[j].Id() );
       
   525             TBuf<KUidChars> uidString;
   596             TBuf<KUidChars> uidString;
   526             MenuSrvUtil::UidToStringL( appuid.iUid, uidString, EFalse, EHex );
   597             MenuSrvUtil::UidToStringL( appUid.iUid, uidString, EFalse, EHex );
   527        	    object.SetAttributeL( KMenuAttrUid(), uidString, EFalse );
   598             ModifiableObjectL( appUid, mcsUidItems[j].Id() ).SetAttributeL(
       
   599                     KMenuAttrUid(), uidString, EFalse );
   528        		}//for
   600        		}//for
   529         }//else if
   601         }//else if
   530     // "hidden", "missing" and "lock_delete"  flags update
   602     // "hidden", "missing" and "lock_delete"  flags update
   531     for ( TInt j = 0; j < mcsUidItems.Count(); j++ )
   603     for ( TInt j = 0; j < mcsUidItems.Count(); j++ )
   532         {
   604         {
   540 
   612 
   541         // "hidden" flag handling.
   613         // "hidden" flag handling.
   542         HandleHiddenFlagUpdateL( item, aApaItem );
   614         HandleHiddenFlagUpdateL( item, aApaItem );
   543 
   615 
   544         // "missing" flag handling
   616         // "missing" flag handling
   545         HandleMissingFlagUpdateL( item );
   617         HandleMissingFlagUpdateL( item, aApaItem );
   546 
   618 
   547         //"lock_delete" flag handling
   619         //"lock_delete" flag handling
   548         HandleLockDeleteFlagUpdateL(item, aApaItem );
   620         HandleLockDeleteFlagUpdateL( item, aApaItem );
   549         // if item was just added to MCS  it is not present in aMcsItems
   621         // if item was just added to MCS  it is not present in aMcsItems
   550         // so we cannot remove it
   622         // so we cannot remove it
   551         TInt index = aMcsItems.Find( item, TIdentityRelation<TMenuItem>( IdMatch ) );
   623         TInt index = aMcsItems.Find( item, TIdentityRelation<TMenuItem>( IdMatch ) );
   552         if ( index != KErrNotFound )
   624         if ( index != KErrNotFound )
   553         	{
   625         	{
   562 // ---------------------------------------------------------
   634 // ---------------------------------------------------------
   563 //
   635 //
   564 void CMenuSrvAppScanner::HandleHiddenFlagUpdateL( const TMenuItem & aItem,
   636 void CMenuSrvAppScanner::HandleHiddenFlagUpdateL( const TMenuItem & aItem,
   565         const CMenuSrvAppAttributes& aApaItem )
   637         const CMenuSrvAppAttributes& aApaItem )
   566 	{
   638 	{
   567 	TBool itemHidden = (0 != (aItem.Flags() & TMenuItem::EHidden));
   639 	TBool itemHidden = ( 0 != ( aItem.Flags() & TMenuItem::EHidden ) );
   568 	if ( aApaItem.GetUid() == KSatUid )
   640 	if( aApaItem.GetUid() == KSatUid )
   569 		{
   641 		{
   570 		if (itemHidden == CMcsSatHandler::CheckVisibility())
   642 		if( itemHidden == CMcsSatHandler::CheckVisibility() )
   571 			{
   643 			{
   572 			iEng.ModifiableObjectL(aItem.Id(), RMenuNotifier::EItemsAddedRemoved).
   644 			ModifiableObjectL( aApaItem.GetUid(), aItem.Id(),
   573 				SetFlags( TMenuItem::EHidden, !CMcsSatHandler::CheckVisibility());
   645 			        RMenuNotifier::EItemsAddedRemoved ).SetFlags(
       
   646 			                TMenuItem::EHidden,
       
   647 			                !CMcsSatHandler::CheckVisibility() );
   574 			}
   648 			}
   575 		}
   649 		}
   576 	else if ( itemHidden != aApaItem.IsHidden() )
   650 	else if( itemHidden != aApaItem.IsHidden() )
   577 		{
   651 		{
   578 		iEng.ModifiableObjectL(aItem.Id(), RMenuNotifier::EItemsAddedRemoved).
   652 		ModifiableObjectL( aApaItem.GetUid(), aItem.Id(),
   579 			SetFlags( TMenuItem::EHidden, aApaItem.IsHidden() );
   653 		        RMenuNotifier::EItemsAddedRemoved ).SetFlags(
       
   654 		                TMenuItem::EHidden, aApaItem.IsHidden() );
   580 		}
   655 		}
   581 	}
   656 	}
   582 
   657 
   583 // ---------------------------------------------------------
   658 // ---------------------------------------------------------
   584 // CMenuSrvAppScanner::HandleNativeAttrUpdateL
   659 // CMenuSrvAppScanner::HandleNativeAttrUpdateL
   588 		const TMenuItem& aItem, const CMenuSrvAppAttributes& aApaItem )
   663 		const TMenuItem& aItem, const CMenuSrvAppAttributes& aApaItem )
   589 	{
   664 	{
   590     //we need this to delete uninstalled java app item
   665     //we need this to delete uninstalled java app item
   591     if( aApaItem.GetAppType() != iEng.ObjectL( aItem.Id() ).GetAppType() )
   666     if( aApaItem.GetAppType() != iEng.ObjectL( aItem.Id() ).GetAppType() )
   592     	{
   667     	{
   593     	iEng.ModifiableObjectL( aItem.Id(),
   668     	ModifiableObjectL( aApaItem.GetUid(), aItem.Id(),
   594     			RMenuNotifier::EItemsNone ).SetAppType( aApaItem.GetAppType() );
   669     			RMenuNotifier::EItemsNone ).SetAppType( aApaItem.GetAppType() );
   595     	}
   670     	}
   596 	}
   671 	}
   597 
   672 
   598 
   673 
   601 // ---------------------------------------------------------
   676 // ---------------------------------------------------------
   602 //
   677 //
   603 void CMenuSrvAppScanner::HandleMmcAttrUpdateL(
   678 void CMenuSrvAppScanner::HandleMmcAttrUpdateL(
   604 		const TMenuItem& aItem, const CMenuSrvAppAttributes& aApaItem, TUint aMmcId )
   679 		const TMenuItem& aItem, const CMenuSrvAppAttributes& aApaItem, TUint aMmcId )
   605 	{
   680 	{
   606     if ( IsInMmc( aApaItem ) )
   681     TPtrC val;
       
   682     TBool dummy;
       
   683     TBool attributeExists = iEng.ObjectL( aItem.Id() ).FindAttribute(
       
   684             KMenuAttrMmcId(), val, dummy );
       
   685     if( IsInMmc( aApaItem ) )
   607     	{
   686     	{
   608     	//app is instaled on mmc - KMenuAttrMmcId attribute update
   687     	//app is instaled on mmc - KMenuAttrMmcId attribute update
   609     	TBuf<KUidChars> uidString;
   688     	TBuf<KUidChars> uidString;
   610         uidString.Format( KHexFormat, aMmcId );
   689         uidString.Format( KHexFormat, aMmcId );
   611         iEng.ModifiableObjectL( aItem.Id(), RMenuNotifier::EItemsAddedRemoved ).
   690         if( uidString.Compare( val ) )
   612 			SetAttributeL( KMenuAttrMmcId, uidString, EFalse );
   691             {
       
   692             ModifiableObjectL( aApaItem.GetUid(), aItem.Id() ).SetAttributeL(
       
   693                             KMenuAttrMmcId, uidString, EFalse );
       
   694             }
   613     	}
   695     	}
   614     else if ( IsInMassStorage( aApaItem )
   696     else if( IsInMassStorage( aApaItem )
   615     		&& aApaItem.GetAppType() == CMenuEngObject::EWidgetApp )
   697     		&& aApaItem.GetAppType() == CMenuEngObject::EWidgetApp )
   616     	{
   698     	{
   617     	//its java app installed on mass storage, we need to leave it in xml
   699     	//its java app installed on mass storage, we need to leave it in xml
   618     	//in case of connecting usb in mass storage mode
   700     	//in case of connecting usb in mass storage mode
   619         iEng.ModifiableObjectL( aItem.Id(), RMenuNotifier::EItemsAddedRemoved ).
   701         if( KMenuMassStorage().Compare( val ) )
   620 			SetAttributeL( KMenuAttrMmcId, KMenuMassStorage, EFalse );
   702             {
       
   703             ModifiableObjectL( aApaItem.GetUid(), aItem.Id() ).SetAttributeL(
       
   704                     KMenuAttrMmcId, KMenuMassStorage, EFalse );
       
   705             }
   621     	}
   706     	}
   622     else
   707     else if( attributeExists )
   623     	{
   708     	{
   624     	//its installed on c: drive - remove attribute
   709     	//its installed on c: drive - remove attribute
   625 		iEng.ModifiableObjectL( aItem.Id(), RMenuNotifier::EItemsAddedRemoved ).
   710         ModifiableObjectL( aApaItem.GetUid(), aItem.Id() ).RemoveAttribute(
   626 			RemoveAttribute( KMenuAttrMmcId );
   711                 KMenuAttrMmcId );
   627     	}
   712     	}
   628 	}
   713 	}
   629 // ---------------------------------------------------------
   714 // ---------------------------------------------------------
   630 // CMenuSrvAppScanner::UpdateApplicationItemsL
   715 // CMenuSrvAppScanner::UpdateApplicationItemsL
   631 // ---------------------------------------------------------
   716 // ---------------------------------------------------------
   639     GetMcsAppItemsL( mcsItems );
   724     GetMcsAppItemsL( mcsItems );
   640     iSrvEngUtils.ReloadApaItemsL();
   725     iSrvEngUtils.ReloadApaItemsL();
   641     GetCrItemsL( iSrvEngUtils.GetAppItemsL() );
   726     GetCrItemsL( iSrvEngUtils.GetAppItemsL() );
   642     TBool isLegacy = iEng.GetOnceLegacyFormat();
   727     TBool isLegacy = iEng.GetOnceLegacyFormat();
   643 
   728 
   644 
       
   645     //for every item in apaAndCrItems array
   729     //for every item in apaAndCrItems array
   646     for ( TInt i = ( iSrvEngUtils.GetAppItemsL().Count() - 1 ); i >= 0 ; i-- )
   730     for ( TInt i = ( iSrvEngUtils.GetAppItemsL().Count() - 1 ); i >= 0 ; i-- )
   647         {
   731         {
   648         // if there was leave for any item we ignore it
   732         // if there was leave for any item we ignore it
   649         // and proceed to the next one
   733         // and proceed to the next one
   650         TRAP_IGNORE(UpdateApplicationItemL(
   734         TRAP_IGNORE( UpdateApplicationItemL( mcsItems,
   651         		mcsItems, *iSrvEngUtils.GetAppItemsL()[i], currentMmcId, isLegacy));
   735                 *iSrvEngUtils.GetAppItemsL()[i], currentMmcId, isLegacy ) );
   652         }
   736         }
   653     // Here the big list contains menu items that refer to missing apps.
   737     // Here the big list contains menu items that refer to missing apps.
   654     HandleMissingItemsL( mcsItems );
   738     HandleMissingItemsL( mcsItems );
   655     CleanupStack::PopAndDestroy( &mcsItems );
   739     CleanupStack::PopAndDestroy( &mcsItems );
   656     }
   740     }
   666 							.Flags() & TMenuItem::EHidden ) != 0 );
   750 							.Flags() & TMenuItem::EHidden ) != 0 );
   667 	if ( !isHidden && IsInRomL( aApaItem ) )
   751 	if ( !isHidden && IsInRomL( aApaItem ) )
   668 		{
   752 		{
   669 		if ( ( aItem.Flags() & TMenuItem::ELockDelete ) == 0 )
   753 		if ( ( aItem.Flags() & TMenuItem::ELockDelete ) == 0 )
   670 			{
   754 			{
   671 			iEng.ModifiableObjectL(aItem.Id())
   755             ModifiableObjectL( aApaItem.GetUid(), aItem.Id()).SetFlags(
   672 					.SetFlags( TMenuItem::ELockDelete, ETrue );
   756                     TMenuItem::ELockDelete, ETrue );
   673 			}
   757 			}
   674 		}
   758 		}
   675 	else
   759 	else
   676 		{
   760 		{
   677 		if ( ( aItem.Flags() & TMenuItem::ELockDelete ) != 0 )
   761 		if ( ( aItem.Flags() & TMenuItem::ELockDelete ) != 0 )
   678 			{
   762 			{
   679 			iEng.ModifiableObjectL(aItem.Id())
   763             ModifiableObjectL( aApaItem.GetUid(), aItem.Id() ).SetFlags(
   680 					.SetFlags( TMenuItem::ELockDelete, EFalse );
   764                     TMenuItem::ELockDelete, EFalse );
   681 			}
   765 			}
   682 		}
   766 		}
   683 	}
   767 	}
   684 
   768 
   685 // ---------------------------------------------------------
   769 // ---------------------------------------------------------
   686 // CMenuSrvAppScanner::HandleMissingFlagUpdateL
   770 // CMenuSrvAppScanner::HandleMissingFlagUpdateL
   687 // ---------------------------------------------------------
   771 // ---------------------------------------------------------
   688 //
   772 //
   689 void CMenuSrvAppScanner::HandleMissingFlagUpdateL( const TMenuItem& aItem )
   773 void CMenuSrvAppScanner::HandleMissingFlagUpdateL(
       
   774         const TMenuItem& aItem,  const CMenuSrvAppAttributes& aApaItem  )
   690 	{
   775 	{
   691 	if ( aItem.Flags() & TMenuItem::EMissing )
   776 	if ( aItem.Flags() & TMenuItem::EMissing )
   692         {
   777         {
   693         CLOG_WRITE_FORMAT8( "Unsetting flag EMissing on %d", item.Id() );
   778         CLOG_WRITE_FORMAT8( "Unsetting flag EMissing on %d", item.Id() );
   694         //application found so we unset "missing" flag
   779         //application found so we unset "missing" flag
   695         iEng.ModifiableObjectL( aItem.Id(), RMenuNotifier::EItemsAddedRemoved ).
   780         ModifiableObjectL( aApaItem.GetUid(), aItem.Id(),
   696             SetFlags( TMenuItem::EMissing, EFalse );
   781                 RMenuNotifier::EItemsAddedRemoved ).SetFlags(
       
   782                         TMenuItem::EMissing, EFalse );
   697         }
   783         }
   698 	}
   784 	}
   699 
   785 
   700 // ---------------------------------------------------------
   786 // ---------------------------------------------------------
   701 // CMenuSrvAppScanner::GetCrItemsL
   787 // CMenuSrvAppScanner::GetCrItemsL
  1102 		const TMenuItem::TFlags& aFlag, const RMenuNotifier::TEvent& aEvent  )
  1188 		const TMenuItem::TFlags& aFlag, const RMenuNotifier::TEvent& aEvent  )
  1103 	{
  1189 	{
  1104 	TBool itemFlagPresent = (0 != (aItem.Flags() & aFlag));
  1190 	TBool itemFlagPresent = (0 != (aItem.Flags() & aFlag));
  1105 	if( aFlagValue != itemFlagPresent )
  1191 	if( aFlagValue != itemFlagPresent )
  1106 		{
  1192 		{
  1107 		iEng.ModifiableObjectL( aItem.Id(), aEvent ).
  1193         iEng.ModifiableObjectL( aItem.Id(), aEvent ).
  1108 			 SetFlags( aFlag, aFlagValue );
  1194                  SetFlags( aFlag, aFlagValue );
  1109 		}
  1195 		}
  1110 	}
  1196 	}
  1111 
  1197 
  1112 // ---------------------------------------------------------
  1198 // ---------------------------------------------------------
  1113 // CMenuSrvAppScanner::UpdateMmcHistoryL
  1199 // CMenuSrvAppScanner::UpdateMmcHistoryL