mmsharing/mmshavailability/inc/musavacontactavailability.h
changeset 15 ccd8e69b5392
parent 2 b31261fd4e04
child 20 e8be2c2e049d
child 22 496ad160a278
equal deleted inserted replaced
2:b31261fd4e04 15:ccd8e69b5392
     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:  Provide interface for the client requestin network availability.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __MUSAVACONTACTAVAILABILITY_H__
       
    20 #define __MUSAVACONTACTAVAILABILITY_H__
       
    21 
       
    22 #include "musavaavailability.h"
       
    23 #include "musunittesting.h"
       
    24 #include "mussettingskeys.h"
       
    25 #include "muscallmonitorobserver.h"
       
    26 #include <badesca.h>
       
    27 #include <PbkFields.hrh>
       
    28 
       
    29 class MMusAvaAvailabilityObserver;
       
    30 class MMusAvaObserver;
       
    31 class CMusAvaSharedObject;
       
    32 class CPbkContactEngine;
       
    33 class CContactIdArray;
       
    34 class CPbkContactItem;
       
    35 class CContactItem;
       
    36 class CMusAvaSettingsImp;
       
    37 class CMusAvaCallEventMonitor;
       
    38 
       
    39 /**
       
    40  *  Implemets register vailability.
       
    41  *
       
    42  *  Provide interface for the client to availability class.
       
    43  *
       
    44  *  @lib musavailabilityplugin.lib
       
    45  */
       
    46 class CMusAvaContactAvailability : public CMusAvaAvailability,
       
    47 								   public MMusCallMonitorObserver
       
    48 	{
       
    49 
       
    50 public:
       
    51 
       
    52 	/**
       
    53      * Two-phased constructor.
       
    54      *
       
    55      * @param aObserver Pointer to observer interface.
       
    56      * @param aSettings Reference to settings object.
       
    57      * @return Returns pointer to CMusAvaInterface object.
       
    58      */
       
    59 	static CMusAvaContactAvailability* NewL(
       
    60 	                                MMusAvaAvailabilityObserver& aObserver,
       
    61                                     CMusAvaSettingsImp& aConcreteSettings );
       
    62 
       
    63 	/**
       
    64      * Two-phased constructor.
       
    65      *
       
    66      * @param aObserver Pointer to observer interface.
       
    67      * @param aSettings Reference to settings object.
       
    68      * @return Returns pointer to CMusAvaInterface object.
       
    69      */
       
    70 	static CMusAvaContactAvailability* NewLC(
       
    71 	                                MMusAvaAvailabilityObserver& aObserver,
       
    72                                     CMusAvaSettingsImp& aConcreteSettings );
       
    73 
       
    74 	/**
       
    75      * Destructor
       
    76      */
       
    77 	~CMusAvaContactAvailability();
       
    78 
       
    79 
       
    80 protected:
       
    81 
       
    82 	CMusAvaContactAvailability( MMusAvaAvailabilityObserver& aObserver,
       
    83                                 CMusAvaSettingsImp& aConcreteSettings );
       
    84 
       
    85 	void ConstructL();
       
    86 
       
    87 
       
    88 public: // from base class CMusAvaAvailability
       
    89 
       
    90     /**
       
    91      * Executes for the availability.
       
    92      */
       
    93     virtual void DoExecuteL();
       
    94 
       
    95     /**
       
    96      * From CMusAvaAvailability.
       
    97      * Returns availability name.
       
    98      *
       
    99      * @return Name of *this* availability.
       
   100      */
       
   101     virtual MMusAvaObserver::TAvailabilityName Name();
       
   102     // from class MMusCallMonitorObserver
       
   103     /**
       
   104     * Call connected
       
   105     *
       
   106     * @since  S60 v3.2
       
   107     * @return
       
   108     */
       
   109     virtual void CallConnectedL( const TDesC& aTelNumber );
       
   110     
       
   111     /**
       
   112     * Call on hold
       
   113     *
       
   114     * @since  S60 v3.2
       
   115     * @return
       
   116     */
       
   117     virtual void CallHoldL( const TDesC& aTelNumber );
       
   118 
       
   119     /**
       
   120     * Call disconnected
       
   121     *
       
   122     * @since  S60 v3.2
       
   123     * @return
       
   124     */
       
   125     virtual void NoActiveCallL();
       
   126 
       
   127     /**
       
   128     * Call on hold
       
   129     *
       
   130     * @since  S60 v3.2
       
   131     * @return
       
   132     */
       
   133     virtual void ConferenceCallL();
       
   134 
       
   135 private:
       
   136 
       
   137      /**
       
   138      *
       
   139      */
       
   140 	TBool ActiveCallL( CDesCArrayFlat*& aContactsArray );
       
   141 
       
   142      /**
       
   143      *
       
   144      */
       
   145     TBool ContactL( CContactIdArray*& aContactIdArray,
       
   146                     CPbkContactEngine& aPbkContactEngine );
       
   147 
       
   148      /**
       
   149      *
       
   150      */
       
   151     void UpdateContactNameL( CContactItem& aContactItem );
       
   152 
       
   153      /**
       
   154      *
       
   155      */
       
   156     TInt ContactArrayL(  CContactIdArray*& aContactIdArray,
       
   157                          CPbkContactEngine& aPbkContactEngine );
       
   158 
       
   159      /**
       
   160      *
       
   161      */
       
   162     TInt ContactItem( CContactIdArray& aContactIdArray,
       
   163                        CPbkContactItem*& aPbkContactItem,
       
   164                        CPbkContactEngine& aPbkContactEngine );
       
   165 
       
   166     /**
       
   167     *
       
   168     */
       
   169     TBool ContactId( CPbkContactItem& aPbkItem,
       
   170                     TPbkFieldId aTPbkFieldId  );
       
   171     /**
       
   172     *
       
   173     */
       
   174     TPbkFieldId ContactIdSearch( CContactIdArray& aContactIdArray,
       
   175                                   CPbkContactEngine& aPbkContactEngine );
       
   176 
       
   177      /**
       
   178      *
       
   179      */
       
   180     TBool PhoneResolutionL( CPbkContactItem& aPbkItem,
       
   181                             CDesCArrayFlat*& aContactsArray  );
       
   182 
       
   183 
       
   184      /**
       
   185      *
       
   186      */
       
   187     TBool ResolveAddressesL( CPbkContactItem& aPbkItem,
       
   188                              CDesCArrayFlat*& aContactsArray,
       
   189                              TPbkFieldId aTPbkFieldId  );
       
   190 
       
   191      /**
       
   192      *
       
   193      */
       
   194     TBool ResolvePhoneContactL( CPbkContactItem& aPbkItem,
       
   195                                 CDesCArrayFlat*& aContactsArray );
       
   196 
       
   197     /* -------------------------------------------------------------------------
       
   198     *  Checks that whether aDesItem present in aDesArray.
       
   199     *  Utility function used to avoid dublication.
       
   200     * -------------------------------------------------------------------------
       
   201     */
       
   202     TBool IsExistAlready(const MDesCArray& aDesArray,
       
   203                                           const TDesC& aDesItem);
       
   204 
       
   205 private:
       
   206     /**
       
   207     * iPhoneStatus subscribe property resource. When the resource 
       
   208     * changed somewhere,availability will get notification.
       
   209     */
       
   210     CMusAvaCallEventMonitor* iPhoneStatus;
       
   211 
       
   212      /**
       
   213      * resolved contact name
       
   214      */
       
   215      HBufC* iContactName;
       
   216 
       
   217 	 /**
       
   218      * Pointer to CMusAvaSharedObject object
       
   219      */
       
   220 	 CMusAvaSharedObject* iSharedObj;
       
   221 
       
   222 	 CMusAvaSettingsImp& iSettings;
       
   223 	 
       
   224 	 /**
       
   225 	  * Flag indicating if the contact name should begin 
       
   226 	  * with first name or last name
       
   227 	  */
       
   228 	 TBool iBeginWithFirstName;
       
   229 	 
       
   230 	 MusSettingsKeys::TOperatorVariant iOperatorVariant;
       
   231 
       
   232 	 MUS_UNITTEST( UT_CMusAvaContactAvailability )
       
   233     };
       
   234 
       
   235 
       
   236 #endif // __MUSAVACONTACTAVAILABILITY_H__