phonebookui/Phonebook2/CommandsExtension/inc/Pbk2SendCmdUtils.h
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     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:  Send command's utility functions
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef PBK2SENDCMDUTILS_H
       
    20 #define PBK2SENDCMDUTILS_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 
       
    25 // FORWARD DECLARATIONS
       
    26 class MVPbkBaseContact;
       
    27 class MVPbkFieldType;
       
    28 class MVPbkBaseContactField;
       
    29 class MVPbkFieldTypeList;
       
    30 
       
    31 // CLASS DECLARATIONS
       
    32 /** 
       
    33  * Send command's utility functions
       
    34  */
       
    35 class Pbk2SendCmdUtils
       
    36 	{
       
    37 	public:
       
    38 		/**
       
    39 		 * Finds if contact has any data in its fields.
       
    40 		 * @param aContact contact to be checked
       
    41 		 * @return ETrue if contact is empty, otherwise EFalse.
       
    42 		 * @see MVPbkContactFieldData::IsEmpty
       
    43 		 */
       
    44 		static TBool IsContactEmpty(const MVPbkBaseContact* aContact);
       
    45 		
       
    46 		/**
       
    47 		 * Finds specified field from contact.
       
    48 		 * @param aContact contact where to search
       
    49 		 * @param aResIdForFieldType VPBK_FIELD_TYPE_MAPPING resource id
       
    50 		 * @param master field type list from contact manager.
       
    51 		 * @return contact field of type aResIdForFieldType, NULL if 
       
    52 		 *					field does not found
       
    53 		 */
       
    54 		static const MVPbkBaseContactField* FindFieldL(
       
    55 			const MVPbkBaseContact& aContact,
       
    56 			TInt aResIdForFieldType,
       
    57 			const MVPbkFieldTypeList& aMasterFieldTypeList);
       
    58 			
       
    59 		/**
       
    60 		 * Finds specified field from contact.
       
    61 		 * @param aContact contact where to search
       
    62 		 * @param aFieldType a field type to find from contact
       
    63 		 * @param master field type list from contact manager.
       
    64 		 * @return contact field of type aFieldType, NULL if 
       
    65 		 *					field does not found
       
    66 		 */
       
    67 		static const MVPbkBaseContactField* FindField(
       
    68 			const MVPbkBaseContact& aContact,
       
    69 			const MVPbkFieldType& aFieldType,
       
    70 			const MVPbkFieldTypeList& aMasterFieldTypeList);
       
    71 			
       
    72 			
       
    73 		/**
       
    74 		 * Reads field type mapping from resource file
       
    75 		 * @param aResId VPBK_FIELD_TYPE_MAPPING resource id
       
    76 		 * @param master field type list from contact manager.
       
    77 		 * @return field type
       
    78 		 * @exception If field type not found leaves with KErrNotFound
       
    79 		 */
       
    80 		static const MVPbkFieldType& ReadFieldTypeFromResL(
       
    81 			TInt aResId,
       
    82 			const MVPbkFieldTypeList& aMasterFieldTypeList);
       
    83 		
       
    84 		/**
       
    85 		 * Returns the contact field's field type.
       
    86 		 * @param field from where to find field type
       
    87 		 * @param master field type list from contact manager.
       
    88 		 * @return field's field type
       
    89 		 * @see MVPbkBaseContactField::MatchFieldType
       
    90 		 */
       
    91 		static const MVPbkFieldType* FieldType(
       
    92 			const MVPbkBaseContactField& aField,
       
    93 			const MVPbkFieldTypeList& aMasterFieldTypeList);
       
    94 			
       
    95 		/**
       
    96 		 * Checks if aField's field type and aFieldType are matching
       
    97 		 * @param field from where to find field type
       
    98 		 * @param aFieldType a field type to match with contact's field type
       
    99 		 * @param master field type list from contact manager.
       
   100 		 * @return field's field type
       
   101 		 * @see MVPbkBaseContactField::MatchFieldType
       
   102 		 */
       
   103 		static TBool IsFieldMatching(
       
   104 			const MVPbkBaseContactField& aField,
       
   105 			const MVPbkFieldType& aFieldType,
       
   106 			const MVPbkFieldTypeList& aMasterFieldTypeList);		
       
   107 	};
       
   108 	
       
   109 #endif // PBK2SENDCMDUTILS_H
       
   110 
       
   111 // End of file