emailcontacts/remotecontactlookup/engine/inc/pbkxrclutils.h
branchRCL_3
changeset 12 4ce476e64c59
parent 11 0396474f30f5
child 13 8592a65ad3fb
equal deleted inserted replaced
11:0396474f30f5 12:4ce476e64c59
     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:  Definition of the class PbkxRclUtils.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef PBKXRCLUTILS_H
       
    20 #define PBKXRCLUTILS_H
       
    21 
       
    22 #include <CPbkContactItem.h>
       
    23 //<cmail>
       
    24 #include "tpbkxremotecontactlookupprotocolaccountid.h"
       
    25 //</cmail>
       
    26 
       
    27 class CPbkContactEngine;
       
    28 
       
    29 /**
       
    30 * Class that offers static helper methods.
       
    31 *
       
    32 * @lib pbkxrclengine.lib
       
    33 * @since S60 3.1
       
    34 */
       
    35 class PbkxRclUtils 
       
    36     {
       
    37 public: // static methods
       
    38 
       
    39     /**
       
    40     * Returns text of the given field of the given contact.
       
    41     *
       
    42     * If there are multiple fields with given id, first one is returned.
       
    43     * 
       
    44     * @param aItem Contact item which field text is asked.
       
    45     * @param aId Field id.
       
    46     * @return Text of the field or empty text if none is found.
       
    47     */
       
    48     static HBufC* FieldTextL( const CPbkContactItem* aItem, TPbkFieldId aId );
       
    49 
       
    50     /**
       
    51     * Returns tet of the given field.
       
    52     *
       
    53     * @param aField Field which text is wanted.
       
    54     * @return Field text.
       
    55     */
       
    56     static HBufC* FieldTextL( TPbkContactItemField& aField );
       
    57 
       
    58     /**
       
    59     * Returns the text in the given field, if such field exists and it's type is
       
    60     * text.
       
    61     *
       
    62     * If there are more than one fields with given type, the first one is returned.
       
    63     *
       
    64     * @param aCard Contact card.
       
    65     * @param aFieldType Type of the field.
       
    66     */
       
    67     static TPtrC FieldText( const CContactCard* aCard, TFieldType aFieldType );
       
    68 
       
    69     /**
       
    70     * Gets the default protocol account id.
       
    71     *
       
    72     * Leaves with KErrNotFound if default account id is not set.
       
    73     */
       
    74     static TPbkxRemoteContactLookupProtocolAccountId DefaultProtocolAccountIdL();
       
    75 
       
    76     /**
       
    77     * Stores default protocol account id.
       
    78     *
       
    79     * @param aId Account id to be stored.
       
    80     */
       
    81     static void StoreDefaultProtocolAccountIdL(
       
    82         TPbkxRemoteContactLookupProtocolAccountId aId );
       
    83 
       
    84     /**
       
    85     * Returns ETrue if given text contains at least one alpha 
       
    86     * characters.
       
    87     *
       
    88     * @param aText Text to be investigated.
       
    89     * @return ETrue if given text contains at least one alpha character.
       
    90     */
       
    91     static TBool HasAlphaCharsInString( const TDesC& aText );
       
    92 
       
    93     /**
       
    94     * Creates new contact item of the given contact card.
       
    95     *
       
    96     * @param aCard Contact card.
       
    97     * @param aEngine Contact engine.
       
    98     * @return Created item. Ownership is transferred.
       
    99     */
       
   100     static CPbkContactItem* CreateContactItemL( 
       
   101         CContactCard* aCard, 
       
   102         CPbkContactEngine& aEngine );
       
   103 
       
   104     };
       
   105 
       
   106 #endif