phonebookui/Phonebook2/ServerApplication/inc/CPbk2CommAddressSelectPhase.h
changeset 0 e686773b3f54
child 8 5586b4d2ec3e
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     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:  Phonebook 2 server app address select phase.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPBK2COMMADDRESSSELECTPHASE_H
       
    20 #define CPBK2COMMADDRESSSELECTPHASE_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <badesca.h>
       
    24 #include <e32base.h>
       
    25 #include <MVPbkSingleContactOperationObserver.h>
       
    26 #include <MPbk2KeyEventHandler.h>
       
    27 #include "MPbk2ServicePhase.h"
       
    28 #include <VPbkFieldTypeSelectorFactory.h>
       
    29 #include <MVPbkOperationObserver.h>
       
    30 #include <mcontactpresenceobs.h>
       
    31 #include <MVPbkContactStoreObserver.h>
       
    32 
       
    33 // FORWARD DECLARATIONS
       
    34 class MVPbkContactLink;
       
    35 class CVPbkContactLinkArray;
       
    36 class MPbk2DialogEliminator;
       
    37 class MPbk2ServicePhaseObserver;
       
    38 class MVPbkContactOperationBase;
       
    39 class RVPbkContactFieldDefaultPriorities;
       
    40 class MVPbkStoreContact;
       
    41 class MVPbkStoreContactField;
       
    42 class CPbk2KeyEventDealer;
       
    43 class CEikonEnv;
       
    44 class CVPbkxSPContacts;
       
    45 class MContactPresence;
       
    46 class CPbk2PresenceIconInfo;
       
    47 
       
    48 // CLASS DECLARATION
       
    49 
       
    50 /**
       
    51  * Phonebook 2 server app address select phase.
       
    52  * Responsible for performing address select.
       
    53  */
       
    54 class CPbk2CommAddressSelectPhase : public CBase,
       
    55                     public MPbk2ServicePhase,
       
    56                     private MVPbkSingleContactOperationObserver,
       
    57                     private MPbk2KeyEventHandler,
       
    58                     public MVPbkOperationErrorObserver,
       
    59                     public MVPbkOperationResultObserver<MVPbkContactLinkArray*>,
       
    60                     public MContactPresenceObs,
       
    61                     public MVPbkContactStoreObserver
       
    62     {
       
    63     private:
       
    64         
       
    65         enum TState
       
    66             {
       
    67             EMainContactRetrieving,
       
    68             ExSPLinksRetrieving,
       
    69             ExSPContactsRetrieving,
       
    70             EWaitForPresenceIcons,
       
    71             EDialogWaitsUserInput
       
    72             };
       
    73      
       
    74     public: // Construction
       
    75 
       
    76         /**
       
    77          * Creates a new instance of this class.
       
    78          *
       
    79          * @param aObserver          Observer.
       
    80          * @param aContactLink       Contact link.
       
    81          * @param aPriorities        Address select default priorities.
       
    82          * @param aFieldTypeSelector Field type selector.
       
    83          * @param aCommSelector      Enum value for field type selector.
       
    84          * @param aRskBack           Indicates whether the RSK should be Back.
       
    85          * @return  A new instance of this class.
       
    86          */
       
    87         static CPbk2CommAddressSelectPhase* NewL(
       
    88                 MPbk2ServicePhaseObserver& aObserver,
       
    89                 const MVPbkContactLink& aContactLink,
       
    90                 RVPbkContactFieldDefaultPriorities& aPriorities,
       
    91                 CVPbkFieldTypeSelector& aFieldTypeSelector,
       
    92                 VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector
       
    93                     aCommSelector,
       
    94                 TBool aRskBack );
       
    95 
       
    96         /**
       
    97          * Destructor.
       
    98          */
       
    99         ~CPbk2CommAddressSelectPhase();
       
   100 
       
   101     public: // From MPbk2ServicePhase
       
   102         void LaunchServicePhaseL();
       
   103         void CancelServicePhase();
       
   104         void RequestCancelL(
       
   105                 TInt aExitCommandId );
       
   106         void AcceptDelayedL(
       
   107                 const TDesC8& aContactLinkBuffer );
       
   108         MVPbkContactLinkArray* Results() const;
       
   109         TInt ExtraResultData() const;
       
   110         MVPbkStoreContact* TakeStoreContact();
       
   111         HBufC* FieldContent() const;
       
   112 
       
   113     public: // From MVPbkSingleContactOperationObserver
       
   114         void VPbkSingleContactOperationComplete(
       
   115                 MVPbkContactOperationBase& aOperation,
       
   116                 MVPbkStoreContact* aContact );
       
   117         void VPbkSingleContactOperationFailed(
       
   118                 MVPbkContactOperationBase& aOperation,
       
   119                 TInt aError );
       
   120 
       
   121     private: // From MPbk2KeyEventHandler
       
   122         TBool Pbk2ProcessKeyEventL(
       
   123                 const TKeyEvent& aKeyEvent,
       
   124                 TEventCode aType );
       
   125                 
       
   126     public: // From MVPbkOperationErrorObserver
       
   127         void VPbkOperationFailed( MVPbkContactOperationBase* aOperation,
       
   128             TInt aError );
       
   129     
       
   130     public: // From MVPbkOperationResultObserver
       
   131         void VPbkOperationResultCompleted(
       
   132             MVPbkContactOperationBase* aOperation,
       
   133             MVPbkContactLinkArray* aArray );
       
   134     
       
   135     public: //From MContactPresenceObs
       
   136     
       
   137         void ReceiveIconInfoL(
       
   138             const TDesC8& aPackedLink,
       
   139             const TDesC8& aBrandId,
       
   140             const TDesC8& aElementId );
       
   141 
       
   142         void ReceiveIconFileL(
       
   143             const TDesC8& aBrandId,
       
   144             const TDesC8& aElementId,
       
   145             CFbsBitmap* aBrandedBitmap,
       
   146             CFbsBitmap* aMask );
       
   147               
       
   148         void PresenceSubscribeError(
       
   149             const TDesC8& aPackedLink,
       
   150             TInt aStatus );
       
   151 
       
   152         void ErrorOccured(
       
   153             TInt aOpId,
       
   154             TInt aStatus );
       
   155         
       
   156         void ReceiveIconInfosL(
       
   157             const TDesC8& aPackedLink,
       
   158             RPointerArray <MContactPresenceInfo>& aInfoArray,
       
   159             TInt aOpId ); 
       
   160         
       
   161     private: // From MVPbkContactStoreObserver 
       
   162         void StoreReady(
       
   163                 MVPbkContactStore& aContactStore );
       
   164         void StoreUnavailable(
       
   165                 MVPbkContactStore& aContactStore,
       
   166                 TInt aReason );
       
   167         void HandleStoreEventL(
       
   168                 MVPbkContactStore& aContactStore,
       
   169                 TVPbkContactStoreEvent aEvent );
       
   170         
       
   171     private: // Implementation
       
   172         CPbk2CommAddressSelectPhase(
       
   173                 MPbk2ServicePhaseObserver& aObserver,
       
   174                 RVPbkContactFieldDefaultPriorities& aPriorities,                
       
   175                 TBool aRskBack,
       
   176                 CVPbkFieldTypeSelector& aFieldTypeSelector,
       
   177                 VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector
       
   178                     aCommSelector );
       
   179         void ConstructL(
       
   180                 const MVPbkContactLink& aContactLink );
       
   181         void RetrieveContactL();
       
   182         void DoSelectAddressesL();
       
   183         TInt CorrectRSK(
       
   184                 TInt aAddressSelectResourceId );
       
   185         void AppendResultL(
       
   186                 const MVPbkStoreContactField* aField );
       
   187         void GetImppFieldDataL(CDesC16ArrayFlat & aXspIdArray, 
       
   188                 MVPbkStoreContact& aContact );
       
   189         void FilterXspContactsL();
       
   190         TBool IsMatchL( MVPbkStoreContact& aXspContact, 
       
   191                 MVPbkStoreContact& aStoreContact );
       
   192     
       
   193     private: // Data
       
   194         /// Ref: Observer
       
   195         MPbk2ServicePhaseObserver& iObserver;
       
   196         /// Own: Contact links
       
   197         MVPbkContactLink* iContactLink;
       
   198         /// Own: Results array
       
   199         CVPbkContactLinkArray* iResults;
       
   200         /// Ref: Address select default priorities
       
   201         RVPbkContactFieldDefaultPriorities& iPriorities;
       
   202         /// Own: Address select resource id
       
   203         TInt iResourceId;
       
   204         /// Own: Indicates whether the RSK should be Back
       
   205         TBool iRskBack;
       
   206         /// Ref: For address select dialog's exit handling
       
   207         MPbk2DialogEliminator* iAddressSelectEliminator;
       
   208         /// Own: Contact retrieve operation
       
   209         MVPbkContactOperationBase* iRetrieveOperation;
       
   210         /// Own: Store contact
       
   211         MVPbkStoreContact* iStoreContact;
       
   212         /// Own: Key event dealer
       
   213         CPbk2KeyEventDealer* iDealer;
       
   214         /// Own: Title resource id
       
   215         TInt iTitleResId;
       
   216         /// Ref: Eikon enviroment
       
   217         CEikonEnv* iEikenv;
       
   218         /// Ref: Field type selector
       
   219         CVPbkFieldTypeSelector& iFieldTypeSelector;
       
   220         /// Own: xSP stores interface
       
   221         CVPbkxSPContacts* ixSPManager;
       
   222         /// Own: xSP contact retrieve operation
       
   223         MVPbkContactOperationBase* ixSPContactOperation;
       
   224         /// Own: xSP contacts array
       
   225         CVPbkContactLinkArray* ixSPContactsArray;
       
   226         /// Own: xSP store contacts array
       
   227         RPointerArray<MVPbkStoreContact> ixSPStoreContactsArray;
       
   228         /// Own: state
       
   229         TState iState;
       
   230         /// Own: content of the selected field
       
   231         HBufC* iFieldContent;
       
   232         /// Own: contact presence manager
       
   233         MContactPresence* iContactPresence;
       
   234         /// Own: array of presence icons
       
   235         RPointerArray<CPbk2PresenceIconInfo> iPresenceIconArray;
       
   236         /// Own: ETrue, if presence icon has been retrieved
       
   237         TBool iPresenceIconsRetrieved;
       
   238         /// Own: Communication method
       
   239         VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector iCommMethod;
       
   240     };
       
   241 
       
   242 #endif // CPBK2COMMADDRESSSELECTPHASE_H
       
   243 
       
   244 // End of File