phoneapp/phoneuiview/inc/cphonequerycontroller.h
changeset 0 5f000ab63145
equal deleted inserted replaced
-1:000000000000 0:5f000ab63145
       
     1 /*
       
     2 * Copyright (c) 2005 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:  PhoneUI Query Controller
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPHONEQUERYCONTROLLER_H
       
    20 #define CPHONEQUERYCONTROLLER_H
       
    21 
       
    22 
       
    23 
       
    24 //  INCLUDES
       
    25 #include "cphonetextquery.h"
       
    26 #include "mphonequeryobserver.h"
       
    27 #include "mphonetimer.h"
       
    28 #include "tphonecmdparamquery.h"
       
    29 
       
    30 // DATA TYPES
       
    31 enum TPhoneAvkonQueryType
       
    32     {
       
    33     EPhoneAvkonNone,
       
    34     EPhoneAvkonGlobalConfirmation,
       
    35     EPhoneAvkonGlobalList
       
    36     };
       
    37 
       
    38 // FORWARD DECLARATIONS
       
    39 class TPhoneCommandParam;
       
    40 class CAknGlobalConfirmationQuery;
       
    41 class CPhoneQueryDialog;
       
    42 class CPhoneDtmfNumberListQuery;
       
    43 class CPhoneListQueryDialog;
       
    44 class CCaUiReconnectQuery;
       
    45 class CPhoneTimer;
       
    46 class CAknGlobalMsgQuery;
       
    47 class CAknGlobalNote;
       
    48 
       
    49 class CPhoneQueryController :
       
    50     public CActive,
       
    51     public MEikCommandObserver,
       
    52     public MPhoneQueryObserver,
       
    53     protected MPhoneTimer
       
    54     {
       
    55     public:  // Constructors and destructor
       
    56 
       
    57         /**
       
    58         * Two-phased constructor.
       
    59         */
       
    60         static CPhoneQueryController* NewL( CEikonEnv& aEikEnv );
       
    61 
       
    62         /**
       
    63         * Destructor.
       
    64         */
       
    65         virtual ~CPhoneQueryController();   
       
    66 
       
    67         /**
       
    68         * Creates query dialog from the given command parameter
       
    69         * @param aCommandParam command parameter holding data for
       
    70         * populating the needed query dialog.
       
    71         */
       
    72         void CreateQueryL( TPhoneCommandParam* aCommandParam );
       
    73 
       
    74         /**
       
    75         * Destructs all existing query dialogs except global.
       
    76         */
       
    77         void DestroyQuery();
       
    78         
       
    79         /**
       
    80         * Destructs global query dialog.
       
    81         */
       
    82         void DestroyGlobalQuery();
       
    83 
       
    84         /**
       
    85         * Destroys global wait note
       
    86         */
       
    87         void DestroyGlobalWaitNote();
       
    88 
       
    89         /**
       
    90         * Fetches query dialog's content
       
    91         * @param aCommandParam pointer where content will be written
       
    92         */
       
    93         void GetTextQueryContentL( TPhoneCommandParam* aCommandParam );
       
    94 
       
    95         /**
       
    96         * Set by the query when it is asynchronously deleted.
       
    97         * @param aQueryDeleted ETrue if the query is deleted
       
    98         */
       
    99         void SetQueryDeletedFlag( TBool aQueryDeleted ); 
       
   100         
       
   101         /**
       
   102         * Get active status of queries
       
   103         * @param aCommandParam command parameter
       
   104         */
       
   105         void IsQueryActive( TPhoneCommandParam* aCommandParam );
       
   106         
       
   107         /**
       
   108         * Sets string for List query dialog
       
   109         * @param aCommandParam command parameter
       
   110         */
       
   111         void SetListQueryStringL( TPhoneCommandParam* aCommandParam );
       
   112     
       
   113         /**
       
   114         * Reports query dialog's exit
       
   115         * @param aCommand user selected action.
       
   116         */        
       
   117         void ReportQueryCompleteAsync( TInt aCommand );
       
   118         
       
   119         /**
       
   120         * Check if dtmf test query or dtmf dialog is visible.
       
   121         */        
       
   122         TBool IsDTMFQueryVisible();
       
   123         
       
   124         /**
       
   125         * Sets member variable NoConnectedCalls value.
       
   126         */ 
       
   127         void SetNoConnectedCalls( TPhoneCommandParam* aCommandParam );
       
   128 
       
   129     protected: // from CActive
       
   130 
       
   131         /**
       
   132         * See CActive documentation.
       
   133         */  
       
   134         void RunL();
       
   135     
       
   136         /**
       
   137         * See CActive documentation.
       
   138         */
       
   139         TInt RunError( TInt aError );
       
   140 
       
   141         /**
       
   142         * See CActive documentation.
       
   143         */    
       
   144         void DoCancel();
       
   145         
       
   146         /**
       
   147         * @see CPhoneTimer, handles timeout.
       
   148         */
       
   149         virtual void HandleTimeOutL();        
       
   150  
       
   151         /**
       
   152         * @see MEikCommandObserver
       
   153         */
       
   154         void ProcessCommandL( TInt aCommandId );
       
   155     private:  // Constructors
       
   156         
       
   157         /**
       
   158         * C++ default constructor.
       
   159         */
       
   160         CPhoneQueryController( CEikonEnv& aEikEnv );
       
   161 
       
   162         /**
       
   163         * Creates query dialog
       
   164         * @param aParams a TPhoneCmdParamQuery holding the parameters for the query
       
   165         */
       
   166         void CreateQueryDialogL( 
       
   167             const TPhoneCmdParamQuery& aParams );
       
   168         
       
   169         /**
       
   170         * Creates text query dialog
       
   171         * @param aParams a TPhoneCmdParamQuery holding the parameters for the query
       
   172         */            
       
   173         void CreateTextQueryDialogL( 
       
   174             const TPhoneCmdParamQuery& aParams,
       
   175             TInt aOkButtonCmd = EEikBidOk );              
       
   176         
       
   177         /*
       
   178         * Generates DTMF list query.
       
   179 		* @param aDialogResourceId -Id of the list query to be loaded
       
   180         */
       
   181         void CreateDtmfListQueryL( TInt aDialogResourceId );
       
   182         
       
   183         /*
       
   184         * Generates list query.
       
   185 		* @param aDialogResourceId -Id of the list query to be loaded
       
   186         */
       
   187         void CreateListQueryL( TInt aDialogResourceId, const RArray<TInt>& aCommands );
       
   188 
       
   189         /*
       
   190         * Generates custom list query.
       
   191         * @param aDialogResourceId -Id of the list query to be loaded
       
   192         * @param aItemTextArray Text array for list items.
       
   193         * @param aTone Query tone.
       
   194         */
       
   195         void CreateCustomListQueryL( const TPhoneCmdParamQuery& aParams );
       
   196         
       
   197         /**
       
   198         * Creates the default query.
       
   199         * @param aParams ommand parameter holding data for
       
   200         * populating the needed query dialog.
       
   201         */    
       
   202         void CreateDefaultQueryL( const TPhoneCmdParamQuery& aParams );
       
   203         
       
   204         /**
       
   205         * Creates the reconnect query.
       
   206         * @param aParams ommand parameter holding data for
       
   207         * populating the needed query dialog.
       
   208         */
       
   209         void CreateReconnectQueryL( TPhoneCommandParam* aCommandParam );
       
   210                 
       
   211         /**
       
   212         * Creates the global query.
       
   213         * @param aParams a TPhoneCmdParamQuery holding the parameters for the query
       
   214         */        
       
   215         void CreateGlobalQueryDialogL( const TPhoneCmdParamQuery& aParams ); 
       
   216 
       
   217         /**
       
   218         * Callback function that CIdle calls when we are using Text Query Dialog.
       
   219         * This method displayes the actual query.
       
   220         * @param aCPhoneQueryController - pointer to itself
       
   221         * @return KErrNone
       
   222         */
       
   223         static TInt DisplayTextQueryCallBack( TAny* aCPhoneQueryController );
       
   224         
       
   225         /**
       
   226         * Clear timer used in global query
       
   227         */
       
   228         void ClearTimer();
       
   229  
       
   230         /**
       
   231          * Creates global message query dialog.
       
   232          * @param aParams a TPhoneCmdParamQuery holding the parameters for the query
       
   233          */    
       
   234         void CreateGlobalMsgQueryL( const TPhoneCmdParamQuery& aParams );
       
   235         
       
   236         /**
       
   237          * Destroys global message query.
       
   238          */
       
   239         void DestroyGlobalMsgQuery();
       
   240 
       
   241         /**
       
   242          * Creates global wait note.
       
   243          * @param aParams a TPhoneCmdParamQuery holding the parameters for the query
       
   244          */     
       
   245         void CreateGlobalWaitNoteL( const TPhoneCmdParamQuery& aParams );
       
   246        
       
   247         /**
       
   248         * Callback function that CIdle calls when we are handling process command.
       
   249         * This method forwards the actual command
       
   250         * @param aCPhoneQueryController - pointer to itself
       
   251         * @return KErrNone
       
   252         */
       
   253         static TInt ProcessCommandCallBack( TAny* aCPhoneQueryController );
       
   254         
       
   255     private:  // Data
       
   256 
       
   257         /**
       
   258         * Query dialog
       
   259         */
       
   260         CPhoneQueryDialog* iQuery;
       
   261         
       
   262         /**
       
   263         * Text query dialog
       
   264         */
       
   265         CPhoneTextQuery* iTextQuery;
       
   266         
       
   267         /**
       
   268         * DTMF number list query
       
   269         */
       
   270         CPhoneDtmfNumberListQuery* iDtmfNumberListQuery;
       
   271         
       
   272         CPhoneListQueryDialog* iListQuery;        
       
   273 
       
   274         /**
       
   275         * ETrue when the query is asynchronously deleted
       
   276         */
       
   277         TBool iQueryDeleted;
       
   278         
       
   279         /**
       
   280         * Call UI reconnect query.
       
   281         */
       
   282         CCaUiReconnectQuery* iCallUiReconnectQuery;
       
   283         
       
   284         // Eikon environment delivered from CPhoneViewController
       
   285         CEikonEnv& iEikEnv;
       
   286         
       
   287         // Query dialog's text. Stored here for async operations.
       
   288         RBuf iQueryNoteText;
       
   289         // Prompt for queries. Stored here for async operations.
       
   290         RBuf iQueryPrompt;
       
   291         
       
   292         // Query dialog's text. Stored here for async operations.
       
   293         // Needed if query has been deleted before content get 
       
   294         RBuf iQueryPreviousText;
       
   295         
       
   296         // Command for queries. Stored here for async operations.
       
   297         TInt iCommandId;
       
   298         
       
   299         // Waitnote text
       
   300         RBuf iWaitNoteText;
       
   301             
       
   302         // Global confirmation query.
       
   303         CAknGlobalConfirmationQuery* iGlobalConfirmationQuery;
       
   304  
       
   305  		// Currently active avkon query type
       
   306  		TInt iActiveAvkonQuery;
       
   307  	    
       
   308  	    /**
       
   309         * Status of VideoCallSetupFailedQuery
       
   310         */
       
   311         TBool iVideoCallSetupFailedQuery;
       
   312         
       
   313         /**
       
   314         * Status of transfer acceptance query.
       
   315         */
       
   316         TBool iTransferAcceptanceQuery;
       
   317         
       
   318         // Displaying a Text Query is a blocking synchronous call and we want to give
       
   319         // run time for other Phone stuff so CIdle object is used to let us do that.
       
   320         // Owned.
       
   321         CIdle *iTextQueryDisplayer;
       
   322                 
       
   323         // Asynchronous call for process command
       
   324         CIdle *iCommandAsync;
       
   325         
       
   326         // Contains selected DTMF string from dtmf listquery dialog.
       
   327         HBufC* iResultBuffer;   
       
   328         
       
   329         // Timer.
       
   330         CPhoneTimer* iTimer;
       
   331         
       
   332         /**
       
   333          * Global message query.
       
   334          * Own.
       
   335          */
       
   336         CAknGlobalMsgQuery* iGlobalMsgQuery;
       
   337         
       
   338         /**
       
   339          * Parameter query command object.
       
   340          */
       
   341         TPhoneCmdParamQuery iQueryParam;
       
   342         
       
   343         /**
       
   344         * Global wait note.
       
   345         * Own.
       
   346         */
       
   347         CAknGlobalNote* iGlobalWaitNote;
       
   348 
       
   349         /**
       
   350          * Flag for check is command already handled.
       
   351          */
       
   352         TBool iCommandHandled;
       
   353         
       
   354 		/**
       
   355          * Flag indicating connected calls.
       
   356          */
       
   357         TBool iNoConnectedCalls;
       
   358         
       
   359      };
       
   360 
       
   361 #endif      // CPHONEQUERYCONTROLLER_H   
       
   362             
       
   363 // End of File