menucontentsrv/srvinc/mcsgetlistcreatorinterface.h
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:  The API supports item information that is not supported by 
       
    15 *                the MCS server itself
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef __MCSGETLISTCREATORINTERFACE_H__
       
    21 #define __MCSGETLISTCREATORINTERFACE_H__
       
    22 
       
    23 #include <mcsmenuitem.h>
       
    24 
       
    25 //forward declarations
       
    26 class CLiwDefaultList;
       
    27 class CLiwDefaultMap;
       
    28 class CMenuSrvEng;
       
    29 
       
    30 
       
    31 /**
       
    32  * CMcsGetAttrStrategy
       
    33  * Abstract class for sttribute getting strategy
       
    34  * @since S60 v5.0
       
    35  */
       
    36 NONSHARABLE_CLASS( CMcsGetAttrStrategy ): public CBase
       
    37 	{
       
    38 public:
       
    39 
       
    40 	/**
       
    41 	 * Constructor.
       
    42 	 */
       
    43 	CMcsGetAttrStrategy( CMenuSrvEng& aEng );
       
    44 
       
    45 	/**
       
    46 	 * Destructor.
       
    47 	 */
       
    48 	virtual ~CMcsGetAttrStrategy();
       
    49 
       
    50 
       
    51 	/**
       
    52 	 * TODO: add comment
       
    53 	 */
       
    54 	virtual void PrepareL(TInt aId) = 0;
       
    55 
       
    56 	/**
       
    57 	 * Get attribute value.
       
    58 	 * @since S60 v5.0
       
    59 	 * @param aAttrName Attribute name.
       
    60 	 * @param aAttrExists Will be set to indicate whether attribute exists
       
    61 	 * or not.
       
    62 	 * @return Attribute value. Empty string if attribute does not exist.
       
    63 	 */
       
    64 	virtual void GetAttributeL(const TDesC& aAttrName,
       
    65 	        TBool& aAttrExists, TDes& aAttrVal ) = 0;
       
    66 
       
    67 protected:
       
    68 	/**
       
    69 	 * Engine. not own
       
    70 	 */
       
    71 	CMenuSrvEng& iEng;
       
    72 	};
       
    73 
       
    74 
       
    75 /**
       
    76  *  Interface for creating list containg result for getlist operation
       
    77  *
       
    78  * @since S60 v3.2
       
    79  */
       
    80 NONSHARABLE_CLASS( CMcsGetListCreatorInterface ) : public CBase
       
    81     {
       
    82 public:
       
    83     /**
       
    84     *   Destructor.
       
    85     */
       
    86     ~CMcsGetListCreatorInterface();
       
    87 
       
    88 	/*
       
    89 	* Create getlist output list
       
    90 	* @param aIdsArray array containing ids of items to be added to output list
       
    91 	* @param aRequiredAttributes required attributes
       
    92 	* @param aIgnoredAttributes ignored attributes
       
    93 	* @result output list
       
    94 	*/
       
    95     virtual CLiwDefaultList* CreateLC(
       
    96     		RArray<TMenuItem>& aIdsArray,
       
    97     		CDesC16Array* aRequiredAttributes,
       
    98     		CDesC16Array* aIgnoredAttributes) = 0;
       
    99 
       
   100 protected:
       
   101 	/**
       
   102 	*   Constructor.
       
   103 	*/
       
   104 	CMcsGetListCreatorInterface( CMenuSrvEng& aEng );
       
   105 
       
   106 	/**
       
   107 	 * 2nd phase constructor
       
   108 	 */
       
   109 	void ConstructL();
       
   110 
       
   111 	/**
       
   112 	 * Builds map with attributes
       
   113 	 * @param aMenuItem an item
       
   114 	 * @param aRequiredAttributes required attributes
       
   115 	 * @param aIgnoredAttributes ignored attributes
       
   116 	 * @param aMap map to store result
       
   117 	 */
       
   118 	void BuildMapL(
       
   119 			const TMenuItem& aMenuItem,
       
   120 			CDesC16Array* aRequiredAttributes,
       
   121 			CDesC16Array* aIgnoredAttributes,
       
   122 			CLiwDefaultMap* aMap );
       
   123 
       
   124 	/**
       
   125 	 * Adds fundamental attributes for an item
       
   126 	 * @param aMenuItem an item
       
   127 	 * @param aMap map to store result
       
   128 	 */
       
   129 	void AddFundamentalAttributesL(
       
   130 			const TMenuItem& aMenuItem,
       
   131 			CLiwDefaultMap* aMap );
       
   132 
       
   133 	/**
       
   134 	 * Adds required attributes
       
   135 	 * @param aMenuItem an item
       
   136 	 * @param aRequiredAttributes required attributes
       
   137 	 * @param aMap map to store results
       
   138 	 */
       
   139 	void AddRequiredAttributesL(
       
   140 			const TMenuItem& aMenuItem,
       
   141 			CDesC16Array* aRequiredAttributes,
       
   142 			CLiwDefaultMap* aMap );
       
   143 
       
   144 	/**
       
   145 	 * Adds all attributes without ignored
       
   146 	 * @param aMenuItem an item
       
   147 	 * @param aIgnoredAttributes ignored attributes
       
   148 	 * @param aMap map to store results
       
   149 	 */
       
   150 	void AddAttributesWithoutIgnoredL(
       
   151 			const TMenuItem& aMenuItem,
       
   152 			CDesC16Array* aIgnoredAttributes,
       
   153 			CLiwDefaultMap* aMap );
       
   154 
       
   155 	/*
       
   156 	 * Adds required attributes without ignored
       
   157 	 * @param aMenuItem an item
       
   158 	 * @param aRequiredAttributes required attributes
       
   159 	 * @param aIgnoredAttributes ignored attributes
       
   160 	 * @param aMap map to store results
       
   161 	 */
       
   162 	void AddRequiredAttributesWithoutIgnoredL(
       
   163 			const TMenuItem& aMenuItem,
       
   164 			CDesC16Array* aRequiredAttributes,
       
   165 			CDesC16Array* aIgnoredAttributes,
       
   166 			CLiwDefaultMap* aMap );
       
   167 
       
   168 	/**
       
   169 	 * Adds all attributes
       
   170 	 * @param aMenuItem an item
       
   171 	 * @param aMap map to store results
       
   172 	 */
       
   173 	void AddAllAttributesL(
       
   174 			const TMenuItem& aMenuItem,
       
   175 			CLiwDefaultMap* aMap );
       
   176 
       
   177 	/*
       
   178 	 * Adds icon related attributes to a map
       
   179 	 * @param aMenuItem an item
       
   180 	 * @param aMap map to store results
       
   181 	 */
       
   182 	void FillIconAttributesMapL(
       
   183 			const TMenuItem& aMenuItem,
       
   184 			CLiwDefaultMap* aMap );
       
   185 
       
   186 	/*
       
   187 	 * Appends attribute to a map
       
   188 	 * @param aAttrName an attribute name
       
   189 	 * @param aMap map to store results
       
   190 	 */
       
   191 	void AppendAttrL(
       
   192 			const TDesC& aAttrName,
       
   193 			CLiwDefaultMap* aMap );
       
   194 
       
   195 	/*
       
   196 	 * Sets actual attribute getting strategy for give item id.
       
   197 	 */
       
   198 	void SetGetterStrategyL(TInt aId);
       
   199 
       
   200 protected:
       
   201 	/**
       
   202 	 * Engine. not own
       
   203 	 */
       
   204 	CMenuSrvEng& iEng ;
       
   205 	CMcsGetAttrStrategy* iActualGetter; ///< Actual strategy for item.
       
   206 	CMcsGetAttrStrategy* iSuiteGetter;  ///< Get strategy for suite. Own.
       
   207 	CMcsGetAttrStrategy* iNormalGetter; ///< Get strategy for not suite. Own.
       
   208     };
       
   209 #endif __MCSGETLISTCREATORINTERFACE_H__