phonebookui/Phonebook2/ServerApplication/inc/CPbk2AddressSelectPhase.h
branchRCL_3
changeset 63 f4a778e096c2
child 64 c1e8ba0c2b16
child 85 38bb213f60ba
equal deleted inserted replaced
62:5b6f26637ad3 63:f4a778e096c2
       
     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 CPBK2ADDRESSSELECTPHASE_H
       
    20 #define CPBK2ADDRESSSELECTPHASE_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <MVPbkSingleContactOperationObserver.h>
       
    25 #include <MPbk2KeyEventHandler.h>
       
    26 #include "MPbk2ServicePhase.h"
       
    27 #include <AiwContactSelectionDataTypes.h>
       
    28 #include <MVPbkContactStoreObserver.h>
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class CVPbkContactLinkArray;
       
    32 class MPbk2DialogEliminator;
       
    33 class MPbk2ServicePhaseObserver;
       
    34 class MVPbkContactOperationBase;
       
    35 class RVPbkContactFieldDefaultPriorities;
       
    36 class MVPbkStoreContact;
       
    37 class MVPbkStoreContactField;
       
    38 class CPbk2KeyEventDealer;
       
    39 class CEikonEnv;
       
    40 
       
    41 // CLASS DECLARATION
       
    42 
       
    43 /**
       
    44  * Phonebook 2 server app address select phase.
       
    45  * Responsible for performing address select.
       
    46  */
       
    47 class CPbk2AddressSelectPhase : public CBase,
       
    48                                 public MPbk2ServicePhase,
       
    49                                 private MVPbkSingleContactOperationObserver,
       
    50                                 private MPbk2KeyEventHandler,
       
    51                                 public MVPbkContactStoreObserver
       
    52     {
       
    53     public: // Construction
       
    54 
       
    55         /**
       
    56          * Creates a new instance of this class.
       
    57          *
       
    58          * @param aObserver         Observer.
       
    59          * @param aContactLinks     Contact links.
       
    60          * @param aPriorities       Address select default priorities.
       
    61          * @param aAddressSelectType       Address select type.
       
    62          * @param aRskBack          Indicates whether the RSK should be Back.
       
    63          * @return  A new instance of this class.
       
    64          */
       
    65         static CPbk2AddressSelectPhase* NewL(
       
    66                 MPbk2ServicePhaseObserver& aObserver,
       
    67                 MVPbkContactLinkArray& aContactLinks,
       
    68                 RVPbkContactFieldDefaultPriorities& aPriorities,
       
    69                 TAiwAddressSelectType aAddressSelectType,
       
    70                 TBool aRskBack );
       
    71 
       
    72         /**
       
    73          * Destructor.
       
    74          */
       
    75         ~CPbk2AddressSelectPhase();
       
    76 
       
    77     public: // From MPbk2ServicePhase
       
    78         void LaunchServicePhaseL();
       
    79         void CancelServicePhase();
       
    80         void RequestCancelL(
       
    81                 TInt aExitCommandId );
       
    82         void AcceptDelayedL(
       
    83                 const TDesC8& aContactLinkBuffer );
       
    84         void DenyDelayedL(
       
    85                 const TDesC8& aContactLinkBuffer );
       
    86         MVPbkContactLinkArray* Results() const;
       
    87         TInt ExtraResultData() const;
       
    88         MVPbkStoreContact* TakeStoreContact();
       
    89         HBufC* FieldContent() const;
       
    90 
       
    91     public: // From MVPbkSingleContactOperationObserver
       
    92         void VPbkSingleContactOperationComplete(
       
    93                 MVPbkContactOperationBase& aOperation,
       
    94                 MVPbkStoreContact* aContact );
       
    95         void VPbkSingleContactOperationFailed(
       
    96                 MVPbkContactOperationBase& aOperation,
       
    97                 TInt aError );
       
    98 
       
    99     private: // From MPbk2KeyEventHandler
       
   100         TBool Pbk2ProcessKeyEventL(
       
   101                 const TKeyEvent& aKeyEvent,
       
   102                 TEventCode aType );
       
   103                 
       
   104     private: // From MVPbkContactStoreObserver
       
   105         void StoreReady(
       
   106                 MVPbkContactStore& aContactStore );
       
   107         void StoreUnavailable(
       
   108                 MVPbkContactStore& aContactStore,
       
   109                 TInt aReason );
       
   110         void HandleStoreEventL(
       
   111                 MVPbkContactStore& aContactStore,
       
   112                 TVPbkContactStoreEvent aEvent );
       
   113 
       
   114     private: // Implementation
       
   115         CPbk2AddressSelectPhase(
       
   116                 MPbk2ServicePhaseObserver& aObserver,
       
   117                 RVPbkContactFieldDefaultPriorities& aPriorities,                
       
   118                 TBool aRskBack );
       
   119         void ConstructL(
       
   120                 MVPbkContactLinkArray& aContactLinks,
       
   121                 TAiwAddressSelectType aAddressSelectType );
       
   122         void RetrieveContactL();
       
   123         void DoSelectAddressesL();
       
   124         TInt CorrectRSK(
       
   125                 TInt aAddressSelectResourceId );
       
   126         MVPbkStoreContactField* CheckIfFieldAlreadySelectedLC();
       
   127         void AddFieldToResultsAndContinueL(
       
   128                 MVPbkStoreContactField* aField );
       
   129         void AppendResultL(
       
   130                 const MVPbkStoreContactField* aField );
       
   131         TInt AddressSelectResourceId(
       
   132                 TAiwAddressSelectType aType );                
       
   133 
       
   134     private: // Data
       
   135         /// Ref: Observer
       
   136         MPbk2ServicePhaseObserver& iObserver;
       
   137         /// Own: Contact links
       
   138         CVPbkContactLinkArray* iContactLinks;
       
   139         /// Own: Results array
       
   140         CVPbkContactLinkArray* iResults;
       
   141         /// Ref: Address select default priorities
       
   142         RVPbkContactFieldDefaultPriorities& iPriorities;
       
   143         /// Own: Address select resource id
       
   144         TInt iResourceId;
       
   145         /// Own: Indicates whether the RSK should be Back
       
   146         TBool iRskBack;
       
   147         /// Ref: For address select dialog's exit handling
       
   148         MPbk2DialogEliminator* iAddressSelectEliminator;
       
   149         /// Own: Contact retrieve operation
       
   150         MVPbkContactOperationBase* iRetrieveOperation;
       
   151         /// Own: Store contact
       
   152         MVPbkStoreContact* iStoreContact;
       
   153         /// Own: Key event dealer
       
   154         CPbk2KeyEventDealer* iDealer;
       
   155         /// Own: Title resource id
       
   156         TInt iTitleResId;
       
   157         /// Ref: Eikon enviroment
       
   158         CEikonEnv* iEikenv;
       
   159         ///Bool to denote whether the Current Obj has been deleted or not
       
   160 		///Doesnt Own
       
   161         TBool *iThisPtrDestroyed;
       
   162     };
       
   163 
       
   164 #endif // CPBK2ADDRESSSELECTPHASE_H
       
   165 
       
   166 // End of File