phoneengine/PhoneCntFinder/ContactService/inc/tphcntcontactfield.h
changeset 0 5f000ab63145
child 19 544e34b3255a
equal deleted inserted replaced
-1:000000000000 0:5f000ab63145
       
     1 /*
       
     2 * Copyright (c) 2006 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:  Resolves and represents the contact field information
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef TPHCNTCONTACTFIELD_H
       
    19 #define TPHCNTCONTACTFIELD_H
       
    20 
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <TVPbkFieldVersitProperty.h>
       
    24 #include "MPhCntMatch.h"
       
    25 #include "tphcntnumber.h"
       
    26 
       
    27 class MPhCntContactManager;
       
    28 class MVPbkStoreContactField;
       
    29 
       
    30 
       
    31 /**
       
    32  *  Contact field from contact.
       
    33  *
       
    34  *  Resolves the type of the contact field ysing contact field id.
       
    35  *
       
    36  *  @lib PhoneCntFinder.lib
       
    37  *  @since S60 v3.1
       
    38  */
       
    39 NONSHARABLE_CLASS( TPhCntContactField ) 
       
    40     {
       
    41 public:
       
    42     
       
    43     /**
       
    44      * Constructor.
       
    45      * 
       
    46      * @since S60 v3.1
       
    47      * @param aContactFieldId Contact field identifier.
       
    48      */
       
    49     TPhCntContactField( TInt aContactFieldId );
       
    50     
       
    51     /**
       
    52      * Constructor.
       
    53      *
       
    54      * @since S60 v3.1
       
    55      */
       
    56     TPhCntContactField();
       
    57     
       
    58     /**
       
    59      * Destructor.
       
    60      *
       
    61      * @since S60 v3.1
       
    62      */
       
    63     virtual ~TPhCntContactField();
       
    64         
       
    65     /** 
       
    66      * Resolves if the contact field data belongs to this
       
    67      * contact field. If the contact field data belongs to this then
       
    68      * the data is stored to this field.
       
    69      *
       
    70      * @since S60 v3.1
       
    71      * @param aContactFieldId aFieldData's field identifier.
       
    72      * @param aFieldData Data in the contact field.
       
    73      * @param aPointedField Was the field data pointed by contact link.
       
    74      */
       
    75     virtual void Resolve( 
       
    76         TInt aContactFieldId, 
       
    77         const TDesC& aFieldData, 
       
    78         TBool aPointedField );
       
    79 
       
    80     /**
       
    81      * Data of the field.
       
    82      *
       
    83      * @since S60 v3.1
       
    84      * @return Data.
       
    85      */
       
    86     const TDesC& Data() const;
       
    87 
       
    88 protected:
       
    89 
       
    90     /**
       
    91      * Sets the data.
       
    92      */
       
    93     void SetData( const TDesC& aData, TBool aPointedData );
       
    94     
       
    95 protected: // data 
       
    96 
       
    97     /**
       
    98      * Was the data set by pointed field.
       
    99      */
       
   100     TBool iDataPointedByContactLink;
       
   101 
       
   102 private: // data
       
   103 
       
   104     /**
       
   105      * Data of the contact field.
       
   106      */
       
   107     TPtrC iContactFieldData;
       
   108     
       
   109     /**
       
   110      * Possible field id, which identifies this field.
       
   111      */
       
   112     TInt iContactFieldId;
       
   113     
       
   114     };
       
   115     
       
   116 /**
       
   117  *  Phonenumber contact field.
       
   118  *
       
   119  *  Resolves phone numbers from virtual phonebook. 
       
   120  *
       
   121  *  @lib PhoneCntFinder.lib
       
   122  *  @since S60 v3.1
       
   123  */
       
   124 NONSHARABLE_CLASS( TPhCntPhoneNumber ): public TPhCntContactField
       
   125     {
       
   126 public:
       
   127 
       
   128     /**
       
   129      * Constructor.
       
   130      *
       
   131      * @since S60 v3.1
       
   132      */
       
   133     TPhCntPhoneNumber();
       
   134     
       
   135     /**
       
   136      * Destructor.
       
   137      *
       
   138      * @since S60 v3.1
       
   139      */
       
   140     ~TPhCntPhoneNumber();
       
   141     
       
   142     /**
       
   143      * Gives the phone number that was matched(pointed by VPB) from contact.
       
   144      * If there wasn't number that were pointed by VPB this number does
       
   145      * not contain information.
       
   146      *
       
   147      * @since S60 v3.1.
       
   148      * @return Possible number which was pointed by virtual phonebook
       
   149      */
       
   150     const TPhCntNumber& Number() const;
       
   151     
       
   152     /**
       
   153      * Gives array of all resolved numbers, including possible matched number.
       
   154      *
       
   155      * @since S60 v3.1.
       
   156      * @return Array of phone numbers.
       
   157      */     
       
   158     const RArray<TPhCntNumber>& AllNumbers() const;
       
   159             	
       
   160 // from base class TPhCntContactField
       
   161 
       
   162     /**
       
   163      * From TPhCntContactField.
       
   164      *
       
   165      * @since S60 v3.1
       
   166      * @see TPhCntContactField.
       
   167      */
       
   168     void ResolveL( 
       
   169         TInt aContactFieldId, 
       
   170         const TDesC& aFieldData, 
       
   171         TBool aPointedField,
       
   172         MPhCntContactManager& aContactManager,
       
   173     	MVPbkStoreContactField& aContactField
       
   174         );                  
       
   175     
       
   176 protected: 
       
   177 
       
   178 	/**
       
   179      * Evaluates the type of a phone number field.
       
   180      * @param aContactFieldId Field to be resolved.
       
   181      * @return Resolved phone number type, 
       
   182      *         MPhCntMatch::ENone if the type was other than a phone number
       
   183      */
       
   184     MPhCntMatch::TNumberType PhoneNumberType( 
       
   185     	TInt aContactFieldId );    	
       
   186     	
       
   187     void SetNumber( const TDesC& aNumber, 
       
   188                     MPhCntMatch::TNumberType aNumberType, 
       
   189                     TBool aPointedField,
       
   190                     TInt aSpeedDialPosition );
       
   191         
       
   192 private: // Data
       
   193     
       
   194     /**
       
   195      * Phone number that was pointed by contact link.
       
   196      */
       
   197     TPhCntNumber iPointedNumber;
       
   198     
       
   199     /**
       
   200      * Array of all resolved phone numbers, including
       
   201      * pointed number.
       
   202      * Own.
       
   203      */
       
   204     RArray<TPhCntNumber> iAllNumbers;
       
   205 
       
   206     };
       
   207 
       
   208 #endif // TPHCNTCONTACTFIELD_H