phonebookui/Phonebook2/inc/Pbk2AddressTools.h
branchRCL_3
changeset 20 f4a778e096c2
equal deleted inserted replaced
19:5b6f26637ad3 20:f4a778e096c2
       
     1 /*
       
     2 * Copyright (c) 2005-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:  Phonebook 2 contact address tools.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef PBK2ADDRESSTOOLS_H
       
    19 #define PBK2ADDRESSTOOLS_H
       
    20 
       
    21 #include "TPbk2ContactEditorParams.h"
       
    22 #include <Pbk2FieldProperty.hrh>
       
    23 #include <VPbkFieldType.hrh>
       
    24 #include <MVPbkFieldType.h>
       
    25 #include <e32hashtab.h>
       
    26 
       
    27 class MVPbkStoreContact;
       
    28 
       
    29 class Pbk2AddressTools
       
    30 	{
       
    31 public:
       
    32 	 /**
       
    33 	 * Maps UI contol type to feld group
       
    34 	 *
       
    35 	 * @param aCtrlType  Type of control ( TPbk2FieldCtrlTypeExt )
       
    36 	 * @return Suitable gruup id ( TPbk2FieldGroupId )
       
    37 	 */
       
    38 	IMPORT_C static TPbk2FieldGroupId MapCtrlTypeToAddress( 
       
    39 			TInt aCtrlType );
       
    40 	
       
    41 	 /**
       
    42 	 * Maps UI view type  to feld group
       
    43 	 *
       
    44 	 * @param aViewType  Type of view
       
    45 	 * @return Suitable gruup id
       
    46 	 */
       
    47 	IMPORT_C static TPbk2FieldGroupId MapViewTypeToAddress( 
       
    48 			TPbk2ContactEditorParams::TActiveView aViewType );
       
    49 	
       
    50 	/**
       
    51 	 * Maps feld group to field ordering
       
    52 	 *
       
    53 	 * @param aGroupAddress  field group
       
    54 	 * @return Suitable field ordering
       
    55 	 */
       
    56 	IMPORT_C static TInt MapAddressToOrdering( 
       
    57 			TPbk2FieldGroupId aGroupAddress );
       
    58 	
       
    59 	/**
       
    60 	 * Maps feld group to field ordering
       
    61 	 *
       
    62 	 * @param aGroupAddress  field group
       
    63 	 * @return Suitable field ordering
       
    64 	 */
       
    65 	IMPORT_C static TPbk2ContactEditorParams::TActiveView MapCtrlTypeToViewType( 
       
    66 			TInt aCtrlType );
       
    67 	
       
    68 	/**
       
    69 	 * Maps feld group to field type parameter
       
    70 	 *
       
    71 	 * @param aGroupAddress  field group
       
    72 	 * @return Suitable field type parameter
       
    73 	 */
       
    74 	IMPORT_C static TVPbkFieldTypeParameter MapAddressToVersitParam( 
       
    75 			TPbk2FieldGroupId aGroupId );
       
    76 	
       
    77 	/**
       
    78 	 * Creates map field type parameters to text data from these fields
       
    79 	 *
       
    80 	 * @param aContact  contact
       
    81 	 * @param aAddressGroup  field group
       
    82 	 * @param aFieldsMap  return parameter, allocated and put on CleanapStack
       
    83 	 * 					  	
       
    84 	 */
       
    85 	IMPORT_C static void GetAddressFieldsLC(
       
    86 				MVPbkStoreContact& aContact, 
       
    87 				TPbk2FieldGroupId aAddressGroup, 
       
    88 				RHashMap<TInt, TPtrC>& aFieldsMap );
       
    89 	
       
    90 	/**
       
    91 	* Creates address preview text from QTN_PHOB_ADDRESS_PREVIEW
       
    92 	* or QTN_PHOB_CONTACT_EDITOR_DEFINE if suitable fields are empty
       
    93 	*
       
    94 	* @param aContact  contact
       
    95 	* @param aAddressGroup  field group
       
    96 	* @param aFieldsMap  return parameter, allocated and put on CleanapStack
       
    97 	* 					  	
       
    98 	*/
       
    99 	IMPORT_C static void GetAddressPreviewLC(
       
   100 			MVPbkStoreContact& aContact, 
       
   101 			TPbk2FieldGroupId aAddressGroup, 
       
   102 			RBuf& aText );
       
   103 	
       
   104 	/**
       
   105 	* Creates address preview text from qtn_phob_commlauncher_onelinepreview  
       
   106 	* or QTN_PHOB_POPUP_INCOMPLETE_ADDRESS if suitable fields are empty
       
   107 	*
       
   108 	* @param aContact  contact
       
   109 	* @param aAddressGroup  field group
       
   110 	* @param aFieldsMap  return parameter, allocated and put on CleanapStack
       
   111 	* 					  	
       
   112 	*/
       
   113 	IMPORT_C static void GetAddressShortPreviewLC(
       
   114 				MVPbkStoreContact& aContact, 
       
   115 				TPbk2FieldGroupId aAddressGroup, 
       
   116 				RBuf& aText );
       
   117 	
       
   118 	 /**
       
   119 	 * Maps VPbkFieldType to field group
       
   120 	 *
       
   121 	 * @param aVPbkFieldType  Type of virtual phonebook field type
       
   122 	 * @return Suitable group id ( TPbk2FieldGroupId )
       
   123 	 */
       
   124 	IMPORT_C static TPbk2FieldGroupId MapVPbkFieldTypeToAddressGroupId( 
       
   125 			const MVPbkFieldType* aVPbkFieldType );
       
   126 	
       
   127 	 /**
       
   128 	 * Judge whether the address preview of one contact is empty
       
   129 	 * Address preview include the following four fields: 
       
   130 	 * EVPbkVersitSubFieldStreet, EVPbkVersitSubFieldLocality, 
       
   131 	 * EVPbkVersitSubFieldRegion and EVPbkVersitSubFieldCountry.
       
   132 	 * If the four fields are all empty, return ETrue; Otherwise, return EFalse.
       
   133 	 *
       
   134 	* @param aContact  contact
       
   135 	* @param aAddressGroup  field group
       
   136 	* @return If address preview is empty, return ETrue; Otherwiase, EFalse
       
   137 	 */
       
   138 	IMPORT_C static TBool IsAddressPreviewEmptyL( 
       
   139 			MVPbkStoreContact& aContact,
       
   140 			TPbk2FieldGroupId aAddressGroup );
       
   141 	};
       
   142 
       
   143 #endif // PBK2ADDRESSTOOLS_H
       
   144             
       
   145 // End of File