menucontentsrv/srvsrc/mcsgetlistcreatorinterface.cpp
changeset 0 79c6a41cd166
child 23 ace62b58f4b2
equal deleted inserted replaced
-1:000000000000 0:79c6a41cd166
       
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *
       
    16 */
       
    17 
       
    18 #include <e32cmn.h>
       
    19 #include <liwcommon.h>
       
    20 #include <liwgenericparam.h>
       
    21 #include "mcsgetlistcreatorinterface.h"
       
    22 #include "menusrveng.h"
       
    23 
       
    24 _LIT( KMenuAttrSuiteName, "suite_name" );
       
    25 
       
    26 /**
       
    27  * Class for getting attributes for installed suite items
       
    28  * @since S60 v5.0
       
    29  */
       
    30 NONSHARABLE_CLASS( CMcsSuiteGetAttrStrategy ) :
       
    31 	public CMcsGetAttrStrategy
       
    32 	{
       
    33 public:
       
    34 
       
    35 	/**
       
    36 	 * Constructor.
       
    37 	 */
       
    38 	CMcsSuiteGetAttrStrategy( CMenuSrvEng& aEng );
       
    39 
       
    40 	/**
       
    41 	 * Destructor.
       
    42 	 */
       
    43 	virtual ~CMcsSuiteGetAttrStrategy();
       
    44 
       
    45 	/**
       
    46 	 * TODO: add comments
       
    47 	 */
       
    48 	void PrepareL(TInt aId);
       
    49 
       
    50 	/**
       
    51 	 * GetAttributeL.
       
    52 	 */
       
    53 	void GetAttributeL(const TDesC& aAttrName,
       
    54 		        TBool& aAttrExists, TDes& aAttrVal );
       
    55 
       
    56 private:
       
    57 	RBuf iSuiteName; ///< Name of a suite for actual strategy. Own.
       
    58 	};
       
    59 
       
    60 /**
       
    61  * Class for getting attributes for non suite items / not installed suite items
       
    62  * @since S60 v5.0
       
    63  */
       
    64 NONSHARABLE_CLASS( CMcsMainGetAttrStrategy ) :
       
    65 	public CMcsGetAttrStrategy
       
    66 	{
       
    67 public:
       
    68 
       
    69 	/**
       
    70 	 * Constructor.
       
    71 	 */
       
    72 	CMcsMainGetAttrStrategy ( CMenuSrvEng& aEng );
       
    73 
       
    74 	/**
       
    75 	 * TODO: add comments
       
    76 	 */
       
    77 	void PrepareL(TInt aId);
       
    78 
       
    79 	/**
       
    80 	 * GetAttributeL.
       
    81 	 */
       
    82 	void GetAttributeL(const TDesC& aAttrName,
       
    83 		        TBool& aAttrExists, TDes& aAttrVal );
       
    84 
       
    85 private:
       
    86 	TInt iId; ///< a id of an item for actual strategy.
       
    87 	};
       
    88 
       
    89 
       
    90 // ---------------------------------------------------------
       
    91 // CMcsGetAttrStrategy::CMcsGetAttrStrategy
       
    92 // ---------------------------------------------------------
       
    93 //
       
    94 CMcsGetAttrStrategy::CMcsGetAttrStrategy( CMenuSrvEng& aEng ) :
       
    95 	iEng(aEng)
       
    96 	{
       
    97 	}
       
    98 
       
    99 
       
   100 // ---------------------------------------------------------
       
   101 // CMcsGetAttrStrategy::~CMcsGetAttrStrategy
       
   102 // ---------------------------------------------------------
       
   103 //
       
   104 CMcsGetAttrStrategy::~CMcsGetAttrStrategy()
       
   105 	{
       
   106 	}
       
   107 
       
   108 // ---------------------------------------------------------
       
   109 // CMcsSuiteGetAttrStrategy::CMcsGetSuiteAttributeStrategy
       
   110 // ---------------------------------------------------------
       
   111 //
       
   112 CMcsSuiteGetAttrStrategy::CMcsSuiteGetAttrStrategy( CMenuSrvEng& aEng ) :
       
   113 	CMcsGetAttrStrategy(aEng)
       
   114 	{
       
   115 	}
       
   116 
       
   117 // ---------------------------------------------------------
       
   118 // CMcsSuiteGetAttrStrategy::~CMcsSuiteGetAttrStrategy
       
   119 // ---------------------------------------------------------
       
   120 //
       
   121 CMcsSuiteGetAttrStrategy::~CMcsSuiteGetAttrStrategy()
       
   122 	{
       
   123 	iSuiteName.Close();
       
   124 	}
       
   125 
       
   126 // ---------------------------------------------------------
       
   127 // CMcsSuiteGetAttrStrategy::Prepare
       
   128 // ---------------------------------------------------------
       
   129 //
       
   130 void CMcsSuiteGetAttrStrategy::PrepareL(TInt aId)
       
   131 	{
       
   132 	TBool suiteNameExists;
       
   133 	iSuiteName.Close();
       
   134 	iSuiteName.CreateL( KMenuMaxAttrValueLen );
       
   135 	iEng.GetAttributeL(aId, KMenuAttrSuiteName, suiteNameExists, iSuiteName);
       
   136 	}
       
   137 
       
   138 // ---------------------------------------------------------
       
   139 // CMcsSuiteGetAttrStrategy::GetAttributeL
       
   140 // ---------------------------------------------------------
       
   141 //
       
   142 void CMcsSuiteGetAttrStrategy::GetAttributeL(const TDesC& aAttrName,
       
   143         TBool& aAttrExists, TDes& aAttrVal )
       
   144 	{
       
   145 	iEng.GetSuiteAttribute(iSuiteName, aAttrName, aAttrExists, aAttrVal);
       
   146 	}
       
   147 
       
   148 // ---------------------------------------------------------
       
   149 // CMcsSuiteGetAttrStrategy::CMcsGetSuiteAttributeStrategy
       
   150 // ---------------------------------------------------------
       
   151 //
       
   152 CMcsMainGetAttrStrategy::CMcsMainGetAttrStrategy( CMenuSrvEng& aEng ) :
       
   153 	CMcsGetAttrStrategy(aEng)
       
   154 	{
       
   155 	}
       
   156 
       
   157 // ---------------------------------------------------------
       
   158 // CMcsMainGetAttrStrategy::Prepare
       
   159 // ---------------------------------------------------------
       
   160 //
       
   161 void CMcsMainGetAttrStrategy::PrepareL(TInt aId)
       
   162 	{
       
   163 	iId = aId;
       
   164 	}
       
   165 
       
   166 // ---------------------------------------------------------
       
   167 // CMcsGetSuiteAttributeStrategy::GetAttributeL
       
   168 // ---------------------------------------------------------
       
   169 //
       
   170 void CMcsMainGetAttrStrategy::GetAttributeL(const TDesC& aAttrName,
       
   171         TBool& aAttrExists, TDes& aAttrVal )
       
   172 	{
       
   173 	iEng.GetAttributeL (iId, aAttrName, aAttrExists, aAttrVal);
       
   174 	}
       
   175 
       
   176 // ---------------------------------------------------------
       
   177 // CMcsGetListCreatorInterface::~CMcsGetListCreatorInterface
       
   178 // ---------------------------------------------------------
       
   179 //
       
   180 CMcsGetListCreatorInterface::~CMcsGetListCreatorInterface()
       
   181     {
       
   182     delete iNormalGetter;
       
   183     delete iSuiteGetter;
       
   184     }
       
   185 
       
   186 // ---------------------------------------------------------
       
   187 // CMcsGetListCreatorInterface::CMcsGetListCreatorInterface
       
   188 // ---------------------------------------------------------
       
   189 //
       
   190 CMcsGetListCreatorInterface::CMcsGetListCreatorInterface( CMenuSrvEng& aEng ):
       
   191 	iEng( aEng )
       
   192     {
       
   193     }
       
   194 
       
   195 // ---------------------------------------------------------
       
   196 // CMcsGetListCreatorInterface::ConstructL
       
   197 // ---------------------------------------------------------
       
   198 //
       
   199 void CMcsGetListCreatorInterface::ConstructL()
       
   200     {
       
   201     iActualGetter = NULL;
       
   202     iSuiteGetter = new(ELeave) CMcsSuiteGetAttrStrategy(iEng);
       
   203     iNormalGetter = new(ELeave) CMcsMainGetAttrStrategy(iEng);
       
   204     }
       
   205 
       
   206 // ---------------------------------------------------------
       
   207 // CMcsGetListCreatorInterface::BuildMapL
       
   208 // ---------------------------------------------------------
       
   209 //
       
   210 void CMcsGetListCreatorInterface::BuildMapL(
       
   211 		const TMenuItem& aMenuItem, CDesC16Array* aRequiredAttributes,
       
   212 		CDesC16Array* aIgnoredAttributes, CLiwDefaultMap* aMap )
       
   213 	{
       
   214 	SetGetterStrategyL( aMenuItem.Id() );
       
   215 	AddFundamentalAttributesL( aMenuItem, aMap );
       
   216 
       
   217 	if( aRequiredAttributes->MdcaCount() &&
       
   218 			aIgnoredAttributes->MdcaCount() == KErrNone )
       
   219 	    {
       
   220 	    AddRequiredAttributesL( aMenuItem, aRequiredAttributes, aMap );
       
   221 	    }
       
   222 	else if( aIgnoredAttributes->MdcaCount() &&
       
   223 			aRequiredAttributes->MdcaCount() == KErrNone )
       
   224 	    {
       
   225 	    AddAttributesWithoutIgnoredL( aMenuItem, aIgnoredAttributes, aMap );
       
   226 	    }
       
   227 	else if( aRequiredAttributes->MdcaCount() )
       
   228 	    {
       
   229 	    AddRequiredAttributesWithoutIgnoredL( aMenuItem, aRequiredAttributes,
       
   230 	    		aIgnoredAttributes, aMap );
       
   231 	    }
       
   232 	else
       
   233 	    {
       
   234 	    AddAllAttributesL( aMenuItem, aMap );
       
   235 	    }
       
   236 	}
       
   237 
       
   238 // ---------------------------------------------------------
       
   239 // CMcsGetListCreatorInterface::AddFundamentalAttributesL
       
   240 // ---------------------------------------------------------
       
   241 //
       
   242 void CMcsGetListCreatorInterface::AddFundamentalAttributesL(
       
   243 		const TMenuItem& aMenuItem, CLiwDefaultMap* aMap )
       
   244 	{
       
   245     aMap->InsertL( KMenuAttrId8, TLiwVariant( (TInt32)aMenuItem.Id() ) );
       
   246 
       
   247     aMap->InsertL( KType, TLiwVariant( aMenuItem.Type() ) );
       
   248     aMap->InsertL( KMenuParentId, TLiwVariant( (TInt32)aMenuItem.Parent() ) );
       
   249 
       
   250     // Flags
       
   251     TInt flag = aMenuItem.Flags();
       
   252     TInt flagvalue = ( flag & TMenuItem::ELockDelete )? 1 : 0;
       
   253 
       
   254     aMap->InsertL( KDeleteLocked, TLiwVariant( (TBool)flagvalue) );
       
   255 
       
   256     flagvalue = ( flag & TMenuItem::ELockName )? 1 : 0;
       
   257     aMap->InsertL( KNameLocked, TLiwVariant( (TBool)flagvalue) );
       
   258 
       
   259     flagvalue = ( flag & TMenuItem::ELockIcon )? 1 : 0;
       
   260     aMap->InsertL( KIconLocked, TLiwVariant( (TBool)flagvalue) );
       
   261 
       
   262     flagvalue = ( flag & TMenuItem::ELockMoveInto )? 1 : 0;
       
   263     aMap->InsertL( KAddingLocked, TLiwVariant( (TBool)flagvalue) );
       
   264 
       
   265     flagvalue = ( flag & TMenuItem::ELockItem )? 1 : 0;
       
   266     aMap->InsertL( KMoveLocked, TLiwVariant( (TBool)flagvalue) );
       
   267 
       
   268     flagvalue = ( flag & TMenuItem::EHidden )? 1 : 0;
       
   269     aMap->InsertL( KHidden, TLiwVariant( (TBool)flagvalue) );
       
   270 
       
   271     flagvalue = ( flag & TMenuItem::EMissing )? 1 : 0;
       
   272     aMap->InsertL( KMissing, TLiwVariant( (TBool)flagvalue) );
       
   273 	}
       
   274 
       
   275 // ---------------------------------------------------------
       
   276 // CMcsGetListCreatorInterface::AddRequiredAttributesL
       
   277 // ---------------------------------------------------------
       
   278 //
       
   279 void CMcsGetListCreatorInterface::AddRequiredAttributesL( const TMenuItem& aMenuItem,
       
   280 		CDesC16Array* aRequiredAttributes, CLiwDefaultMap* aMap )
       
   281 	{
       
   282 	TBool exists = EFalse;
       
   283 	TBuf<KMenuMaxAttrNameLen> running;
       
   284 	running.Copy( KRunning );
       
   285 	TBuf<KMenuMaxAttrNameLen> bitmap;
       
   286 	bitmap.Copy( KBitmapBuffer );
       
   287 	TBuf<KMenuMaxAttrNameLen> mask;
       
   288 	mask.Copy( KMaskBuffer );
       
   289 	TBool findBitmap( EFalse );
       
   290 	TBool findMask( EFalse );
       
   291 
       
   292 	RBuf attrvalue;
       
   293 	attrvalue.CreateL( KMenuMaxAttrValueLen );
       
   294 	CleanupClosePushL( attrvalue );
       
   295 
       
   296 	for( TInt i= 0; i < aRequiredAttributes->MdcaCount(); i++ )
       
   297 	    {
       
   298 	    if( aRequiredAttributes->MdcaPoint(i).Compare( running ) == KErrNone )
       
   299 	        {
       
   300 	        if ( aMenuItem.Type() == KMenuTypeApp() ||
       
   301 	        		aMenuItem.Type() == KMenuTypeFolder() )
       
   302 	            {
       
   303 	            iActualGetter->GetAttributeL( KRunningStatus, exists, attrvalue );
       
   304 	            aMap->InsertL( KRunning, TLiwVariant( exists ) );
       
   305 	            }
       
   306 	        }
       
   307 	    else if( aRequiredAttributes->MdcaPoint(i).Compare( bitmap ) == KErrNone )
       
   308 	        {
       
   309 	        findBitmap = ETrue;
       
   310 	        }
       
   311 	    else if( aRequiredAttributes->MdcaPoint(i).Compare( mask ) == KErrNone  )
       
   312 	        {
       
   313 	        findMask = ETrue;
       
   314 	        }
       
   315 	    else
       
   316 	        {
       
   317 	        iActualGetter->GetAttributeL(
       
   318 	        		aRequiredAttributes->MdcaPoint(i), exists, attrvalue );
       
   319 	        if( exists )
       
   320 	            {
       
   321 	            TBuf8<KMenuMaxAttrNameLen> attrname;
       
   322 	            attrname.Copy( aRequiredAttributes->MdcaPoint(i) );
       
   323 	            aMap->InsertL( attrname, TLiwVariant( attrvalue ) );
       
   324 	            }
       
   325 	        }
       
   326 	    }
       
   327 	if( findBitmap && findMask )
       
   328 	    {
       
   329 	    CLiwDefaultMap* iconAttrMap = CLiwDefaultMap::NewLC();
       
   330 	    FillIconAttributesMapL( aMenuItem, iconAttrMap );
       
   331 		aMap->InsertL( KIconAttributes, TLiwVariant( iconAttrMap ) );
       
   332     	CleanupStack::PopAndDestroy( iconAttrMap );
       
   333 	   	}
       
   334 	CleanupStack::PopAndDestroy( &attrvalue );
       
   335 	}
       
   336 
       
   337 // ---------------------------------------------------------
       
   338 // CMcsGetListCreatorInterface::AddAttributesWithoutIgnoredL
       
   339 // ---------------------------------------------------------
       
   340 //
       
   341 void CMcsGetListCreatorInterface::AddAttributesWithoutIgnoredL(	const TMenuItem& aMenuItem,
       
   342 		CDesC16Array* aIgnoredAttributes, CLiwDefaultMap* aMap )
       
   343 	{
       
   344     TBool exists = EFalse;
       
   345     TInt pos( KErrNotFound );
       
   346 
       
   347 	RBuf attrvalue;
       
   348 	attrvalue.CreateL( KMenuMaxAttrValueLen );
       
   349 	CleanupClosePushL( attrvalue );
       
   350 
       
   351     if ( aMenuItem.Type() == KMenuTypeApp()
       
   352     		|| aMenuItem.Type() == KMenuTypeFolder() )
       
   353         {
       
   354         TBuf<KMenuMaxAttrNameLen> running;
       
   355         running.Copy( KRunning );
       
   356         if( aIgnoredAttributes->Find( running, pos ) != KErrNone )
       
   357             {
       
   358             iActualGetter->GetAttributeL(KRunningStatus, exists, attrvalue );
       
   359             aMap->InsertL( KRunning, TLiwVariant( exists ) );
       
   360             }
       
   361         }
       
   362 
       
   363     RArray<TPtrC> attrNameList;
       
   364     CleanupClosePushL(attrNameList);
       
   365     iEng.GetAttributeListL( aMenuItem.Id(), attrNameList );
       
   366 
       
   367     for( TInt i = 0; i< attrNameList.Count(); i++ )
       
   368         {
       
   369         if( aIgnoredAttributes->Find( attrNameList[i], pos ) != KErrNone )
       
   370             {
       
   371             iActualGetter->GetAttributeL(attrNameList[i], exists, attrvalue );
       
   372             if( exists )
       
   373                 {
       
   374                 TBuf8<KMenuMaxAttrNameLen> attrname;
       
   375                 attrname.Copy( attrNameList[i] );
       
   376                 aMap->InsertL( attrname, TLiwVariant( attrvalue ) );
       
   377                 }
       
   378             }
       
   379         }
       
   380     TBuf<KMenuMaxAttrNameLen> bitmap;
       
   381     bitmap.Copy( KBitmapBuffer );
       
   382     TBuf<KMenuMaxAttrNameLen> mask;
       
   383     mask.Copy( KMaskBuffer );
       
   384     if( aIgnoredAttributes->Find( bitmap, pos ) != KErrNone
       
   385         && aIgnoredAttributes->Find( mask, pos ) != KErrNone )
       
   386         {
       
   387         CLiwDefaultMap* iconAttrMap = CLiwDefaultMap::NewLC();
       
   388     	FillIconAttributesMapL( aMenuItem, iconAttrMap );
       
   389     	aMap->InsertL( KIconAttributes, TLiwVariant( iconAttrMap ) );
       
   390     	CleanupStack::PopAndDestroy( iconAttrMap );
       
   391     	}
       
   392 
       
   393     CleanupStack::PopAndDestroy(&attrNameList);
       
   394 
       
   395 	CleanupStack::PopAndDestroy( &attrvalue );
       
   396 	}
       
   397 
       
   398 // ---------------------------------------------------------
       
   399 // CMcsGetListCreatorInterface::AddRequiredAttributesWithoutIgnoredL
       
   400 // ---------------------------------------------------------
       
   401 //
       
   402 void CMcsGetListCreatorInterface::AddRequiredAttributesWithoutIgnoredL(
       
   403 		const TMenuItem& aMenuItem, CDesC16Array* aRequiredAttributes,
       
   404 		CDesC16Array* aIgnoredAttributes, CLiwDefaultMap* aMap )
       
   405 	{
       
   406     TInt pos( KErrNotFound );
       
   407     TBool exists = EFalse;
       
   408     TBuf<KMenuMaxAttrNameLen> running;
       
   409     running.Copy( KRunning );
       
   410     TBuf<KMenuMaxAttrNameLen> bitmap;
       
   411     bitmap.Copy( KBitmapBuffer );
       
   412     TBuf<KMenuMaxAttrNameLen> mask;
       
   413     mask.Copy( KMaskBuffer );
       
   414     TBool findBitmap( EFalse );
       
   415     TBool findMask( EFalse );
       
   416 
       
   417 	RBuf attrvalue;
       
   418 	attrvalue.CreateL( KMenuMaxAttrValueLen );
       
   419 	CleanupClosePushL( attrvalue );
       
   420 
       
   421     for( TInt i= 0; i < aRequiredAttributes->MdcaCount(); i++ )
       
   422         {
       
   423         if( aRequiredAttributes->MdcaPoint(i).Compare( running ) == KErrNone
       
   424             && aIgnoredAttributes->Find( running, pos ) != KErrNone )
       
   425             {
       
   426             if ( aMenuItem.Type() == KMenuTypeApp() || aMenuItem.Type() == KMenuTypeFolder() )
       
   427                 {
       
   428                 iActualGetter->GetAttributeL( KRunningStatus, exists, attrvalue );
       
   429                 aMap->InsertL( KRunning, TLiwVariant( exists ) );
       
   430                 }
       
   431             }
       
   432         else if( aRequiredAttributes->MdcaPoint(i).Compare( bitmap ) == KErrNone
       
   433                 && aIgnoredAttributes->Find( bitmap, pos ) != KErrNone )
       
   434             {
       
   435             findBitmap = ETrue;
       
   436             }
       
   437         else if( aRequiredAttributes->MdcaPoint(i).Compare( mask ) == KErrNone
       
   438                 && aIgnoredAttributes->Find( mask, pos ) != KErrNone )
       
   439             {
       
   440             findMask = ETrue;
       
   441             }
       
   442         else if( aIgnoredAttributes->Find( aRequiredAttributes->MdcaPoint(i), pos ) != KErrNone )
       
   443             {
       
   444             iActualGetter->GetAttributeL( aRequiredAttributes->MdcaPoint(i), exists, attrvalue );
       
   445             if( exists )
       
   446                 {
       
   447                 TBuf8<KMenuMaxAttrNameLen> attrname;
       
   448                 attrname.Copy( aRequiredAttributes->MdcaPoint(i) );
       
   449                 aMap->InsertL( attrname, TLiwVariant( attrvalue ) );
       
   450                 }
       
   451             }
       
   452         }
       
   453     if( findBitmap && findMask )
       
   454         {
       
   455         CLiwDefaultMap* iconAttrMap = CLiwDefaultMap::NewLC();
       
   456        	FillIconAttributesMapL( aMenuItem, iconAttrMap );
       
   457        	aMap->InsertL( KIconAttributes, TLiwVariant( iconAttrMap ) );
       
   458        	CleanupStack::PopAndDestroy( iconAttrMap );
       
   459         }
       
   460 	CleanupStack::PopAndDestroy( &attrvalue );
       
   461 	}
       
   462 
       
   463 // ---------------------------------------------------------
       
   464 // CMcsGetListCreatorInterface::AddAllAttributesL
       
   465 // ---------------------------------------------------------
       
   466 //
       
   467 void CMcsGetListCreatorInterface::AddAllAttributesL(
       
   468 		const TMenuItem& aMenuItem, CLiwDefaultMap* aMap )
       
   469 	{
       
   470 	TBool exists = EFalse;
       
   471     RBuf attrvalue;
       
   472 	attrvalue.CreateL( KMenuMaxAttrValueLen );
       
   473 	CleanupClosePushL( attrvalue );
       
   474 
       
   475 	if ( aMenuItem.Type() == KMenuTypeApp() ||
       
   476 			aMenuItem.Type() == KMenuTypeFolder() )
       
   477 	    {
       
   478         iActualGetter->GetAttributeL( KRunningStatus, exists, attrvalue );
       
   479         aMap->InsertL( KRunning, TLiwVariant( exists ) );
       
   480 	    }
       
   481 	RArray<TPtrC> attrNameList;
       
   482 	CleanupClosePushL(attrNameList);
       
   483     iEng.GetAttributeListL( aMenuItem.Id(), attrNameList );
       
   484 
       
   485 	for(TInt i = 0;i< attrNameList.Count();i++)
       
   486 	    {
       
   487 	    TBuf8<KMenuMaxAttrNameLen> attrname;
       
   488 	    attrname.Copy( attrNameList[i] );
       
   489         iActualGetter->GetAttributeL( attrNameList[i], exists, attrvalue );
       
   490 	    if(exists)
       
   491 	        {
       
   492 	        attrname.Copy(attrNameList[i]);
       
   493 	        aMap->InsertL( attrname, TLiwVariant( attrvalue ) );
       
   494 	        }
       
   495 	    }
       
   496     CLiwDefaultMap* iconAttrMap = CLiwDefaultMap::NewLC();
       
   497    	FillIconAttributesMapL( aMenuItem, iconAttrMap );
       
   498    	aMap->InsertL( KIconAttributes, TLiwVariant( iconAttrMap ) );
       
   499    	CleanupStack::PopAndDestroy( iconAttrMap );
       
   500 	CleanupStack::PopAndDestroy(&attrNameList);
       
   501 	CleanupStack::PopAndDestroy( &attrvalue );
       
   502 
       
   503 	}
       
   504 
       
   505 // ---------------------------------------------------------
       
   506 // CMcsGetListCreatorInterface::FillIconAttributesMapL
       
   507 // ---------------------------------------------------------
       
   508 //
       
   509 void CMcsGetListCreatorInterface::FillIconAttributesMapL(
       
   510 		const TMenuItem& aMenuItem, CLiwDefaultMap* aMap )
       
   511 	{
       
   512 
       
   513     if ( aMenuItem.Type() == KMenuTypeApp())
       
   514     	{
       
   515     	AppendAttrL( KMenuAttrUid, aMap );
       
   516     	AppendAttrL( KMenuAttrNative, aMap );
       
   517     	}
       
   518     else if ( aMenuItem.Type() == KMenuTypeFolder() )
       
   519     	{
       
   520     	AppendAttrL( KChildrenCount, aMap );
       
   521     	}
       
   522 	AppendAttrL( KMenuAttrIconSkinMajorId, aMap );
       
   523 	AppendAttrL( KMenuAttrIconSkinMinorId, aMap );
       
   524 	AppendAttrL( KMenuAttrIconFile, aMap );
       
   525 	AppendAttrL( KMenuAttrIconId, aMap );
       
   526 	AppendAttrL( KMenuAttrMaskId, aMap );
       
   527 	}
       
   528 
       
   529 // ---------------------------------------------------------
       
   530 // CMcsGetListCreatorInterface::AppendAttrL
       
   531 // ---------------------------------------------------------
       
   532 //
       
   533 void CMcsGetListCreatorInterface::AppendAttrL(
       
   534         const TDesC& aAttrName, CLiwDefaultMap* aMap )
       
   535 	{
       
   536 	TBool exists;
       
   537 	TBuf8<KMenuMaxAttrNameLen> attrName;
       
   538 	RBuf attrvalue;
       
   539     attrvalue.CreateL( KMenuMaxAttrValueLen );
       
   540 	CleanupClosePushL( attrvalue );
       
   541 	iActualGetter->GetAttributeL(aAttrName, exists, attrvalue );
       
   542 	if ( exists )
       
   543 		{
       
   544 		attrName.Copy( aAttrName );
       
   545 		aMap->InsertL(attrName, TLiwVariant( attrvalue ) );
       
   546 		}
       
   547 	CleanupStack::PopAndDestroy( &attrvalue );
       
   548 	}
       
   549 
       
   550 // ---------------------------------------------------------
       
   551 // CMcsGetListCreatorInterface::SetGetterStrategyL
       
   552 // ---------------------------------------------------------
       
   553 //
       
   554 void CMcsGetListCreatorInterface::SetGetterStrategyL(TInt aId)
       
   555 	{
       
   556 	TBool suiteNameExists;
       
   557 	RBuf name;
       
   558 	name.CreateL( KMenuMaxAttrValueLen );
       
   559 	CleanupClosePushL( name );
       
   560 
       
   561 	iEng.GetAttributeL(aId, KMenuAttrSuiteName, suiteNameExists, name);
       
   562 	if (suiteNameExists && iEng.InstalledSuiteExist(name))
       
   563 		{
       
   564 		iActualGetter = iSuiteGetter;
       
   565 		}
       
   566 	else
       
   567 		{
       
   568 		iActualGetter = iNormalGetter;
       
   569 		}
       
   570 	iActualGetter->PrepareL(aId);
       
   571 	CleanupStack::PopAndDestroy(&name);
       
   572 	}
       
   573 //  End of File