logsui/AppSrc/CLogsAppUi.h
changeset 0 e686773b3f54
child 18 d4f567ce2e7c
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2002 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: 
       
    15 *     Logs application UI class
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef     __Logs_App_CLogsAppUi_H__
       
    21 #define     __Logs_App_CLogsAppUi_H__
       
    22 
       
    23 //  INCLUDES
       
    24 #include <aknViewAppUi.h>
       
    25 #include <AknTabObserver.h>
       
    26 
       
    27 #include <akntoolbarobserver.h>    
       
    28 #include <akntoolbar.h>  
       
    29 
       
    30 #include "Logs.hrh"
       
    31 
       
    32 // CONSTANTS
       
    33 
       
    34 // MACROS
       
    35 
       
    36 // DATA TYPES
       
    37 
       
    38 // FUNCTION PROTOTYPES
       
    39 
       
    40 // FORWARD DECLARATIONS
       
    41 
       
    42 class CLogsEngine;
       
    43 class CLogsDocument;
       
    44 class CSendUi;
       
    45 class CAiwServiceHandler;
       
    46 
       
    47 // CLASS DECLARATION
       
    48 
       
    49 /**
       
    50  * Logs application UI class. 
       
    51  * An object of this class is created by the Symbian OS framework by a call to 
       
    52  * CLogsDocument::CreateAppUiL(). The application UI object creates and owns
       
    53  * the application's views and handles system commands selected from the menu.
       
    54  */
       
    55 
       
    56 class   CLogsAppUi :    public CAknViewAppUi,
       
    57 						public MAknTabObserver,          
       
    58                         public MAknToolbarObserver,
       
    59                         public MCoeControlObserver                      
       
    60     {
       
    61     public: 
       
    62         /**
       
    63          *  Destructor.
       
    64          */
       
    65         ~CLogsAppUi();
       
    66 
       
    67         /**
       
    68          *  Default constructor.
       
    69          */
       
    70         CLogsAppUi();
       
    71 
       
    72         /**
       
    73          *  Constructor.
       
    74          *
       
    75          *  @param aEngine Logs enegine
       
    76          */
       
    77         CLogsAppUi( CLogsEngine* aEngine );
       
    78 
       
    79     private: 
       
    80          //Constructor, second phase.
       
    81         void ConstructL();
       
    82 
       
    83         //Callback function for CIdle object that calls ConstructDelayedL()
       
    84         static TInt ConstructDelayedCallbackL( TAny* aContainer  );
       
    85         
       
    86         //Performs time consuming construction operations once. 
       
    87         void DoConstructDelayedL();
       
    88         
       
    89     public: // other functions
       
    90 
       
    91         /**
       
    92          *  HandleMessageL. Called by the framework. 
       
    93          */
       
    94         MCoeMessageObserver::TMessageResponse HandleMessageL(TUint32 aClientHandleOfTargetWindowGroup,
       
    95                                                              TUid aMessageUid,
       
    96                                                              const TDesC8& aMessageParameters);
       
    97         /**
       
    98          *  ProcessCommandParametersL. Called by the framework. 
       
    99          *
       
   100          *  IMPORTANT: This command line parameter interface is PRIVATE and may be replaced
       
   101          *  in future with more generic solution. So do not use this unless agreed with Logs
       
   102          *  project.
       
   103          */
       
   104         TBool ProcessCommandParametersL(TApaCommand aCommand,
       
   105                                         TFileName& aDocumentName,
       
   106                                         const TDesC8& aTail);
       
   107 
       
   108         /**
       
   109          * Handles menu commands. Called by the framework. Only application-
       
   110          * wide and system commands are handled here. Use 
       
   111          * CAknView::ProcessCommandL to handle view- and context-specific 
       
   112          * commands.
       
   113          *
       
   114          * @param aCommand  The command code. Codes are defined in Logs.hrh
       
   115          *                  and linked to UI controls (such as menus) in the 
       
   116          *                  resource file Logs.rss.
       
   117          *
       
   118          * @exception anything  thrown during the processing of the command. 
       
   119          *                      The application framework will by default trap
       
   120          *                      and report uncaught exceptions to the user 
       
   121          *                      with a simple pop-up dialog.
       
   122          */
       
   123         void HandleCommandL( TInt aCommand );
       
   124 
       
   125         /**
       
   126          *  Returns the pointer of the engine.
       
   127          *  @return iEngine
       
   128          */
       
   129         CLogsEngine* Engine();
       
   130 
       
   131         /**
       
   132          * TPbkIconId array getter
       
   133          * @return icon id array
       
   134          */
       
   135         //Not in use anymore, Phonebook icons replaced by own icons 
       
   136         //CArrayFix<TPbkIconId>* IconIdArray();
       
   137 
       
   138         /**
       
   139          * Icon info container getter
       
   140          * @return icon info container
       
   141          */
       
   142         //Not in use anymore, Phonebook icons replaced by own icons 
       
   143         //CPbkIconInfoContainer* IconInfoContainer();
       
   144 
       
   145 
       
   146         /*
       
   147          * Activate view
       
   148          * @param aView to activate, will create view if it 
       
   149          *              doesn't exist.
       
   150          */
       
   151         void ActivateLogsViewL( TLogsViewIds aView );
       
   152 
       
   153 		/*
       
   154          * Activate view
       
   155          * @param aView to activate, will create view if it 
       
   156          *              doesn't exist.
       
   157 		 * @param aCustomMessageId id of a custom message sent 
       
   158 		 *                         with view activation
       
   159 		 * @param aCustomMessage   a custom message sent
       
   160 		 *                         with view activation
       
   161 		 * @param aShowToolbar     show toolbar with
       
   162 		 *                         view activation
       
   163          */
       
   164         void ActivateLogsViewL( TLogsViewIds aView,
       
   165 								TLogsViewActivationMessages aCustomMessageId,  
       
   166 								const TDesC8 & aCustomMessage );
       
   167 								
       
   168 
       
   169         /**
       
   170          * Sets the previous view id.
       
   171          *
       
   172          * @param aView ID of the view.
       
   173          */
       
   174         void SetPreviousViewId( TUid aView );
       
   175 
       
   176         /**
       
   177          * Sets the current view id.
       
   178          *
       
   179          * @param aView id of the current view
       
   180          */
       
   181         void SetCurrentViewId( TUid aView );
       
   182 
       
   183         /**
       
   184          *  Command handler: exit
       
   185          */
       
   186         void CmdExit();
       
   187          
       
   188         /**
       
   189          *  Command handler: back
       
   190          */
       
   191         void CmdBackL();
       
   192 
       
   193         /**
       
   194          * Command OK key handler
       
   195          *
       
   196          * @param aIndex current item in the listbox
       
   197          */
       
   198         void CmdOkL( TInt aIndex ); 
       
   199 
       
   200         /**
       
   201          * Active view id
       
   202          * @return view id
       
   203          */
       
   204         TLogsViewIds ActiveViewId();
       
   205 
       
   206         /**
       
   207          * Returns the UId of the previous application
       
   208          *
       
   209          * @return  id of the previous application
       
   210          */
       
   211         TUid PreviousAppUid() const;
       
   212         
       
   213         /**
       
   214          * Sets the previous application UId.
       
   215          *
       
   216          * @param aUid ID of the application.
       
   217          */
       
   218         void SetPreviousAppUid( TUid aUid );
       
   219 
       
   220         /**
       
   221          * If dialled/missed view is called from another program
       
   222          *
       
   223          * @param aProvideOnlyRecentViews Is dialled/missed view called Idle etc so 
       
   224          *                                that not all views are provided
       
   225          */
       
   226         void SetProvideOnlyRecentViews( TBool aProvideOnlyRecentViews );
       
   227 
       
   228         /**
       
   229          * Is dialled/missed view is called from another program.
       
   230          *
       
   231          * @return Is dialled/missed view called from another program.
       
   232          */
       
   233         TBool ProvideOnlyRecentViews() const;
       
   234 
       
   235         /**
       
   236          * Log view current list position getter
       
   237          *
       
   238          * @return current position
       
   239          */
       
   240         TInt EventListViewCurrent() const;
       
   241 
       
   242         /**
       
   243          * Log view current list position setter
       
   244          *
       
   245          * @param aCurrent position
       
   246          */
       
   247         void SetEventListViewCurrent( TInt aCurrent );
       
   248 
       
   249 		/**
       
   250 		 * Gets the current execution mode for the app
       
   251 		 *
       
   252 		 * @return current execution mode
       
   253 		 */
       
   254 		TInt ExecutionMode() const;
       
   255 
       
   256 		/**
       
   257 		 * Sets the current execution mode for the app
       
   258 		 *
       
   259 		 * @param aMode the new execution mode
       
   260 		 */
       
   261 		void SetExecutionMode( TInt aMode );
       
   262 		
       
   263         /**
       
   264          * When Logs regains foreground this checks wether Logs was actually
       
   265          * left to background (soft exit) and we should open Logs main view.
       
   266          *
       
   267          * Otherwise the dialled calls view would be opened as we activate
       
   268          * the dialled calls when  Logs is left to background.
       
   269          *
       
   270          * By default this is OFF:
       
   271          *   -> so normal foreground lost\regain not affected by this
       
   272          *
       
   273          * Set ON when user selects 'Exit':
       
   274          *   -> so when regaining fg without commandline parameter Logs main view is shown.
       
   275          *
       
   276          * Set OFF if commandline parameter received
       
   277          *
       
   278          * @return true/false open Logs main view
       
   279          */    
       
   280 		TBool ResetViewOnFocusRegain() const;
       
   281 		
       
   282 		/**
       
   283          * Set the resetting to main ON\OFF after regaining foreground
       
   284          *
       
   285          * @param aReset true/false open Logs main view on foreground regain
       
   286          */    
       
   287 		void SetResetViewOnFocusRegain(TBool aReset);
       
   288 		
       
   289 		void HideLogsToBackgroundL();
       
   290 
       
   291 		/**
       
   292 		 * Returns refrence to single instance of SendUi
       
   293 		 * (ownership remains in ClogsAppUi)		 
       
   294 		 */
       
   295 		CSendUi* SendUiL();		
       
   296 		
       
   297 		/**
       
   298 		 * Returns refrence to single instance of CallUi ServiceHandler for Phone calls 
       
   299 		 * (ownership remains in ClogsAppUi)
       
   300          * @param ETrue If a special case of resetting callui needs to be done, use EFalse normally
       
   301 		 */
       
   302         CAiwServiceHandler* CallUiL( TBool aReset = EFalse );
       
   303         
       
   304         /**
       
   305          * Returns wether Logs was started with Send key from idle
       
   306          *
       
   307          * @return true/false 
       
   308          */  
       
   309         TBool LogsOpenedWithSendKey();
       
   310         
       
   311         /**
       
   312          * Setter for iLogsOpenedWithSendKey
       
   313          *
       
   314          * @param true/false 
       
   315          */  
       
   316         void SetLogsOpenedWithSendKey(TBool aLogsOpenedWithSendKey);
       
   317 		
       
   318 	public: // from MAknTabObserver
       
   319 		void TabChangedL(TInt aIndex);
       
   320 
       
   321                 //
       
   322         void HandleWsEventL( const TWsEvent& aEvent, CCoeControl* aDestination );
       
   323         
       
   324 	public:        
       
   325 		/**
       
   326 		 * Sets the current execution mode for the app
       
   327 		 *
       
   328 		 * @param aUid      Uid of the app
       
   329 		 * @param aTail		Command line parameter for the app
       
   330 		 */
       
   331         TBool StartApplicationL( TUid aUid, const TDesC8& aTail );
       
   332 
       
   333 
       
   334 	public:
       
   335 	   /*************************************************************************
       
   336         FIXME: Toolbar is currently always on - keeping the toolbar visibility  *
       
   337                handling sources in comments for now - remove later.             */
       
   338         /**
       
   339          * Toolbar Visibility setting
       
   340          * @return Toolbar Visibility setting
       
   341          */
       
   342          // TBool ToolbarVisibility()  const;    
       
   343         
       
   344         /**
       
   345          * Records Toolbar visibility setting
       
   346          */
       
   347          // void RecordToolbarVisibility();
       
   348          
       
   349          /***********************************************************************/
       
   350       
       
   351     private: // From MAknToolbarObserver
       
   352         void DynInitToolbarL(TInt aResourceId,
       
   353                 CAknToolbar* aToolbar );
       
   354         void OfferToolbarEventL(TInt aCommand);
       
   355 
       
   356         //from MCoeControlObserver        
       
   357         void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);        
       
   358        
       
   359 
       
   360     private: // data
       
   361 
       
   362         /// Own: id of the previous view
       
   363         TUid iPreviousViewId;
       
   364 
       
   365         /// Own: id of the current view
       
   366         TUid iCurrentViewId;
       
   367 
       
   368         /// Ref: Pointer to application model.
       
   369         CLogsEngine* iEngine;   
       
   370         
       
   371         /**********************************************************************
       
   372         Not in use anymore, Phonebook icons replaced by own icons 
       
   373         
       
   374         /// Own: icon id array
       
   375         CArrayFix<TPbkIconId>*   iIconIdArray;
       
   376 
       
   377         /// Own: icon info container
       
   378         CPbkIconInfoContainer*   iIconInfoContainer;
       
   379         **********************************************************************/        
       
   380 
       
   381         /// Own: resource file for recent view icons ( from phonebook )
       
   382         TBool               iResetToMain;
       
   383         
       
   384         /// Own id of the previous application
       
   385         TUid iPreviousAppUid;
       
   386 
       
   387         /// Own: Is dialled/missed view is called from another program.
       
   388         TBool iProvideOnlyRecentViews;
       
   389         
       
   390         TBool iLogsOpenedWithSendKey;
       
   391 
       
   392 		/// Own: current execution mode
       
   393 		TInt iExecutionMode;
       
   394 		
       
   395         enum TExitEndPressed
       
   396             {
       
   397             ENone,
       
   398             EEndPressed,
       
   399             EExitPressed
       
   400             };
       
   401 
       
   402         TExitEndPressed		iExitOrEndPressed;	//Relates to KAknUidValueEndKeyCloseEvent		
       
   403         
       
   404         CSendUi*            iSendUi;            //Own: Instance of SendUi
       
   405         CAiwServiceHandler* iServiceHandler;    //own: ServiceHandler for CallUi, Pbk etc
       
   406         CIdle*              iConstructDelayed;  //own
       
   407         
       
   408         /*************************************************************************
       
   409         FIXME: Toolbar is currently always on - keeping the toolbar visibility   *
       
   410                handling sources in comments for now - remove later.              *
       
   411         TBool               iShowToolbar;        *********************************/
       
   412         
       
   413     };
       
   414 
       
   415 #endif  // __Logs_App_CLogsAppUi_H__
       
   416 
       
   417         
       
   418 // End of File