logsui/AppSrc/CLogsAppUi.cpp
branchRCL_3
changeset 63 f4a778e096c2
child 64 c1e8ba0c2b16
child 68 9da50d567e3c
equal deleted inserted replaced
62:5b6f26637ad3 63:f4a778e096c2
       
     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 // INCLUDE FILES
       
    21 #include <vwsdef.h>
       
    22 #include <AknQueryDialog.h>
       
    23 #include <aknnotedialog.h>
       
    24 #include <akntabgrp.h>
       
    25 #include <aknnavide.h>
       
    26 #include <featmgr.h>
       
    27 #include <sendui.h>
       
    28 #include <apgtask.h>
       
    29 #include <apgcli.h>
       
    30 #include <gsplugininterface.h>  
       
    31 #include <hlplch.h>
       
    32 #include <LogsUiCmdStarterConsts.h>
       
    33 #include <Logs.rsg>
       
    34 
       
    35 //+ __GFXTRANS__
       
    36 // Transition effects
       
    37 #include <gfxtranseffect/gfxtranseffect.h> 	
       
    38 #include <akntranseffect.h> 				
       
    39 #include "LogsUID.h"
       
    40 //-- __GFXTRANS__
       
    41 
       
    42 #include "CLogsAppUi.h"
       
    43 #include "CLogsEngine.h"
       
    44 #include "CLogsAppListView.h"
       
    45 #include "CLogsSubAppListView.h"
       
    46 #include "CLogsEventListView.h"
       
    47 #include "CLogsRecentListView.h"
       
    48 #include "CLogsDetailView.h"
       
    49 #include "CGprsCtView.h"
       
    50 #include "MLogsSharedData.h"
       
    51 #include "CCtView.h"
       
    52 #include "MLogsModel.h"
       
    53 #include "LogsConstants.hrh"
       
    54 #include "../LogsPlugin/CLogsSettingsView.h"
       
    55 
       
    56 #include "LogsDebug.h"
       
    57 #include "LogsTraces.h"
       
    58 
       
    59 // EXTERNAL DATA STRUCTURES
       
    60 
       
    61 // EXTERNAL FUNCTION PROTOTYPES  
       
    62 
       
    63 // CONSTANTS
       
    64 
       
    65 // MACROS
       
    66 
       
    67 // LOCAL CONSTANTS AND MACROS
       
    68 
       
    69 // MODULE DATA STRUCTURES
       
    70 
       
    71 // LOCAL FUNCTION PROTOTYPES
       
    72 
       
    73 // ==================== LOCAL FUNCTIONS ====================
       
    74 
       
    75 // ================= MEMBER FUNCTIONS =======================
       
    76 
       
    77 // ----------------------------------------------------------------------------
       
    78 // CLogsAppUi::~CLogsAppUi
       
    79 // ----------------------------------------------------------------------------
       
    80 //
       
    81 CLogsAppUi::~CLogsAppUi()
       
    82     {   
       
    83     /**********************************************************************
       
    84     Not in use anymore, Phonebook icons replaced by own icons 
       
    85     if(iIconIdArray)
       
    86         {
       
    87         iIconIdArray->Reset();
       
    88         delete iIconIdArray;
       
    89         }
       
    90        
       
    91     delete iIconInfoContainer;
       
    92     **********************************************************************/    
       
    93 	delete iSendUi;    
       
    94 	delete iServiceHandler;	
       
    95 	
       
    96     FeatureManager::UnInitializeLib();
       
    97     }
       
    98 
       
    99 // ----------------------------------------------------------------------------
       
   100 // CLogsAppUi::CLogsAppUi
       
   101 // ----------------------------------------------------------------------------
       
   102 //
       
   103 CLogsAppUi::CLogsAppUi( CLogsEngine* aEngine ) : 
       
   104     iEngine( aEngine ), iResetToMain(EFalse)
       
   105     {
       
   106     }
       
   107 
       
   108 // ----------------------------------------------------------------------------
       
   109 // CLogsAppUi::Engine
       
   110 // ----------------------------------------------------------------------------
       
   111 //
       
   112 CLogsEngine* CLogsAppUi::Engine()
       
   113     { 
       
   114     return iEngine; 
       
   115     }
       
   116     
       
   117 // ----------------------------------------------------------------------------
       
   118 // CLogsAppUi::SendUiL
       
   119 //
       
   120 // Provide singleton instance of SendUI 
       
   121 // ownership remains in ClogsAppUi
       
   122 // ----------------------------------------------------------------------------
       
   123 //
       
   124 CSendUi* CLogsAppUi::SendUiL()
       
   125     {
       
   126     TRACE_ENTRY_POINT;
       
   127     
       
   128 	if(!iSendUi)
       
   129 	    {
       
   130 		iSendUi=CSendUi::NewL();
       
   131 		LOGS_DEBUG_PRINT(LOGS_DEBUG_STRING
       
   132             ( "CLogsAppUi::SendUiL - iSendUi:0x%x"), iSendUi ); 
       
   133 	    }
       
   134 	    
       
   135 	TRACE_EXIT_POINT;
       
   136 	return iSendUi;
       
   137     }
       
   138     
       
   139 // ----------------------------------------------------------------------------
       
   140 // CLogsAppUi::CallUiL
       
   141 //
       
   142 // Provide singleton instance of iServiceHandler for Phone calls etc,
       
   143 // ownership remains in ClogsAppUi. Attach AIW CallUI, PoC menus to Logs. 
       
   144 // ----------------------------------------------------------------------------
       
   145 //
       
   146 CAiwServiceHandler* CLogsAppUi::CallUiL( TBool aReset )
       
   147     {
       
   148     TRACE_ENTRY_POINT;
       
   149     
       
   150     if( aReset )
       
   151         {
       
   152         delete iServiceHandler;
       
   153         iServiceHandler = NULL;
       
   154         }
       
   155     
       
   156 	if(!iServiceHandler)
       
   157 	    {
       
   158 		iServiceHandler = CAiwServiceHandler::NewL();
       
   159         LOGS_DEBUG_PRINT(LOGS_DEBUG_STRING
       
   160             ( "CLogsAppUi::CallUiL - iServiceHandler:0x%x"), iServiceHandler ); 
       
   161 
       
   162         iServiceHandler->AttachL( R_LOGS_CALLUI_INTEREST );
       
   163         iServiceHandler->AttachL( R_LOGS_POC_INTEREST ); 
       
   164 
       
   165         iServiceHandler->AttachL( R_LOGS_SAVETOPBK_INTEREST );
       
   166         
       
   167         iServiceHandler->AttachMenuL( R_COMMON_SAVETOPBK_SUBMENU, R_LOGS_SAVETOPBK_INTEREST );                        
       
   168 
       
   169         iServiceHandler->AttachMenuL( R_COMMON_CALLUI_SUBMENU, R_LOGS_CALLUI_INTEREST );
       
   170         iServiceHandler->AttachMenuL( R_COMMON_POC_SUBMENU,    R_LOGS_POC_INTEREST );
       
   171 	    }
       
   172 	    
       
   173     TRACE_EXIT_POINT;   
       
   174 	return iServiceHandler;
       
   175     }
       
   176     
       
   177 // ----------------------------------------------------------------------------
       
   178 // CLogsAppUi::ConstructL
       
   179 // ----------------------------------------------------------------------------
       
   180 //
       
   181 void CLogsAppUi::ConstructL()  //Called from framework (CEikDocument)
       
   182     {
       
   183     TRACE_ENTRY_POINT;
       
   184        
       
   185     iSendUi = NULL;
       
   186     iServiceHandler = NULL;    
       
   187 
       
   188     BaseConstructL(
       
   189         EAknEnableSkin | EAknEnableMSK | EAknSingleClickCompatible );
       
   190 
       
   191     SetProvideOnlyRecentViews( EFalse );   //By default we provide all views.
       
   192     SetLogsOpenedWithSendKey( EFalse );  
       
   193     
       
   194 /**********************************************************************    
       
   195     Not in use anymore, Phonebook icons replaced by own icons 
       
   196     //Read Phonebook iconIds for each type of Phonebook field.    
       
   197     iIconInfoContainer = CPbkIconInfoContainer::NewL(); //Provides instance initialised with Phonebook's
       
   198          												//default icon info (from PbkView.rsc).    
       
   199     iIconIdArray = new(ELeave) CArrayFixFlat<TPbkIconId>( 1 );	
       
   200 **********************************************************************/    
       
   201 
       
   202     SetExecutionMode( ELogsInForeground );
       
   203     
       
   204 /*******************************************************************************
       
   205  FIXME: Toolbar is currently always on - keeping the toolbar visibility handling 
       
   206         sources in comments for now - remove later.    
       
   207     //This cannot be done in DoConstructDelayedL, happens too late
       
   208     if( AknLayoutUtils::PenEnabled() )
       
   209         {
       
   210     
       
   211         iShowToolbar = iEngine->SharedDataL()->ToolbarVisibility() == 1;  
       
   212              
       
   213         }  
       
   214 *******************************************************************************/ 
       
   215 
       
   216     //Construct CIdle object call back to finalise time consuming construction
       
   217     iConstructDelayed = CIdle::NewL( CActive::EPriorityIdle );
       
   218     iConstructDelayed->Start( TCallBack( ConstructDelayedCallbackL, this) );            
       
   219      
       
   220     TRACE_EXIT_POINT;           
       
   221     }
       
   222 
       
   223 // ----------------------------------------------------------------------------
       
   224 // CLogsAppUi::ConstructDelayedCallbackL
       
   225 //
       
   226 // Called from CIdle once to finish time consuming construction operations
       
   227 // ----------------------------------------------------------------------------
       
   228 //
       
   229 TInt CLogsAppUi::ConstructDelayedCallbackL( TAny* aContainer )
       
   230     {
       
   231     CLogsAppUi* container = static_cast<CLogsAppUi*>( aContainer );
       
   232     container->DoConstructDelayedL();    
       
   233     return 0;
       
   234     }
       
   235 
       
   236 // ----------------------------------------------------------------------------
       
   237 // CLogsAppUi::DoConstructDelayedL
       
   238 //
       
   239 // Perform time consuming construction operations once
       
   240 // ----------------------------------------------------------------------------
       
   241 //
       
   242 void CLogsAppUi::DoConstructDelayedL()
       
   243     {
       
   244     TRACE_ENTRY_POINT;
       
   245     
       
   246     if( iConstructDelayed ) 
       
   247         {
       
   248         if( iConstructDelayed->IsActive() ) //Sometimes cancel is expensive, so
       
   249             {                               //check as should be no need for Cancel()
       
   250             iConstructDelayed->Cancel();
       
   251             }
       
   252         
       
   253         delete iConstructDelayed;
       
   254         iConstructDelayed = NULL;
       
   255         }
       
   256 
       
   257     //Initial Logs view is created on-need in ProcessCommandParametersL. However, 
       
   258     //AppShell doesn't currently provide option to send cmdline parameter, so we need 
       
   259     //proactively be prepared to provide AppListView if activated later from AppShell.
       
   260     //This is needed if we lose foreground and later gain it from AppShell to AppListView. 
       
   261     //Because of EMSH-6JDFBV it's also better not try do the below in HandleLosingForeground()
       
   262     //so we need to accept a minor performance penalty of executing the below already here.
       
   263     if( ! View( TUid::Uid( ELogAppListViewId ) ) && !FeatureManager::FeatureSupported( KFeatureIdSimpleLogs ) )  
       
   264         {
       
   265         CAknView* logsView = CLogsAppListView::NewL();    
       
   266         CleanupStack::PushL(logsView);
       
   267         AddViewL( logsView );       //takes ownership
       
   268         CleanupStack::Pop(logsView);   
       
   269         }
       
   270     else if ( ! View( TUid::Uid( ELogSubAppListViewId ) ) && FeatureManager::FeatureSupported( KFeatureIdSimpleLogs ) )
       
   271         {
       
   272         // When simple mode enabled, provide SubAppListView here.
       
   273         CAknView* logsView = CLogsSubAppListView::NewL();    
       
   274         CleanupStack::PushL(logsView);
       
   275         AddViewL( logsView );       //takes ownership
       
   276         CleanupStack::Pop(logsView);
       
   277         }
       
   278         
       
   279     TRACE_EXIT_POINT;
       
   280     }
       
   281 
       
   282 
       
   283 /**********************************************************************
       
   284 Not in use anymore, Phonebook icons replaced by own icons 
       
   285 
       
   286 CArrayFix<TPbkIconId>* CLogsAppUi::IconIdArray()
       
   287     {
       
   288     return iIconIdArray;
       
   289     }
       
   290 
       
   291 CPbkIconInfoContainer* CLogsAppUi::IconInfoContainer()
       
   292     {
       
   293     return iIconInfoContainer;
       
   294     }
       
   295 **********************************************************************/    
       
   296 
       
   297 // ----------------------------------------------------------------------------
       
   298 // CLogsAppUi::CmdExit
       
   299 // ----------------------------------------------------------------------------
       
   300 //
       
   301 void CLogsAppUi::CmdExit()
       
   302     {
       
   303     
       
   304 /*******************************************************************************
       
   305  FIXME: Toolbar is currently always on - keeping the toolbar visibility handling 
       
   306         sources in comments for now - remove later.   
       
   307     //Proceed to exit even if leave would happen
       
   308     TInt err;
       
   309     TRAP( err, iEngine->SharedDataL()->SetToolbarVisibility( iShowToolbar ? 1 : 0 ) ); //0=no toolbar  
       
   310 *******************************************************************************/    
       
   311 
       
   312     Exit();
       
   313     }
       
   314 
       
   315 // ----------------------------------------------------------------------------
       
   316 // CLogsAppUi::CmdBackL
       
   317 // ----------------------------------------------------------------------------
       
   318 //
       
   319 void CLogsAppUi::CmdBackL()
       
   320     {
       
   321     switch( iCurrentViewId.iUid )
       
   322         {
       
   323         case ELogDetailViewId:
       
   324             ActivateLogsViewL( ELogEventListViewId );
       
   325             break;
       
   326 
       
   327         case ELogSettingsViewId:
       
   328             ActivateLogsViewL( static_cast<TLogsViewIds>( iPreviousViewId.iUid ) );
       
   329             break;
       
   330 
       
   331         case EStmMissedListViewId: // fall through
       
   332         case EStmReceivedListViewId:
       
   333         case EStmDialledListViewId:
       
   334             ActivateLogsViewL( ELogSubAppListViewId );
       
   335             break;
       
   336 
       
   337         case ELogSubAppListViewId: // fall through
       
   338         case ECtViewId:
       
   339         case EGprsCounterViewId:
       
   340             ActivateLogsViewL( ELogAppListViewId );
       
   341             break;
       
   342 
       
   343         default:
       
   344             break;
       
   345         }
       
   346     }
       
   347 
       
   348 // ----------------------------------------------------------------------------
       
   349 // CLogsAppUi::ActivateLogsViewL
       
   350 // ----------------------------------------------------------------------------
       
   351 //
       
   352 void CLogsAppUi::ActivateLogsViewL( TLogsViewIds aView )
       
   353     {
       
   354     ActivateLogsViewL( aView, ELogsViewActivationNoMessage, KNullDesC8()); 
       
   355     }
       
   356 
       
   357 // ----------------------------------------------------------------------------
       
   358 // CLogsAppUi::ActivateLogsViewL
       
   359 //
       
   360 // Activate requested view. The view is also created if it does not already exist.
       
   361 // ----------------------------------------------------------------------------
       
   362 //
       
   363 void CLogsAppUi::ActivateLogsViewL( 
       
   364     TLogsViewIds aView,
       
   365     TLogsViewActivationMessages aCustomMessageId,
       
   366     const TDesC8& aCustomMessage )
       
   367     {
       
   368     TRACE_ENTRY_POINT;
       
   369     
       
   370     TBool rc( ETrue );
       
   371     CAknView* logsView = View( TUid::Uid( aView ));
       
   372 
       
   373     //If the view does not already exist, let's try to create it first
       
   374     if( !logsView ) 
       
   375         {
       
   376         switch( aView )  //not yet exists, create the view
       
   377             {
       
   378             case ELogAppListViewId:
       
   379                 logsView = CLogsAppListView::NewL();
       
   380                 CleanupStack::PushL(logsView);
       
   381                 break;
       
   382 
       
   383             case ELogSubAppListViewId:
       
   384                 logsView = CLogsSubAppListView::NewL();
       
   385                 CleanupStack::PushL(logsView);
       
   386                 break;
       
   387 
       
   388             case ELogEventListViewId:
       
   389                 logsView = CLogsEventListView::NewL();
       
   390                 CleanupStack::PushL(logsView);
       
   391                 break;
       
   392 
       
   393             case EStmMissedListViewId:
       
   394                 logsView = CLogsRecentListView::NewL( ELogsMissedModel );
       
   395                 CleanupStack::PushL(logsView);
       
   396                 break;
       
   397 
       
   398             case EStmReceivedListViewId:
       
   399                 logsView = CLogsRecentListView::NewL( ELogsReceivedModel );
       
   400                 CleanupStack::PushL(logsView);
       
   401                 break;
       
   402 
       
   403             case EStmDialledListViewId:
       
   404                 logsView = CLogsRecentListView::NewL( ELogsDialledModel );
       
   405                 CleanupStack::PushL(logsView);
       
   406                 break;
       
   407 
       
   408             case ELogDetailViewId:
       
   409                 logsView = CLogsDetailView::NewL();
       
   410                 CleanupStack::PushL(logsView);
       
   411                 break; 
       
   412 
       
   413             case EGprsCounterViewId:
       
   414                 logsView = CGprsCtView::NewL();
       
   415                 CleanupStack::PushL(logsView);
       
   416                 break;
       
   417 
       
   418             case ELogSettingsViewId:  //viewId is implementation UID too in this case
       
   419                 //Settings is a Ecom plugin (implements CGSPluginInterface). CGSPluginInterface.cpp
       
   420                 //takes care of needed ecom clear up issues.
       
   421                 //Note! REComSession::FinalClose() is called in CLogsDocument destructor. Calling
       
   422                 //in CLogsAppUi dtor is too early as view framework destroys the view *after* appui has already 
       
   423                 //been destroyed.
       
   424                 {
       
   425                 CGSPluginInterface* gs = CGSPluginInterface::NewL( TUid::Uid( aView ), NULL); 
       
   426                 logsView = static_cast<CGSPluginInterface*>(gs);
       
   427                 CleanupStack::PushL(logsView);                
       
   428                 gs->CustomOperationL( NULL, NULL );
       
   429                 }
       
   430                 break;
       
   431                                    
       
   432             case ECtViewId:
       
   433                 logsView = CCtView::NewL();
       
   434                 CleanupStack::PushL(logsView);
       
   435                 break;
       
   436 
       
   437             default:
       
   438                 break;
       
   439             }
       
   440 
       
   441         if( logsView )
       
   442             {                       //Registers the view with the view server            
       
   443             AddViewL( logsView );   // takes ownership of logsView 
       
   444             CleanupStack::Pop(logsView);   
       
   445             }
       
   446         else
       
   447             {
       
   448             rc = EFalse;
       
   449             }
       
   450         }
       
   451 
       
   452     //Activate the requested view
       
   453     if( rc )
       
   454         {    
       
   455         ActivateLocalViewL( TUid::Uid( aView ), 
       
   456                             TUid::Uid( aCustomMessageId ), 
       
   457                             aCustomMessage );
       
   458          
       
   459         // If activating settings view, call SetCurrentViewId here, cause
       
   460         // settings view can't access CLogsAppUi's functions
       
   461         if (aView == ELogSettingsViewId)
       
   462         	{
       
   463         	SetCurrentViewId(TUid::Uid(aView));
       
   464         	}
       
   465         }
       
   466         
       
   467     TRACE_EXIT_POINT;
       
   468     }
       
   469 
       
   470 // ----------------------------------------------------------------------------
       
   471 // CLogsAppUi::SetPreviousViewId
       
   472 // ----------------------------------------------------------------------------
       
   473 //
       
   474 void CLogsAppUi::SetPreviousViewId( TUid aView )
       
   475     {
       
   476     iPreviousViewId = aView;
       
   477     }
       
   478 
       
   479 // ----------------------------------------------------------------------------
       
   480 // CLogsAppUi::SetCurrentViewId
       
   481 // ----------------------------------------------------------------------------
       
   482 //
       
   483 void CLogsAppUi::SetCurrentViewId( TUid aView )
       
   484     {
       
   485     iCurrentViewId = aView;
       
   486     }
       
   487 
       
   488 // ----------------------------------------------------------------------------
       
   489 // CLogsAppUi::CmdOkL
       
   490 // ----------------------------------------------------------------------------
       
   491 //
       
   492 void CLogsAppUi::CmdOkL( TInt aIndex )
       
   493     {    
       
   494     if( TUid::Uid( ELogAppListViewId ) == iCurrentViewId )
       
   495         {        
       
   496         switch( aIndex )
       
   497             {
       
   498             case EStmStmSubAppId:
       
   499                 ActivateLogsViewL( ELogSubAppListViewId );
       
   500                 break;
       
   501 
       
   502             case EStmTimersSubAppId:
       
   503                 ActivateLogsViewL( ECtViewId );
       
   504                 break;
       
   505 
       
   506             case EGprsCountSubAppId:
       
   507                 ActivateLogsViewL( EGprsCounterViewId );
       
   508                 break;
       
   509 
       
   510             default:
       
   511                 break;
       
   512             }
       
   513         }
       
   514     
       
   515     else if( TUid::Uid( ELogSubAppListViewId ) == iCurrentViewId )
       
   516         {
       
   517         switch( aIndex )
       
   518             {
       
   519             case EStmMissedId:
       
   520                 ActivateLogsViewL( EStmMissedListViewId );
       
   521                 break;
       
   522 
       
   523             case EStmReceivedId:
       
   524                 ActivateLogsViewL( EStmReceivedListViewId );
       
   525                 break;
       
   526 
       
   527             case EStmDialledId:
       
   528                 ActivateLogsViewL( EStmDialledListViewId );
       
   529                 break;
       
   530 
       
   531             default:
       
   532                 break;
       
   533             }
       
   534         }
       
   535     
       
   536     else if( TUid::Uid( ELogEventListViewId ) == iCurrentViewId )
       
   537         {
       
   538         if( iEngine->Model( ELogsMainModel )->Count() )
       
   539             {
       
   540             ActivateLogsViewL( ELogDetailViewId );
       
   541             }
       
   542         }
       
   543     }
       
   544 
       
   545 // ----------------------------------------------------------------------------
       
   546 // CLogsAppUi::HandleCommandL
       
   547 // ----------------------------------------------------------------------------
       
   548 //
       
   549 void CLogsAppUi::HandleCommandL( TInt aCommand )
       
   550     {
       
   551     TRACE_ENTRY_POINT;
       
   552     switch( aCommand )
       
   553         {
       
   554         case EEikCmdExit:   //We receive this when e.g. close app is selected in fast swapping list.
       
   555             {
       
   556             LOGS_DEBUG_PRINT(LOGS_DEBUG_STRING
       
   557             		( "CLogsAppUi::HandleCommandL(0x%x) - EEikCmdExit: real exit"), this );
       
   558             CmdExit(); //Do real exit (close Logs).
       
   559             break;     
       
   560             }
       
   561             
       
   562         case EAknCmdHideInBackground:
       
   563             {
       
   564             TBool hideInBg( ETrue );
       
   565 #ifdef _DEBUG  //Debug mode, logs exits completely
       
   566             hideInBg = EFalse;  
       
   567 #endif
       
   568             if(hideInBg)
       
   569                 {
       
   570                 LOGS_DEBUG_PRINT(LOGS_DEBUG_STRING
       
   571                         ( "CLogsAppUi::HandleCommandL(0x%x) - EAknCmdHideInBackground: fake exit"), this );
       
   572                 // Fake exit - leave app to memory but hide from user
       
   573                  HideLogsToBackgroundL();
       
   574                 }
       
   575             else
       
   576                 { 
       
   577                 LOGS_DEBUG_PRINT(LOGS_DEBUG_STRING
       
   578                         ( "CLogsAppUi::HandleCommandL(0x%x) - EAknCmdHideInBackground: exit completely"), this );
       
   579                 //logs exits completely
       
   580                 CmdExit();
       
   581                 }
       
   582             break;
       
   583             }
       
   584         
       
   585         case EAknSoftkeyExit:
       
   586         case ELogsCmdMenuExit:
       
   587             {
       
   588             if (ExitHidesInBackground())
       
   589             	{
       
   590             	LOGS_DEBUG_PRINT(LOGS_DEBUG_STRING
       
   591             			( "CLogsAppUi::HandleCommandL(0x%x) - EAknSoftkeyExit: fake exit"), this ); 
       
   592             	// Fake exit - leave app to memory but hide from user
       
   593             	HideLogsToBackgroundL();
       
   594             	}
       
   595             else
       
   596             	{
       
   597             	LOGS_DEBUG_PRINT(LOGS_DEBUG_STRING
       
   598             			( "CLogsAppUi::HandleCommandL(0x%x) - EAknSoftkeyExit: real exit"), this ); 
       
   599             	//Do real exit, close Logs.
       
   600             	CmdExit(); 
       
   601             	}
       
   602             break;
       
   603             }       
       
   604 
       
   605         case ELogsCmdMenuSettings:
       
   606             ActivateLogsViewL( ELogSettingsViewId );
       
   607             break;
       
   608 
       
   609         case ELogsCmdFailedDueActiveCall:
       
   610             {
       
   611             CAknNoteDialog* noteDlg = new( ELeave ) CAknNoteDialog( CAknNoteDialog::ENoTone,
       
   612                             CAknNoteDialog::ELongTimeout );
       
   613             noteDlg->ExecuteLD( R_LOGS_NOTE_DURING_CALL_OPTION_NOT_ALLOWED );
       
   614             break;
       
   615             }
       
   616 
       
   617         case EAknCmdHelp:
       
   618             {
       
   619             HlpLauncher::LaunchHelpApplicationL(iEikonEnv->WsSession(), AppHelpContextL());
       
   620             break;
       
   621             }
       
   622 
       
   623         default:
       
   624             iExitOrEndPressed = ENone;      //Reset also here 
       
   625             break;          
       
   626         }
       
   627         
       
   628     TRACE_EXIT_POINT;
       
   629     }
       
   630 
       
   631 // ----------------------------------------------------------------------------
       
   632 // CLogsAppUi::HideLogsToBackgroundL
       
   633 // Leave the application in memory
       
   634 // ----------------------------------------------------------------------------
       
   635 //
       
   636 void CLogsAppUi::HideLogsToBackgroundL()
       
   637     {  
       
   638     TRACE_ENTRY_POINT;
       
   639     
       
   640     //+ __GFXTRANS__
       
   641        
       
   642     // Always use exit effect even if this is actually application switch
       
   643     // Note: Not allowed to call GfxTransEffect::EndFullScreen() as AVKON takes care of that when
       
   644     // EApplicationExit context is used!  
       
   645     // Set effect begin point
       
   646        			
       
   647    	iExitOrEndPressed = EExitPressed; 	//Reset to obey EEikCmdExit to do real exit (e.g. in case low mem, backup etc)                           
       
   648    	SetExecutionMode( ELogsInBackground_ExitOrEndPressed );
       
   649 
       
   650    	//Clear info whether we were called externally (Provide complete Logs to user next time)
       
   651    	SetProvideOnlyRecentViews( EFalse ); 
       
   652    	                
       
   653    	// In case foreground is later gained without commandline parameters, switch to 
       
   654    	// Logs main view instead of the Dialled calls view.   
       
   655     SetResetViewOnFocusRegain(ETrue);
       
   656     
       
   657     //Reset the ALS view selection for counters view, so that next time when Logs is opened all lines 
       
   658    	//are again shown as default
       
   659    	if ( View( TUid::Uid( ECtViewId ))) //View() returns null if view doesn't exist
       
   660    		{
       
   661    	    CCtView* view = static_cast<CCtView*>( View( TUid::Uid( ECtViewId )));
       
   662    	    view->SetAlsLine( EAllLines );
       
   663    	    }
       
   664     
       
   665     // Delete contact link checker when hiding log to background
       
   666     Engine()->DeleteCntLinkChecker();
       
   667     
       
   668    	// With the ELogsViewActivationBackground message, the ActivateLogsViewL will send
       
   669    	// a view activation message and we can go to background before it completes.
       
   670    	// We leave dialled calls view open as that is the most important use case for Logs
       
   671    	SetCustomControl(1);
       
   672    	ActivateLogsViewL(EStmDialledListViewId, ELogsViewActivationBackground, KNullDesC8());
       
   673    	      
       
   674     TRACE_EXIT_POINT;
       
   675     }
       
   676 
       
   677 // ----------------------------------------------------------------------------
       
   678 // CLogsAppUi::HandleWsEventL
       
   679 // ----------------------------------------------------------------------------
       
   680 //
       
   681 void CLogsAppUi::HandleWsEventL(
       
   682     const TWsEvent& aEvent,
       
   683     CCoeControl* aDestination )
       
   684     {
       
   685     TRACE_ENTRY_POINT;
       
   686     switch (aEvent.Type())
       
   687         {
       
   688         case EEventFocusGained:
       
   689             {
       
   690             // If Logs is on background because Exit has been pressed, and we have not received
       
   691             // a commandline message, Logs main view is to be activated when regaining foreground.
       
   692             //
       
   693             // This handling is needed due to the performance optimization of dialled calls used case
       
   694             // where we leave dialled calls view on background after user selecting Exit. 
       
   695             // This handling prevents errors like MMAN-6VADLV or MMHI-6V7ABV.
       
   696             // 
       
   697             if (ExecutionMode() == ELogsInBackground_ExitOrEndPressed && ResetViewOnFocusRegain())
       
   698                 {
       
   699                 SetResetViewOnFocusRegain(EFalse); // prevent further view switches
       
   700                 if ( FeatureManager::FeatureSupported( KFeatureIdSimpleLogs ) )
       
   701                     {
       
   702                     ActivateLogsViewL( ELogSubAppListViewId );
       
   703                     }
       
   704                 else
       
   705                     {
       
   706                     ActivateLogsViewL( ELogAppListViewId );
       
   707                     }    
       
   708                 }
       
   709            
       
   710             CAknAppUi::HandleWsEventL( aEvent, aDestination );                    
       
   711             break;
       
   712             }
       
   713             
       
   714         case KAknUidValueEndKeyCloseEvent:  //0x101F87F0  (Avkon.hrh)
       
   715 
       
   716             //We have received KAknUidValueEndKeyCloseEvent. Let it go to FW (so we dont catch it here). 
       
   717             //Next we can wait EEikCmdExit to be received from FW to our HandleCommandL.
       
   718             iExitOrEndPressed = EEndPressed;  
       
   719                    
       
   720           
       
   721             /*******************************************************************************
       
   722              FIXME: Toolbar is currently always on - keeping the toolbar visibility handling 
       
   723                     sources in comments for now - remove later.
       
   724                     
       
   725             //IsShown() happens too late in CmdExit() when End key is pressed as Toolbar
       
   726             //has already hidden itself. So get status here (i.e cannot be done when EEikCmdExit 
       
   727             //is received e.g because of backup)
       
   728             if( CurrentPopupToolbar() ) 
       
   729                 {
       
   730                 iShowToolbar = CurrentPopupToolbar()->IsShown(); //iToolbarRef->IsShown();     
       
   731                 }
       
   732             ********************************************************************************/                 
       
   733 
       
   734         default:
       
   735             
       
   736             // All other events are forwarded normally to base class
       
   737             CAknAppUi::HandleWsEventL( aEvent, aDestination ); 
       
   738             break;
       
   739         }
       
   740         
       
   741     TRACE_EXIT_POINT;    
       
   742     }
       
   743 
       
   744 
       
   745 // ----------------------------------------------------------------------------
       
   746 // CLogsAppUi::ResetToLogsMainView
       
   747 // ----------------------------------------------------------------------------
       
   748 //
       
   749 TBool CLogsAppUi::ResetViewOnFocusRegain() const
       
   750     {
       
   751     return iResetToMain;
       
   752     }
       
   753 
       
   754 // ----------------------------------------------------------------------------
       
   755 // CLogsAppUi::SetResetToLogsMainView
       
   756 // ----------------------------------------------------------------------------
       
   757 //		
       
   758 void CLogsAppUi::SetResetViewOnFocusRegain(TBool aResetToMain)
       
   759     {
       
   760     iResetToMain = aResetToMain;
       
   761     }
       
   762 		
       
   763 		
       
   764 // ----------------------------------------------------------------------------
       
   765 // CLogsAppUi::ActiveViewId
       
   766 // ----------------------------------------------------------------------------
       
   767 //
       
   768 TLogsViewIds CLogsAppUi::ActiveViewId()
       
   769     {
       
   770     return TLogsViewIds( iCurrentViewId.iUid );
       
   771     }
       
   772 
       
   773 // ----------------------------------------------------------------------------
       
   774 // CLogsAppUi::PreviousAppUid
       
   775 // ----------------------------------------------------------------------------
       
   776 //
       
   777 TUid CLogsAppUi::PreviousAppUid() const
       
   778     {
       
   779     return iPreviousAppUid;
       
   780     }
       
   781 
       
   782 
       
   783 // ----------------------------------------------------------------------------
       
   784 // CLogsAppUi::SetPreviousAppUid
       
   785 // ----------------------------------------------------------------------------
       
   786 //
       
   787 void CLogsAppUi::SetPreviousAppUid( TUid aUid )
       
   788     {
       
   789     iPreviousAppUid = aUid;
       
   790     }
       
   791 
       
   792 // ----------------------------------------------------------------------------
       
   793 // CLogsAppUi::SetProvideOnlyRecentViews
       
   794 // ----------------------------------------------------------------------------
       
   795 //
       
   796 void CLogsAppUi::SetProvideOnlyRecentViews( TBool aProvideOnlyRecentViews )
       
   797     {
       
   798     iProvideOnlyRecentViews = aProvideOnlyRecentViews;
       
   799     }
       
   800 
       
   801 // ----------------------------------------------------------------------------
       
   802 // CLogsAppUi::ProvideOnlyRecentViews
       
   803 // ----------------------------------------------------------------------------
       
   804 //
       
   805 TBool CLogsAppUi::ProvideOnlyRecentViews() const
       
   806     {
       
   807     return iProvideOnlyRecentViews;
       
   808     }
       
   809 
       
   810 // ----------------------------------------------------------------------------
       
   811 // CLogsAppUi::TabChangedL
       
   812 //
       
   813 // Activates the Logs view that corresponds to tab id of activated tab in tab group in navi pane
       
   814 // ----------------------------------------------------------------------------
       
   815 //
       
   816 void CLogsAppUi::TabChangedL(TInt aIndex)
       
   817     {
       
   818 #if defined(_DEBUG)
       
   819     _LIT( KPanicMsg, "CLogsAppUi::TabChangedL");
       
   820     CEikStatusPane* statusPane = NULL;
       
   821     statusPane = iEikonEnv->AppUiFactory()->StatusPane();
       
   822 #endif  // _DEBUG
       
   823 
       
   824     __ASSERT_DEBUG( statusPane, User::Panic(KPanicMsg, KErrCorrupt) );
       
   825 
       
   826     CAknNavigationControlContainer* naviCtrlContainer = NULL;
       
   827     naviCtrlContainer = static_cast<CAknNavigationControlContainer*>( StatusPane()->
       
   828                     ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) );
       
   829     __ASSERT_DEBUG( naviCtrlContainer, User::Panic(KPanicMsg, KErrCorrupt) );
       
   830 
       
   831     CAknNavigationDecorator* decorator = naviCtrlContainer->Top();
       
   832     __ASSERT_DEBUG( decorator && decorator->ControlType() == CAknNavigationDecorator::ETabGroup,
       
   833                     User::Panic(KPanicMsg, KErrCorrupt));
       
   834 
       
   835     CAknTabGroup* tabGroup = static_cast<CAknTabGroup*>(decorator->DecoratedControl());
       
   836     __ASSERT_DEBUG( tabGroup && aIndex >= 0 && aIndex < tabGroup->TabCount(),
       
   837                     User::Panic(KPanicMsg, KErrCorrupt));
       
   838 
       
   839     //TabIds in resource file are same as viewIds, so we can use them directly to activate a view
       
   840     const TInt viewId(tabGroup->TabIdFromIndex(aIndex));
       
   841     ActivateLogsViewL(static_cast<TLogsViewIds>(viewId));
       
   842     }
       
   843 
       
   844 // ----------------------------------------------------------------------------
       
   845 // CLogsAppUi::EventListViewCurrent
       
   846 // ----------------------------------------------------------------------------
       
   847 //
       
   848 TInt CLogsAppUi::EventListViewCurrent() const
       
   849     {
       
   850     CAknView* view = View( TUid::Uid( ELogEventListViewId ) );
       
   851 
       
   852     if( view )
       
   853         {
       
   854         return ( static_cast<CLogsEventListView*>( view ) )->EventListCurrent();
       
   855         }
       
   856     else
       
   857         {
       
   858         return KErrNotFound;
       
   859         }
       
   860     }
       
   861 
       
   862 // ----------------------------------------------------------------------------
       
   863 // CLogsAppUi::SetEventListViewCurrent
       
   864 // ----------------------------------------------------------------------------
       
   865 //
       
   866 void CLogsAppUi::SetEventListViewCurrent( TInt aCurrent )
       
   867     {
       
   868     CAknView* view = View( TUid::Uid( ELogEventListViewId ) );
       
   869 
       
   870     if( view )
       
   871         {
       
   872         ( static_cast<CLogsEventListView*>( view ) )->
       
   873                                 SetEventListCurrent( aCurrent );
       
   874         }
       
   875     }
       
   876 
       
   877 // ----------------------------------------------------------------------------
       
   878 // CLogsAppUi::ExecutionMode
       
   879 // ----------------------------------------------------------------------------
       
   880 //
       
   881 TInt CLogsAppUi::ExecutionMode() const
       
   882     {
       
   883     return iExecutionMode;
       
   884     }
       
   885 
       
   886 // ----------------------------------------------------------------------------
       
   887 // CLogsAppUi::SetExecutionMode
       
   888 // ----------------------------------------------------------------------------
       
   889 //
       
   890 void CLogsAppUi::SetExecutionMode( TInt aMode )
       
   891     {
       
   892     if (aMode == ELogsInForeground )
       
   893         {
       
   894         // Make sure that the view gets foreground when view activated.
       
   895         SetCustomControl(0);
       
   896         }
       
   897     iExecutionMode = aMode;
       
   898     }
       
   899 
       
   900 // ----------------------------------------------------------------------------
       
   901 // CLogsAppUi::LogsOpenedWithSendKey
       
   902 // ----------------------------------------------------------------------------
       
   903 //    
       
   904 TBool CLogsAppUi::LogsOpenedWithSendKey()
       
   905     {
       
   906     return iLogsOpenedWithSendKey;
       
   907     }
       
   908 
       
   909 // ----------------------------------------------------------------------------
       
   910 // CLogsAppUi::SetLogsOpenedWithSendKey
       
   911 // ----------------------------------------------------------------------------
       
   912 //  
       
   913 void CLogsAppUi::SetLogsOpenedWithSendKey(TBool aLogsOpenedWithSendKey)
       
   914     {
       
   915     iLogsOpenedWithSendKey = aLogsOpenedWithSendKey;
       
   916     }    
       
   917 
       
   918 /*******************************************************************************
       
   919  FIXME: Toolbar is currently always on - keeping the toolbar visibility handling 
       
   920         sources in comments for now - remove later.
       
   921         
       
   922 // ----------------------------------------------------------------------------
       
   923 // CLogsAppUi::ToolbarVisibility()
       
   924 // ----------------------------------------------------------------------------
       
   925 //
       
   926 TInt CLogsAppUi::ToolbarVisibility() const
       
   927     {
       
   928     return iShowToolbar; 
       
   929     }
       
   930  
       
   931 // ----------------------------------------------------------------------------
       
   932 // CLogsAppUi::RecordToolbarVisibility()
       
   933 //
       
   934 // Record current toolbar visibility 
       
   935 // ----------------------------------------------------------------------------
       
   936 //
       
   937 void CLogsAppUi::RecordToolbarVisibility() 
       
   938     { 
       
   939     CAknView* view = View( iCurrentViewId  );
       
   940 
       
   941     if( view && view->IsForeground())
       
   942         {
       
   943         switch( iCurrentViewId.iUid )
       
   944             {
       
   945             case ELogEventListViewId:
       
   946             case EStmMissedListViewId:
       
   947             case EStmReceivedListViewId:
       
   948             case EStmDialledListViewId:
       
   949             case ELogDetailViewId:
       
   950                 if( CurrentPopupToolbar() ) 
       
   951                     {
       
   952                     iShowToolbar = CurrentPopupToolbar()->IsShown(); 
       
   953                     }
       
   954             }
       
   955         }      
       
   956     }
       
   957  *******************************************************************************/
       
   958    
       
   959 // ----------------------------------------------------------------------------
       
   960 // CLogsAppUi::HandleControlEventL
       
   961 //
       
   962 // from MCoeControlObserver        
       
   963 // ----------------------------------------------------------------------------
       
   964 //
       
   965 void CLogsAppUi::HandleControlEventL( 
       
   966     CCoeControl* /* aControl */,   
       
   967     TCoeEvent /* aEventType */ ) 
       
   968     {
       
   969     }
       
   970 
       
   971 // --------------------------------------------------------------------------
       
   972 // CLogsAppUi::DynInitToolbarL
       
   973 // --------------------------------------------------------------------------
       
   974 //
       
   975 void CLogsAppUi::DynInitToolbarL( 
       
   976     TInt /* aResourceId */, 
       
   977     CAknToolbar* /* aToolbar */ )
       
   978     {
       
   979     }
       
   980 
       
   981 // --------------------------------------------------------------------------
       
   982 // CLogsAppUi::OfferToolbarEventL
       
   983 // --------------------------------------------------------------------------
       
   984 //
       
   985 void CLogsAppUi::OfferToolbarEventL( TInt aCommand )
       
   986     {
       
   987     ProcessCommandL( aCommand );
       
   988     }    
       
   989 
       
   990 // ----------------------------------------------------------------------------
       
   991 // CLogsAppUi::HandleMessageL
       
   992 //
       
   993 // Handle message sent by Logs client. Called by framework, when LogsUiCmdStarter
       
   994 // request invocation of a specific view.
       
   995 // ----------------------------------------------------------------------------
       
   996 //
       
   997 MCoeMessageObserver::TMessageResponse CLogsAppUi::HandleMessageL(
       
   998     TUint32 aClientHandleOfTargetWindowGroup,
       
   999     TUid aMessageUid,
       
  1000     const TDesC8& aMessageParameters )
       
  1001     {
       
  1002     // If aTail is set, other app starts Logs
       
  1003     if (aMessageParameters.Length())
       
  1004 	    {
       
  1005 		TFileName dummy;
       
  1006   		TApaCommand cmd=EApaCommandRun;
       
  1007   		ProcessCommandParametersL(cmd,dummy,aMessageParameters);
       
  1008   		return EMessageHandled;
       
  1009 	    }
       
  1010 
       
  1011     return CAknViewAppUi::HandleMessageL(
       
  1012         aClientHandleOfTargetWindowGroup,
       
  1013         aMessageUid,
       
  1014         aMessageParameters);
       
  1015     }
       
  1016 
       
  1017 // ----------------------------------------------------------------------------
       
  1018 // CLogsAppUi::ProcessCommandParametersL
       
  1019 //
       
  1020 // Called by framework when external application requests startup of Logs and invocation 
       
  1021 // of a specific view. Also called by Logs when Logs has received a message requesting 
       
  1022 // invocation of a specific view. Orginators of these messages are:
       
  1023 // - LogsUiCmdStarter::CmdStartL / LogsUiCmdStarter::CmdStart 
       
  1024 // - CAknSoftNotificationSubject::LaunchMissedCallsAppL()
       
  1025 // - Context sensitive Help application (when certain logs view can be opened from help)
       
  1026 //
       
  1027 // IMPORTANT: This command line parameter interface is PRIVATE and may be replaced
       
  1028 // in future with more generic solution. So do not use this unless agreed with Logs
       
  1029 // project.
       
  1030 //
       
  1031 // For invocation of Logs application use the LogsUiCmdStarter helper functionality 
       
  1032 // available in LogsUiCmdStarter.h.
       
  1033 //
       
  1034 // ----------------------------------------------------------------------------
       
  1035 //
       
  1036 TBool CLogsAppUi::ProcessCommandParametersL(
       
  1037     TApaCommand aCommand,
       
  1038     TFileName& aDocumentName,
       
  1039     const TDesC8& aTail )
       
  1040     {
       
  1041     TRACE_ENTRY_POINT;
       
  1042     
       
  1043     //Parameter strings used to invoke Logs from external applications, e.g Phone, Missed Call
       
  1044     //Notification, Help. Note that AppShell does not use this method but instead uses view 
       
  1045     //based invocation (for ELogAppListViewId)
       
  1046     
       
  1047      //1. Officially supported Logs views fo opening.    
       
  1048     _LIT8(m_old,"m");      //This can be removed when missed indicator uses the new value
       
  1049 
       
  1050      //2. Non-supported Logs views for opening (for private use).    
       
  1051     _LIT8(events,"events");                 //ELogEventListViewId
       
  1052     _LIT8(timers,"timers");                 //ECtViewId
       
  1053     _LIT8(packetcounter,"packetcounter");   //EGprsCounterViewId
       
  1054     _LIT8(settings,"settings");             //ELogSettingsViewId
       
  1055     _LIT8(callregister,"callregister");     //ELogSubAppListViewId
       
  1056 
       
  1057     //For internal use only    
       
  1058     _LIT8(dontActivate, "dontactivate");
       
  1059     TPtrC8 dontActivateMsg = dontActivate(); 
       
  1060     
       
  1061     // Check first if we are going to background
       
  1062     if (aCommand == EApaCommandBackground)
       
  1063     	{
       
  1064     	HideLogsToBackgroundL();
       
  1065     	}
       
  1066     //1. Officially supported Logs views.
       
  1067     else if( aTail.Compare( LogsUiCmdStarterConsts::KDialledView() ) == 0 )
       
  1068         {
       
  1069         SetProvideOnlyRecentViews( ETrue ); 
       
  1070         SetLogsOpenedWithSendKey( ETrue );           
       
  1071         SetExecutionMode( ELogsInForeground );
       
  1072         ActivateLogsViewL( EStmDialledListViewId );      
       
  1073         }
       
  1074     else if( aTail.Compare( LogsUiCmdStarterConsts::KMissedView() ) == 0 || aTail.Compare( m_old ) == 0 )
       
  1075         {
       
  1076         SetProvideOnlyRecentViews( ETrue );     
       
  1077         SetExecutionMode( ELogsInForeground );
       
  1078         ActivateLogsViewL( EStmMissedListViewId );         
       
  1079         }
       
  1080     else if( aTail.Compare( LogsUiCmdStarterConsts::KReceivedView() ) == 0  )
       
  1081         {
       
  1082         SetProvideOnlyRecentViews( ETrue );   
       
  1083         SetExecutionMode( ELogsInForeground );
       
  1084         ActivateLogsViewL( EStmReceivedListViewId );         
       
  1085         }
       
  1086     else if( aTail.Compare( LogsUiCmdStarterConsts::KCountersView() ) == 0  )
       
  1087         {
       
  1088         SetProvideOnlyRecentViews( EFalse );  
       
  1089         SetExecutionMode( ELogsInForeground );
       
  1090         ActivateLogsViewL( ELogAppListViewId );         
       
  1091         }
       
  1092     
       
  1093     //2. The views below are supported privately *only* for Context sensitive help application. 
       
  1094     //For other uses they are not visible, i.e. are not available in LogsUiCmdStarter because
       
  1095     //Logs application may change in the future (e.g. some views may be dropped). 
       
  1096     //However, when Logs application changes, then the corresponding helps need to be changed too 
       
  1097     //in parallel so we don't end up in situation in which default view is opened instead
       
  1098     //of a requested view that has been removed from Logs.
       
  1099     else if( aTail.Compare( events ) == 0  )
       
  1100         {
       
  1101         SetProvideOnlyRecentViews( EFalse ); 
       
  1102         SetExecutionMode( ELogsInForeground );
       
  1103         ActivateLogsViewL( ELogEventListViewId );         
       
  1104         }
       
  1105     else if( aTail.Compare( timers ) == 0  )
       
  1106         {
       
  1107         SetProvideOnlyRecentViews( EFalse ); 
       
  1108         SetExecutionMode( ELogsInForeground );
       
  1109         ActivateLogsViewL( ECtViewId );         
       
  1110         }
       
  1111     else if( aTail.Compare( packetcounter ) == 0  )
       
  1112         {
       
  1113         SetProvideOnlyRecentViews( EFalse );     
       
  1114         SetExecutionMode( ELogsInForeground );
       
  1115         ActivateLogsViewL( EGprsCounterViewId );         
       
  1116         }
       
  1117     else if( aTail.Compare( settings ) == 0  )
       
  1118         {
       
  1119         SetProvideOnlyRecentViews( EFalse );     
       
  1120         SetExecutionMode( ELogsInForeground );
       
  1121         ActivateLogsViewL( ELogSettingsViewId );         
       
  1122         }
       
  1123     else if( aTail.Compare( callregister ) == 0  )
       
  1124         {
       
  1125         SetProvideOnlyRecentViews( EFalse );    
       
  1126         SetExecutionMode( ELogsInForeground );
       
  1127         ActivateLogsViewL( ELogSubAppListViewId );         
       
  1128         }
       
  1129 
       
  1130     //3. Skip view activation attempts        
       
  1131     else if( aTail.Compare( dontActivateMsg ) == 0  )
       
  1132         {
       
  1133         //No op
       
  1134         }
       
  1135         
       
  1136     //3. Default view
       
  1137     else 
       
  1138         {
       
  1139         SetProvideOnlyRecentViews( EFalse ); 
       
  1140         if (aCommand != EApaCommandBackground )
       
  1141             {
       
  1142             SetExecutionMode( ELogsInForeground );
       
  1143             }
       
  1144       
       
  1145         //AppShell doesn't currently provide option to send cmdline parameter, so provide 
       
  1146         //AppListView (or SubAppListView) as it is probably activated later from AppShell.        
       
  1147         if ( FeatureManager::FeatureSupported( KFeatureIdSimpleLogs ) )
       
  1148             {
       
  1149             ActivateLogsViewL( ELogSubAppListViewId, 
       
  1150                                aCommand == EApaCommandBackground ? 
       
  1151                                    ELogsViewActivationBackground : ELogsViewActivationNoMessage, 
       
  1152                                KNullDesC8() );       
       
  1153             }
       
  1154         else
       
  1155             {    
       
  1156             ActivateLogsViewL( ELogAppListViewId, 
       
  1157                                aCommand == EApaCommandBackground ? 
       
  1158                                    ELogsViewActivationBackground : ELogsViewActivationNoMessage, 
       
  1159                                KNullDesC8() ); 
       
  1160             }
       
  1161         }
       
  1162         
       
  1163     // We have received a commandline parameter so no need to reset to Logs main view
       
  1164     // when foreground\focus regained (see HandleWsEvent).
       
  1165     SetResetViewOnFocusRegain(EFalse); 
       
  1166     
       
  1167     TRACE_EXIT_POINT;
       
  1168     return CAknViewAppUi::ProcessCommandParametersL( aCommand, aDocumentName, aTail );        
       
  1169     }
       
  1170 
       
  1171 // ----------------------------------------------------------------------------
       
  1172 // CLogsAppUi::StartApplicationL
       
  1173 //
       
  1174 // Start an external application
       
  1175 // ----------------------------------------------------------------------------
       
  1176 //
       
  1177 TBool CLogsAppUi::StartApplicationL(
       
  1178     TUid aUid,
       
  1179     const TDesC8& aTail )
       
  1180     {
       
  1181     TApaTaskList taskList( CCoeEnv::Static()->WsSession() );
       
  1182     TApaTask task = taskList.FindApp( aUid );
       
  1183     
       
  1184     if( task.Exists() ) 
       
  1185         {
       
  1186         const TUid dummyUID = { 0x0 };
       
  1187         task.SendMessage( dummyUID, aTail );
       
  1188         task.BringToForeground();  
       
  1189         }
       
  1190     else
       
  1191         { 
       
  1192         TApaAppInfo appInfo;
       
  1193         RApaLsSession lsSession;
       
  1194         User::LeaveIfError( lsSession.Connect() );        
       
  1195         CleanupClosePushL( lsSession );
       
  1196         
       
  1197         if( lsSession.GetAppInfo( appInfo, aUid ) == KErrNone )
       
  1198             {
       
  1199             CApaCommandLine* cmdLine = CApaCommandLine::NewLC();
       
  1200             cmdLine->SetExecutableNameL( appInfo.iFullName );
       
  1201             cmdLine->SetCommandL( EApaCommandRun );
       
  1202             cmdLine->SetTailEndL( aTail );
       
  1203 
       
  1204             lsSession.StartApp( *cmdLine );
       
  1205             CleanupStack::PopAndDestroy( cmdLine );
       
  1206             }
       
  1207 
       
  1208         CleanupStack::PopAndDestroy();  // lsSession
       
  1209         }
       
  1210         
       
  1211     return 0;
       
  1212     }
       
  1213 
       
  1214     // If Logs is background,returns is True,otherwise False.
       
  1215     TBool CLogsAppUi::IsBackground() const
       
  1216       {
       
  1217         CCoeEnv * env = CCoeEnv::Static();
       
  1218         TInt ordinal = env->RootWin().OrdinalPosition();
       
  1219         return ordinal != 0;
       
  1220       }
       
  1221 
       
  1222 
       
  1223 //  End of File