phoneengine/PhoneCntFinder/ContactService/inc/cphcntcontactfieldsresolver.h
changeset 0 5f000ab63145
child 7 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 contact fields.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CPHCNTCONTACTFIELDSRESOLVER_H
       
    21 #define CPHCNTCONTACTFIELDSRESOLVER_H
       
    22 
       
    23 #include <e32base.h>
       
    24 
       
    25 #include "tphcntcontactfield.h"
       
    26 #include "MPhCntMatch.h"
       
    27 #include "mphcntcontactfields.h"
       
    28 
       
    29 class MVPbkContactLink;
       
    30 class MVPbkStoreContact;
       
    31 class MPbk2ContactNameFormatter;
       
    32 class MVPbkStoreContactField;
       
    33 class MPhCntContactManager;
       
    34 
       
    35 /**
       
    36  *  Resolves contact's fields.
       
    37  *
       
    38  *  @lib PhoneCntFinder
       
    39  *  @since S60 ?S60_version *** for example, S60 v3.0
       
    40  */
       
    41 NONSHARABLE_CLASS( CPhCntContactFieldsResolver ) : 
       
    42     public CBase, public MPhCntContactFields
       
    43     {
       
    44 public:
       
    45 
       
    46     /**
       
    47      * Static constructor.
       
    48      *
       
    49      * @since S60 v3.1
       
    50      * @param aContactLink Link pointing to the contact, which fields are resolved.
       
    51      * @param aContact Contact which fields are resolved.
       
    52      * @param aNameFormatter Contact title formatter.
       
    53      * @return New instance
       
    54      */
       
    55     static CPhCntContactFieldsResolver* NewL(
       
    56         MVPbkContactLink* aContactLink,
       
    57         MVPbkStoreContact* aContact,
       
    58         MPhCntContactManager& aContactManager );
       
    59 
       
    60     /**
       
    61      * Static constructor.
       
    62      *
       
    63      * @since S60 v3.1
       
    64      * @param aContactLink Link pointing to the contact, which fields are resolved.
       
    65      * @param aContact Contact which fields are resolved.
       
    66      * @param aNameFormatter Contact title formatter.
       
    67      * @return New instance
       
    68      */
       
    69     static CPhCntContactFieldsResolver* NewLC(
       
    70         MVPbkContactLink* aContactLink,
       
    71         MVPbkStoreContact* aContact,
       
    72         MPhCntContactManager& aContactManager );
       
    73     
       
    74     /**
       
    75      * Destructor.
       
    76      */    
       
    77     virtual ~CPhCntContactFieldsResolver();
       
    78 
       
    79 // from base class MPhCntContactFields
       
    80     
       
    81     /**
       
    82      * From base class MPhCntContactFields
       
    83      * Get the number type.
       
    84      * @since S60 v3.1
       
    85      * @return Phonebook number type.
       
    86      */
       
    87     MPhCntMatch::TNumberType NumberType() const;
       
    88     
       
    89     /**    
       
    90      * From base class MPhCntContactFields
       
    91      * @since S60 v3.1
       
    92      * @return Contact link, ownership is not given.
       
    93      */
       
    94     MVPbkContactLink* ContactLink() const;
       
    95     
       
    96     /**    
       
    97      * From base class MPhCntContactFields
       
    98      * @since S60 v3.1
       
    99      * @return First name. Empty if there isn't one specified.
       
   100      */
       
   101     TPtrC FirstName() const;
       
   102 
       
   103     /**    
       
   104      * From base class MPhCntContactFields
       
   105      * @since S60 v3.1
       
   106      * @return Last name. Empty if there isn't one specified.
       
   107      */
       
   108     TPtrC LastName() const;
       
   109 
       
   110     /**    
       
   111      * From base class MPhCntContactFields
       
   112      * @since S60 v3.1
       
   113      * @return Company name. Empty if there isn't one specified.
       
   114      */
       
   115     TPtrC CompanyName() const;
       
   116 
       
   117     /**    
       
   118      * From base class MPhCntContactFields
       
   119      * Returns the matched number.
       
   120      * @since S60 v3.1
       
   121      * @return Phone number. Empty if there isn't one specified.
       
   122      */
       
   123     TPtrC Number() const;
       
   124     
       
   125     /**
       
   126      * From base class MPhCntContactFields
       
   127      * 
       
   128      * @since S60 v3.2
       
   129      * @see MPhCntContactFields
       
   130      */
       
   131     TPtrC Dtmf() const;
       
   132 
       
   133     /**    
       
   134      * From base class MPhCntContactFields
       
   135      * @since S60 v3.1
       
   136      * @return Ringing tone. Empty if there isn't one specified.
       
   137      */
       
   138     TPtrC PersonalRingingTone() const;
       
   139     
       
   140     /**    
       
   141      * From base class MPhCntContactFields
       
   142      * @since S60 v3.1
       
   143      * @return Second name. Empty if there isn't one specified.
       
   144      */
       
   145     TPtrC SecondName() const;
       
   146     
       
   147     /**    
       
   148      * From base class MPhCntContactFields
       
   149      * @since S60 v3.1
       
   150      * @return First name's pronunction. May be zero length.
       
   151      */
       
   152     TPtrC FirstNamePronunciation() const;
       
   153      
       
   154     /**
       
   155      * From base class MPhCntContactFields
       
   156      * Last name pronunciation.
       
   157      * 
       
   158      * @since S60 v3.1
       
   159      * @return Last name's pronunction. May be zero length.
       
   160      */
       
   161     TPtrC LastNamePronunciation() const;
       
   162     
       
   163     /**
       
   164      * From base class MPhCntContactFields
       
   165      * Company name pronunciation.
       
   166      * 
       
   167      * @since S60 v3.1
       
   168      * @return Company name's pronunction. May be zero length.
       
   169      */
       
   170     TPtrC CompanyNamePronunciation() const;
       
   171     
       
   172     /**
       
   173      * From base class MPhCntContactFields
       
   174      * @since S60 v3.1
       
   175      * @return Contact title. Ownership given.
       
   176      */
       
   177     HBufC* GetContactTitleL();
       
   178     
       
   179      /**    
       
   180      * From base class MPhCntContactFields
       
   181      * @since S60 v3.1
       
   182      * @return Array of contact links to groups, where this contact belongs
       
   183      */
       
   184     MVPbkContactLinkArray* ContactGroupsLC() const;
       
   185     
       
   186      /**    
       
   187      * From base class MPhCntContactFields
       
   188      * @since S60 v3.1
       
   189      * @return Contact store, where this contacts information is stored.
       
   190      */
       
   191     MVPbkStoreContact& StoreContact() const;
       
   192     
       
   193     /**    
       
   194      * From base class MPhCntContactFields
       
   195      * @since S60 v3.1
       
   196      * @return Thumbnail field. Null if no thumbnail field defined.
       
   197      */
       
   198     const MVPbkFieldType* ThumbnailField() const;
       
   199     
       
   200     /**    
       
   201      * From base class MPhCntContactFields
       
   202      * @since S60 v3.1
       
   203      * @return Call image. Empty if there isn't one specified.
       
   204      */
       
   205     TPtrC CallImage() const;
       
   206     
       
   207     /**    
       
   208      * From base class MPhCntContactFields
       
   209      * @since S60 v3.1
       
   210      * @return Call text. Empty if there isn't one specified.
       
   211      */
       
   212     TPtrC CallText() const;
       
   213 
       
   214     /**    
       
   215      * From base class MPhCntContactFields
       
   216      * @since S60 v3.1
       
   217      * @return ETrue if contact has thumbnail field.
       
   218      */
       
   219     TBool HasThumbnail() const;
       
   220     
       
   221     /**
       
   222      * From base class MPhCntContactFields
       
   223      *
       
   224      * @since S60 v3.2.
       
   225      * @return Array of phone numbers.
       
   226      */     
       
   227     const RArray<TPhCntNumber>& AllNumbers() const;
       
   228     
       
   229     /**
       
   230      * From base class MPhCntContactFields
       
   231      *
       
   232      * @since S60 v3.2.
       
   233      * @return Array of predefined DTMF strings.
       
   234      */        
       
   235     CDesCArray* AllDtmfNumbers() const;     
       
   236 
       
   237 private:
       
   238 
       
   239     CPhCntContactFieldsResolver(
       
   240         MVPbkContactLink* aContactLink,
       
   241         MVPbkStoreContact* aContact,
       
   242         MPhCntContactManager& aContactManager );
       
   243 
       
   244     void ConstructL();
       
   245     
       
   246     void ResolveFieldL( 
       
   247         MVPbkStoreContactField& aContactField,
       
   248         TBool aFieldPointedByContactLink );
       
   249     
       
   250     void ResolveFieldDataL( 
       
   251         MVPbkStoreContactField& aContactField, 
       
   252         const TPtrC aFieldTextData,
       
   253         TBool aFieldPointedByContactLink );
       
   254 
       
   255 private: // data
       
   256 
       
   257     
       
   258     /**
       
   259      * Resolvers for single fields
       
   260      */
       
   261     TPhCntPhoneNumber iPhoneNumberResolver;
       
   262     TPhCntContactField iFirstNameResolver;
       
   263     TPhCntContactField iLastNameResolver;
       
   264     TPhCntContactField iCompanyNameResolver;
       
   265     TPhCntContactField iSecondNameResolver;
       
   266     TPhCntContactField iRingingToneResolver;
       
   267     TPhCntContactField iFirstNamePronunciationResolver;
       
   268     TPhCntContactField iLastNamePronunciationResolver;
       
   269     TPhCntContactField iCompanyNamePronunciationResolver;
       
   270     TPhCntContactField iCallImageResolver;
       
   271     TPhCntContactField iCallTextResolver;
       
   272     TPhCntContactField iDtmfResolver;
       
   273         
       
   274     /**
       
   275      * Link to the contact.
       
   276      * Own.
       
   277      */
       
   278     MVPbkContactLink* iContactLink;
       
   279     
       
   280     /**
       
   281      * Contact
       
   282      * Own.
       
   283      */
       
   284     MVPbkStoreContact* iContact;
       
   285     
       
   286     /**
       
   287      * Handle to virtual phonebook.
       
   288      * Not Own.
       
   289      */
       
   290     MPhCntContactManager& iContactManager;
       
   291 
       
   292     /**
       
   293      * Contact title formatter.
       
   294      * Not own.
       
   295      */
       
   296     MPbk2ContactNameFormatter& iNameFormatter;
       
   297     
       
   298     /**
       
   299      * Thumbnails field, if any
       
   300      * Not own.
       
   301      */
       
   302     const MVPbkFieldType* iThumbnailField;
       
   303 
       
   304     /**
       
   305     * All DTMF numbers in array. Owned.
       
   306     */
       
   307     CDesCArray* iAllDtmfNumbers;
       
   308     };
       
   309 
       
   310 #endif // CPHCNTCONTACTFIELDSRESOLVER_H