imservices/ossprotocoladaptation/inc/search/csearchkeystore.h
branchRCL_3
changeset 20 7797b2f86d2b
parent 18 b6f2a363adf7
child 25 cfe5eb8bb9ca
equal deleted inserted replaced
18:b6f2a363adf7 20:7797b2f86d2b
     1 /*
       
     2 * Copyright (c) 2007 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:  This class handles dynamic search label-key pair storing.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 /*!	/def To avoid multiple inclusions
       
    20 */
       
    21 #ifndef C_SEARCHKEYSTORE_H
       
    22 #define C_SEARCHKEYSTORE_H
       
    23 
       
    24 //For CBase
       
    25 #include <e32base.h>
       
    26 //For RHashMap
       
    27 #include <e32hashtab.h>
       
    28 //For TDesC
       
    29 #include <e32cmn.h>
       
    30 //For CRepository
       
    31 #include <centralrepository.h>
       
    32 //For TSearchKey
       
    33 #include <searchelement.h>
       
    34 
       
    35 /*!	/file 	
       
    36 *	Interfaces for CSearchKeyStore class
       
    37 */
       
    38 
       
    39 
       
    40 /*!	/var KLabelKeyStoreHash Uid to access central repository
       
    41 */
       
    42 const TUid KLabelKeyStoreHash = { 0x200195A9 };
       
    43 /*!	/def Total no. of keys that the UI supports( for localization )
       
    44 */
       
    45 #define NO_OF_KEYS_SUPPORTED 13
       
    46 
       
    47 
       
    48 /*!	/class CSearchKeyStore csearchkeystore.h
       
    49 *
       
    50 *	/brief This class stores the localizable search labels, and maps
       
    51 *	the labels got from get search keys to enums( Localizable ) and 
       
    52 *	strings( non localizable ). 
       
    53 *
       
    54 *	/brief Background : The search key labels from server are not standardized.
       
    55 *	So gizmo can give for 'First Name' a label 'First' and gtalk can give it as
       
    56 *	'Name'. We will have possible values for 'First Name' in cen rep. And 
       
    57 *	whenever a get search keys done and labels got, we wil try to map those
       
    58 *	to enums('Name', 'First' for EFirstName). If for 'first name' the label
       
    59 *	for some xyz server is 'Given' then it is non localizable. And wil be 
       
    60 *	sent to UI as a string
       
    61 */
       
    62 class CSearchKeyStore : public CBase
       
    63 	{
       
    64 	
       
    65 	public : 
       
    66 		/*!	/fn
       
    67 		*	/brief Static function that creates a new object
       
    68 		*	of type CSearchKeyStore
       
    69 		*/
       
    70 		static CSearchKeyStore* NewL();
       
    71 		
       
    72 		/*!	/fn
       
    73 		*	/brief constructor for the CSearchKeyStore class
       
    74 		*/
       
    75 		CSearchKeyStore();	
       
    76 		
       
    77 		/*!	/fn
       
    78 		*	/brief destructor for the CSearchKeyStore class
       
    79 		*/
       
    80 		virtual ~CSearchKeyStore();
       
    81 		
       
    82 		/*!	/fn
       
    83 		*	/brief Maps the labels from server got by making a get 
       
    84 		*	search keys request to server. Those are mapped to localizable
       
    85 		*	enums and non localizable strings
       
    86 		*
       
    87 		*	/param aLabels Labels to be classified
       
    88 		*/
       
    89 		void MapLabelsToEnumL( RPointerArray<TDesC>& aLabels );
       
    90 		
       
    91 		/*!	/fn
       
    92 		*	/brief Gets the label (for server) for the given enum(search field)
       
    93 		*
       
    94 		*	/param aEnum search field
       
    95 		*	/return HBufC* string corresponding to the enum. The ownership of
       
    96 		*	returned pointer is transfered to callee.
       
    97 		*/
       
    98 		HBufC* GetLabelFromEnumL( TSearchKey aEnum );
       
    99 		
       
   100 		/*!	/brief This function returns an array of pointers to the
       
   101 		*	supported keys( Supported labels are the labels that have 
       
   102 		*	support in the UI for logical strings)
       
   103 		*
       
   104 		*	/return an array of pointers to enums
       
   105 		*/	
       
   106 		RPointerArray<TSearchKey>	GetSupportedEnums();
       
   107 		
       
   108 				
       
   109 		/*!	/brief This function returns a handle to the array of not
       
   110 		*	supported label strings. Not supported here means that
       
   111 		*	there are no logical strings in UI for these labels
       
   112 		*
       
   113 		*	/return const handle to not supported strings
       
   114 		*/
       
   115 
       
   116 		const RPointerArray<TDesC> GetNotSupportedLabels();
       
   117 		
       
   118 	private:
       
   119 		
       
   120 		/*!	/fn
       
   121 		*	/brief ConstructL reads labels from the cen rep
       
   122 		*	and maps them to enums
       
   123 		*/
       
   124 		void ConstructL();
       
   125 		
       
   126 		/*!	/var iLabelKeyHashRep Handle to cen rep
       
   127 		*/
       
   128 		CRepository* iLabelKeyHashRep;//owned
       
   129 		
       
   130 		/*!	/var iEnumLabels maps the labels to enums
       
   131 		*/
       
   132 		RHashMap<TInt, TPtr16> iEnumLabels;//owned
       
   133 		
       
   134 		/*!	/var iNotSupportedLabels Has the labels that can not
       
   135 		*	be localized.
       
   136 		*/
       
   137 		RPointerArray<TDesC> iNotSupportedLabels;//owned
       
   138 		
       
   139 		/*!	/var iSupportedLabels Hash Map of the search labels and
       
   140 		*	to search field enums
       
   141 		*/
       
   142 		RHashMap<TInt, TPtr16> iSupportedLabels;//owned
       
   143 
       
   144 	};
       
   145 
       
   146 
       
   147 
       
   148 #endif //C_SEARCHKEYSTORE_H