emailcontacts/remotecontactlookup/engine/inc/cpbkxrclcontactupdater.h
branchRCL_3
changeset 12 4ce476e64c59
parent 11 0396474f30f5
child 13 8592a65ad3fb
equal deleted inserted replaced
11:0396474f30f5 12:4ce476e64c59
     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:  Definition of the class CPbkxRclContactUpdater
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPBKXRCLCONTACTUPDATER_H
       
    20 #define CPBKXRCLCONTACTUPDATER_H
       
    21 
       
    22 #include <e32base.h>
       
    23 
       
    24 class CPbkContactEngine;
       
    25 class CPbkContactItem;
       
    26 class TPbkContactItemField;
       
    27 class CPbkFieldInfo;
       
    28 
       
    29 /**
       
    30 * Class that updates existing contact data.
       
    31 *
       
    32 * @lib pbkxrclengine.lib
       
    33 * @since 3.1
       
    34 */
       
    35 class CPbkxRclContactUpdater : public CBase
       
    36     {
       
    37 public: // constructors and destructor
       
    38 
       
    39     /**
       
    40     * Constructs contact updater.
       
    41     *
       
    42     * @param aEngine Contact engine.
       
    43     * @return Created object.
       
    44     */
       
    45     static CPbkxRclContactUpdater* NewL( CPbkContactEngine& aEngine );
       
    46 
       
    47     /**
       
    48     * Constructs contact updater.
       
    49     *
       
    50     * Pointer to the created object is left on cleanupstack.
       
    51     *
       
    52     * @param aEngine Contact engine.
       
    53     * @return Created object.
       
    54     */
       
    55     static CPbkxRclContactUpdater* NewLC( CPbkContactEngine& aEngine );
       
    56     
       
    57     /**
       
    58     * Destructor.
       
    59     */
       
    60     virtual ~CPbkxRclContactUpdater();
       
    61 
       
    62 public: // new methods
       
    63 
       
    64     /**
       
    65     * Updates the given field to the user selected contact.
       
    66     *
       
    67     * @param aField Field to be updated to the contact.
       
    68     *
       
    69     * @return Update text shown to the user. Ownership is transferred.
       
    70     */
       
    71     HBufC* UpdateContactL( TPbkContactItemField& aField );
       
    72 
       
    73 private: // methods used internally
       
    74 
       
    75     /**
       
    76     * Constructs the list of possible fields and if there are several,
       
    77     * user is asked to select a field.
       
    78     *
       
    79     * If there is already selected field, user is asked if he wants to
       
    80     * replace the existing field.
       
    81     *
       
    82     * NULL is returned if user cancels the updating.
       
    83     *
       
    84     * @param aContactItem Contact for which field is updated.
       
    85     * @param aFieldInfo Field info of the field which data is updated
       
    86     *                   to the contact.
       
    87     * @return Field which is updated.
       
    88     */
       
    89     TPbkContactItemField* SelectUpdatedFieldL(
       
    90         CPbkContactItem& aContactItem,
       
    91         CPbkFieldInfo& aFieldInfo );
       
    92 
       
    93     /**
       
    94     * Constructs update text shown to the user after successfull updating.
       
    95     *
       
    96     * @param aContactItem Contact item that was updated.
       
    97     * @param aField Updated field.
       
    98     * @return Update text.
       
    99     */
       
   100     HBufC* ConstructUpdatedTextL( 
       
   101         CPbkContactItem& aContactItem,
       
   102         TPbkContactItemField& aField );
       
   103 
       
   104     /**
       
   105     * Constructs a list of possible fields of given type.
       
   106     *
       
   107     * There are three possible types: home, work, and none. If at least two
       
   108     * types are found, user is asked to select a type.
       
   109     *
       
   110     * @param aFieldInfo Source field info of the field that is updated 
       
   111     *                   to the contact.
       
   112     * @param aFieldCount Number of possible fields.
       
   113     * @return Destination field info which is updated. 
       
   114     *         Ownership is not transferred. 
       
   115     */
       
   116     CPbkFieldInfo* SelectFieldL(
       
   117         CPbkFieldInfo& aFieldInfo,
       
   118         TInt& aFieldCount );
       
   119 
       
   120 private: // constructors
       
   121 
       
   122     /**
       
   123     * Constructor.
       
   124     *
       
   125     * @param aEngine Contact engine.
       
   126     */
       
   127     CPbkxRclContactUpdater( CPbkContactEngine& aEngine );
       
   128 
       
   129     /**
       
   130     * Second-phase constructor.
       
   131     */
       
   132     void ConstructL();
       
   133 
       
   134 private: // data
       
   135 
       
   136     // Contact engine.
       
   137     CPbkContactEngine& iEngine;
       
   138     // Offset to resource file.
       
   139     TInt iResourceFileOffset;
       
   140     };
       
   141 
       
   142 #endif
       
   143