menucontentsrv/srvsrc/menusrveng.cpp
branchRCL_3
changeset 31 8baec10861af
parent 30 a5a39a295112
equal deleted inserted replaced
30:a5a39a295112 31:8baec10861af
   345 
   345 
   346 // ---------------------------------------------------------
   346 // ---------------------------------------------------------
   347 // CMenuSrvEng::GetRunningAppsL()
   347 // CMenuSrvEng::GetRunningAppsL()
   348 // ---------------------------------------------------------
   348 // ---------------------------------------------------------
   349 //
   349 //
   350 void CMenuSrvEng::GetExtendedAttributesL(TInt aId,
   350 void CMenuSrvEng::GetExtendedAttributesL(TInt aId, const TDesC& aAttrName,
   351     const TDesC& aAttrName, TBool& aAttrExists,
   351         TBool& aAttrExists, TDes& aAttrVal )
   352     TDes& aAttrVal )
       
   353     {
   352     {
   354     TBool captionInfo(aAttrName.Compare( KMenuAttrShortName ) == KErrNone ||
   353     TBool captionInfo(aAttrName.Compare( KMenuAttrShortName ) == KErrNone ||
   355     aAttrName.Compare( KMenuAttrLongName ) == KErrNone ||
   354     aAttrName.Compare( KMenuAttrLongName ) == KErrNone ||
   356     aAttrName.Compare( KMenuAttrTitleName ) == KErrNone );
   355     aAttrName.Compare( KMenuAttrTitleName ) == KErrNone );
   357 
   356 
   374         FolderChildrenCountL( aId, aAttrExists, aAttrVal );
   373         FolderChildrenCountL( aId, aAttrExists, aAttrVal );
   375         }
   374         }
   376     else if( KErrNone == aAttrName.Compare( KMenuAttrNative ) )
   375     else if( KErrNone == aAttrName.Compare( KMenuAttrNative ) )
   377         {
   376         {
   378         ApplicationNativeAttributeL( aId, aAttrExists, aAttrVal );
   377         ApplicationNativeAttributeL( aId, aAttrExists, aAttrVal );
       
   378         addToCache = EFalse;
   379         }
   379         }
   380     else // The attribute doesn't present for the item
   380     else // The attribute doesn't present for the item
   381         {
   381         {
   382         aAttrExists = EFalse;
   382         aAttrExists = EFalse;
   383         aAttrVal = KNullDesC();
   383         aAttrVal = KNullDesC();
   384         }
   384         }
   385     if( aAttrExists && addToCache )
   385     if( aAttrExists && addToCache )
   386         {
   386         {
   387         AddToCacheL(aId, aAttrName, aAttrVal );
   387         AddToCacheL( aId, aAttrName, aAttrVal );
   388         }
   388         }
   389     }
   389     }
   390 
   390 
   391 // ---------------------------------------------------------
   391 // ---------------------------------------------------------
   392 // CMenuSrvEng::ApplicationNativeAttributeL
   392 // CMenuSrvEng::ApplicationNativeAttributeL
   393 // ---------------------------------------------------------
   393 // ---------------------------------------------------------
   394 //
   394 //
   395 void CMenuSrvEng::ApplicationNativeAttributeL(
   395 void CMenuSrvEng::ApplicationNativeAttributeL( TInt aId,
   396 		TInt aId, TBool & aAttrExists, TDes & aAttrVal )
   396         TBool & aAttrExists, TDes & aAttrVal )
   397 	{
   397 	{
   398 	const CMenuEngObject & aEngObj = iEng->ObjectL(aId);
   398 	const CMenuEngObject & aEngObj = iEng->ObjectL(aId);
   399 
   399 
   400     aAttrExists = EFalse;
   400     aAttrExists = EFalse;
   401     if( aEngObj.Type().CompareF( KMenuTypeApp ) == KErrNone )
   401     if( aEngObj.Type().CompareF( KMenuTypeApp ) == KErrNone )
   447 // ---------------------------------------------------------
   447 // ---------------------------------------------------------
   448 //
   448 //
   449 void CMenuSrvEng::CaptionInfoL( TInt aId, const TDesC& aAttrName,
   449 void CMenuSrvEng::CaptionInfoL( TInt aId, const TDesC& aAttrName,
   450     TBool& aExists, TDes& aAttrVal )
   450     TBool& aExists, TDes& aAttrVal )
   451     {
   451     {
   452     const CMenuEngObject& obj = iEng->ObjectL(aId);
   452     const CMenuEngObject& obj = iEng->ObjectL( aId );
   453     if ( obj.Type().Compare( KMenuTypeFolder ) == KErrNone )
   453     if ( obj.Type().Compare( KMenuTypeFolder ) == KErrNone )
   454         {
   454         {
   455         TBool localized;
   455         TBool localized;
   456         TPtrC attrvalue;
   456         TPtrC attrvalue;
   457         TBool attrExists = obj.FindAttribute( KMenuAttrAppGroupName, attrvalue, localized );
   457         TBool attrExists = obj.FindAttribute( KMenuAttrAppGroupName, attrvalue, localized );
   458         if ( attrExists )
   458         if ( attrExists )
   459             {
   459             {
   460             aExists = ETrue;
   460             aExists = ETrue;
   461             aAttrVal = attrvalue;
   461             aAttrVal = attrvalue;
   462             AddToCacheL(aId, KMenuAttrLongName, aAttrVal );
   462             AddToCacheL( aId, KMenuAttrLongName, aAttrVal );
   463             AddToCacheL(aId, KMenuAttrShortName, aAttrVal );
   463             AddToCacheL( aId, KMenuAttrShortName, aAttrVal );
   464             AddToCacheL(aId, KMenuAttrTitleName, aAttrVal );
   464             AddToCacheL( aId, KMenuAttrTitleName, aAttrVal );
   465             }
   465             }
   466         }
   466         }
   467     else if ( obj.Type().Compare( KMenuTypeApp ) == KErrNone )
   467     else if ( obj.Type().Compare( KMenuTypeApp ) == KErrNone )
   468         {
   468         {
   469         aAttrVal = AppCaptionInfoL( obj, aAttrName, aExists );
   469         aAttrVal = AppCaptionInfoL( obj, aAttrName, aExists );
   470         AddToCacheL(aId, aAttrName, aAttrVal );
       
   471         }
   470         }
   472     else
   471     else
   473         {
   472         {
   474         aExists = EFalse;
   473         aExists = EFalse;
   475         aAttrVal = KNullDesC();
   474         aAttrVal = KNullDesC();
   560 
   559 
   561  // ---------------------------------------------------------
   560  // ---------------------------------------------------------
   562  // CMenuSrvEng::FolderChildrenCountL
   561  // CMenuSrvEng::FolderChildrenCountL
   563  // ---------------------------------------------------------
   562  // ---------------------------------------------------------
   564  //
   563  //
   565  void CMenuSrvEng::FolderChildrenCountL( TInt aId, TBool& aExists, TDes& aAttrVal )
   564  void CMenuSrvEng::FolderChildrenCountL(
       
   565          TInt aId, TBool& aExists, TDes& aAttrVal )
   566 	 {
   566 	 {
   567 	 const CMenuEngObject& obj = iEng->ObjectL(aId);
   567 	 const CMenuEngObject& obj = iEng->ObjectL(aId);
   568 
   568 
   569 	 if( obj.Type().CompareF( KMenuTypeFolder ) == KErrNone )
   569 	 if( obj.Type().CompareF( KMenuTypeFolder ) == KErrNone )
   570 	     {
   570 	     {
   678  // ---------------------------------------------------------
   678  // ---------------------------------------------------------
   679  //
   679  //
   680  void CMenuSrvEng::AppendExtendedAttrributesL(
   680  void CMenuSrvEng::AppendExtendedAttrributesL(
   681  		const TDesC& aType,
   681  		const TDesC& aType,
   682  		RArray<TPtrC>& aList )
   682  		RArray<TPtrC>& aList )
   683 	 {
   683 {
   684 
       
   685     if ( KErrNone == aType.Compare( KMenuTypeApp ) )
   684     if ( KErrNone == aType.Compare( KMenuTypeApp ) )
   686         {
   685         {
   687         if( KErrNotFound == aList.Find( KMenuAttrTitleName(), TIdentityRelation<TPtrC>( CmpAttrName )) )
   686         if( KErrNotFound == aList.Find( KMenuAttrTitleName(),
   688         	{
   687                 TIdentityRelation<TPtrC>( CmpAttrName )) )
   689         	aList.AppendL( TPtrC( KMenuAttrTitleName ) );
   688             {
   690         	}
   689             aList.AppendL( TPtrC( KMenuAttrTitleName ) );
   691         if( KErrNotFound == aList.Find( KMenuAttrShortName(), TIdentityRelation<TPtrC>( CmpAttrName )) )
   690             }
   692         	{
   691         if( KErrNotFound == aList.Find( KMenuAttrShortName(),
   693         	aList.AppendL( TPtrC( KMenuAttrShortName ) );
   692                 TIdentityRelation<TPtrC>( CmpAttrName )) )
   694         	}
   693             {
   695         if( KErrNotFound == aList.Find( KMenuAttrLongName(), TIdentityRelation<TPtrC>( CmpAttrName )) )
   694             aList.AppendL( TPtrC( KMenuAttrShortName ) );
   696         	{
   695             }
   697         	aList.AppendL( TPtrC( KMenuAttrLongName ) );
   696         if( KErrNotFound == aList.Find( KMenuAttrLongName(),
   698         	}
   697                 TIdentityRelation<TPtrC>( CmpAttrName )) )
   699         if( KErrNotFound == aList.Find( KMenuAttrDrmProtection(), TIdentityRelation<TPtrC>( CmpAttrName )) )
   698             {
   700         	{
   699             aList.AppendL( TPtrC( KMenuAttrLongName ) );
   701         	aList.AppendL( TPtrC( KMenuAttrDrmProtection ) );
   700             }
   702         	}
   701         if( KErrNotFound == aList.Find( KMenuAttrDrmProtection(),
       
   702                 TIdentityRelation<TPtrC>( CmpAttrName )) )
       
   703             {
       
   704             aList.AppendL( TPtrC( KMenuAttrDrmProtection ) );
       
   705             }
   703         }
   706         }
   704     else if ( KErrNone == aType.Compare( KMenuTypeFolder ) )
   707     else if ( KErrNone == aType.Compare( KMenuTypeFolder ) )
   705         {
   708         {
   706         if( KErrNotFound == aList.Find( KMenuAttrTitleName(), TIdentityRelation<TPtrC>( CmpAttrName )) )
   709         if( KErrNotFound == aList.Find( KMenuAttrTitleName(),
   707         	{
   710                 TIdentityRelation<TPtrC>( CmpAttrName )) )
   708         	aList.AppendL( TPtrC( KMenuAttrTitleName ) );
   711             {
   709         	}
   712             aList.AppendL( TPtrC( KMenuAttrTitleName ) );
   710         if( KErrNotFound == aList.Find( KMenuAttrShortName(), TIdentityRelation<TPtrC>( CmpAttrName )) )
   713             }
   711         	{
   714         if( KErrNotFound == aList.Find( KMenuAttrShortName(),
   712         	aList.AppendL( TPtrC( KMenuAttrShortName ) );
   715                 TIdentityRelation<TPtrC>( CmpAttrName )) )
   713         	}
   716             {
   714         if( KErrNotFound == aList.Find( KMenuAttrLongName(), TIdentityRelation<TPtrC>( CmpAttrName )) )
   717             aList.AppendL( TPtrC( KMenuAttrShortName ) );
   715         	{
   718             }
   716         	aList.AppendL( TPtrC( KMenuAttrLongName ) );
   719         if( KErrNotFound == aList.Find( KMenuAttrLongName(),
   717         	}
   720                 TIdentityRelation<TPtrC>( CmpAttrName )) )
   718         if( KErrNotFound == aList.Find( KChildrenCount(), TIdentityRelation<TPtrC>( CmpAttrName )) )
   721             {
   719         	{
   722             aList.AppendL( TPtrC( KMenuAttrLongName ) );
   720         	aList.AppendL( TPtrC( KChildrenCount ) );
   723             }
   721         	}
   724         if( KErrNotFound == aList.Find( KChildrenCount(),
   722         }
   725                 TIdentityRelation<TPtrC>( CmpAttrName )) )
   723 	 }
   726             {
       
   727             aList.AppendL( TPtrC( KChildrenCount ) );
       
   728             }
       
   729         }
       
   730     }
   724 
   731 
   725 
   732 
   726 //  End of File
   733 //  End of File