phoneapp/phoneuivoipextension/inc/cphonecallforwardqueryhandler.h
changeset 0 5f000ab63145
equal deleted inserted replaced
-1:000000000000 0:5f000ab63145
       
     1 /*
       
     2 * Copyright (c) 2009 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: Handles queries related to call forwarding.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CPHONECALLFORWARDQUERYHANDLER_H
       
    20 #define C_CPHONECALLFORWARDQUERYHANDLER_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <pevirtualengine.h>
       
    24 #include "mphonequerycommandobserver.h"
       
    25 
       
    26 class MPhoneStateMachine;
       
    27 class MPhoneViewCommandHandle;
       
    28 class CPhoneStateUtilsVoip;
       
    29 
       
    30 /**
       
    31  *  Handles queries related to call forwarding.
       
    32  *
       
    33  *  @lib PhoneUIVoIPExtension.dll
       
    34  *  @since S60 v5.1
       
    35  */
       
    36 NONSHARABLE_CLASS( CPhoneCallForwardQueryHandler ) : 
       
    37         public CBase,
       
    38         public MPhoneQueryCommandObserver
       
    39     {
       
    40 
       
    41 public:
       
    42 
       
    43     /**
       
    44      * Enum for query types.
       
    45      */
       
    46     enum TQueryType
       
    47         {
       
    48         EPhoneQueryNotSet,
       
    49         EPhoneQueryAddToContacts,
       
    50         EPhoneMovedPermanently,
       
    51         EPhoneMultipleChoices
       
    52         };
       
    53     
       
    54     /**
       
    55      * Two-phased constructor.
       
    56      * @param    aStateMachine       Handle to the state machine.
       
    57      * @param    aViewCommandHandle  Handle to the PhoneUIView.
       
    58      */
       
    59     static CPhoneCallForwardQueryHandler* NewL( 
       
    60         MPhoneStateMachine& aStateMachine,
       
    61         MPhoneViewCommandHandle& aViewCommandHandle );
       
    62 
       
    63     /**
       
    64      * Two-phased constructor.
       
    65      * @param    aStateMachine       Handle to the state machine.
       
    66      * @param    aViewCommandHandle  Handle to the PhoneUIView.
       
    67      */
       
    68     static CPhoneCallForwardQueryHandler* NewLC( 
       
    69         MPhoneStateMachine& aStateMachine,
       
    70         MPhoneViewCommandHandle& aViewCommandHandle );
       
    71     
       
    72     /**
       
    73      * Destructor.
       
    74      */
       
    75     virtual ~CPhoneCallForwardQueryHandler();
       
    76 
       
    77     /**
       
    78      * Shows moved permanently query. 
       
    79      * @param aCallId Id of the call
       
    80      */
       
    81     void ShowMovedPermanentlyQueryL( TInt aCallId );
       
    82  
       
    83     /**
       
    84      * Shows multiple choices query. 
       
    85      * @param aCallId Id of the call
       
    86      */
       
    87     void ShowMultipleChoicesQueryL( TInt aCallId );
       
    88 
       
    89 protected:
       
    90     
       
    91 // From MPhoneQueryCommandObserver
       
    92     /**
       
    93      * Processes query commands
       
    94      * @param aCommandId A command id.
       
    95      */
       
    96     void ProcessCommandL( TInt aCommandId  );
       
    97     
       
    98 private:
       
    99 
       
   100     CPhoneCallForwardQueryHandler(         
       
   101         MPhoneStateMachine& aStateMachine,
       
   102         MPhoneViewCommandHandle& aViewCommandHandle );
       
   103 
       
   104     void ConstructL();
       
   105      
       
   106     /**
       
   107      * Adds string to contacts.
       
   108      * @param aCreateNew ETrue creates new contact,
       
   109      *                   EFalse updates exiting contact. 
       
   110      */
       
   111     void AddToContacsL( TBool aCreateNew );
       
   112           
       
   113     /**
       
   114      * Saves address to contacts.
       
   115      */
       
   116     void SaveAddressToContactsL();
       
   117 
       
   118     /**
       
   119      * Shows call is being forwarded information note.
       
   120      */
       
   121     void ShowCallForwardedNoteL();
       
   122  
       
   123     /**
       
   124      * Resets multiple choices item text array.
       
   125      * @param aAddressArray New items for array.
       
   126      */
       
   127     void ResetMultipleChoicesArrayL(
       
   128             const MDesC8Array& aAddressArray );
       
   129 
       
   130     /**
       
   131      * Shows info note "Call is being forwarded" and starts
       
   132      * call forward to selected address.
       
   133      * @param aIndex Array index for address where call is being
       
   134      *               forwarded.
       
   135      */
       
   136     void ForwardCallToAddressL( TInt aIndex );
       
   137     
       
   138 private: // data
       
   139 
       
   140     /**
       
   141      * Interface to the state machine.
       
   142      * Not own.
       
   143      */
       
   144     MPhoneStateMachine& iStateMachine;
       
   145     
       
   146     /**
       
   147      * Interface to the phone ui view.
       
   148      * Not own.
       
   149      */
       
   150     MPhoneViewCommandHandle& iViewCommandHandle;
       
   151     
       
   152     /**
       
   153      * Address array.
       
   154      * Not own.
       
   155      */
       
   156     const CDesC8Array* iAddressArray;
       
   157 
       
   158     /**
       
   159      * Address array.
       
   160      * Own.
       
   161      */
       
   162     CDesC16ArrayFlat* iMultipleChoicesArray;
       
   163     
       
   164     /**
       
   165      * Call id
       
   166      */
       
   167     TInt iCallId;
       
   168     
       
   169     /**
       
   170      * Query type
       
   171      */
       
   172     TInt iQueryType;
       
   173 
       
   174     /**
       
   175      * Flag to check is command already processed.
       
   176      */
       
   177     TBool iCommandProcessed;
       
   178     };
       
   179 
       
   180 
       
   181 #endif // C_CPHONECALLFORWARDQUERYHANDLER_H