logsui/AppSrc/CLogsAppUi.cpp
changeset 0 e686773b3f54
child 3 04ab22b956c2
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 // 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 ) ) )  
       
   264         {
       
   265         CAknView* logsView = CLogsAppListView::NewL();    
       
   266         CleanupStack::PushL(logsView);
       
   267         AddViewL( logsView );       //takes ownership
       
   268         CleanupStack::Pop(logsView);   
       
   269         }
       
   270         
       
   271     TRACE_EXIT_POINT;
       
   272     }
       
   273 
       
   274 
       
   275 /**********************************************************************
       
   276 Not in use anymore, Phonebook icons replaced by own icons 
       
   277 
       
   278 CArrayFix<TPbkIconId>* CLogsAppUi::IconIdArray()
       
   279     {
       
   280     return iIconIdArray;
       
   281     }
       
   282 
       
   283 CPbkIconInfoContainer* CLogsAppUi::IconInfoContainer()
       
   284     {
       
   285     return iIconInfoContainer;
       
   286     }
       
   287 **********************************************************************/    
       
   288 
       
   289 // ----------------------------------------------------------------------------
       
   290 // CLogsAppUi::CmdExit
       
   291 // ----------------------------------------------------------------------------
       
   292 //
       
   293 void CLogsAppUi::CmdExit()
       
   294     {
       
   295     
       
   296 /*******************************************************************************
       
   297  FIXME: Toolbar is currently always on - keeping the toolbar visibility handling 
       
   298         sources in comments for now - remove later.   
       
   299     //Proceed to exit even if leave would happen
       
   300     TInt err;
       
   301     TRAP( err, iEngine->SharedDataL()->SetToolbarVisibility( iShowToolbar ? 1 : 0 ) ); //0=no toolbar  
       
   302 *******************************************************************************/    
       
   303 
       
   304     Exit();
       
   305     }
       
   306 
       
   307 // ----------------------------------------------------------------------------
       
   308 // CLogsAppUi::CmdBackL
       
   309 // ----------------------------------------------------------------------------
       
   310 //
       
   311 void CLogsAppUi::CmdBackL()
       
   312     {
       
   313     switch( iCurrentViewId.iUid )
       
   314         {
       
   315         case ELogDetailViewId:
       
   316             ActivateLogsViewL( ELogEventListViewId );
       
   317             break;
       
   318 
       
   319         case ELogSettingsViewId:
       
   320             ActivateLogsViewL( static_cast<TLogsViewIds>( iPreviousViewId.iUid ) );
       
   321             break;
       
   322 
       
   323         case EStmMissedListViewId: // fall through
       
   324         case EStmReceivedListViewId:
       
   325         case EStmDialledListViewId:
       
   326             ActivateLogsViewL( ELogSubAppListViewId );
       
   327             break;
       
   328 
       
   329         case ELogSubAppListViewId: // fall through
       
   330         case ECtViewId:
       
   331         case EGprsCounterViewId:
       
   332             ActivateLogsViewL( ELogAppListViewId );
       
   333             break;
       
   334 
       
   335         default:
       
   336             break;
       
   337         }
       
   338     }
       
   339 
       
   340 // ----------------------------------------------------------------------------
       
   341 // CLogsAppUi::ActivateLogsViewL
       
   342 // ----------------------------------------------------------------------------
       
   343 //
       
   344 void CLogsAppUi::ActivateLogsViewL( TLogsViewIds aView )
       
   345     {
       
   346     ActivateLogsViewL( aView, ELogsViewActivationNoMessage, KNullDesC8()); 
       
   347     }
       
   348 
       
   349 // ----------------------------------------------------------------------------
       
   350 // CLogsAppUi::ActivateLogsViewL
       
   351 //
       
   352 // Activate requested view. The view is also created if it does not already exist.
       
   353 // ----------------------------------------------------------------------------
       
   354 //
       
   355 void CLogsAppUi::ActivateLogsViewL( 
       
   356     TLogsViewIds aView,
       
   357     TLogsViewActivationMessages aCustomMessageId,
       
   358     const TDesC8& aCustomMessage )
       
   359     {
       
   360     TRACE_ENTRY_POINT;
       
   361     
       
   362     TBool rc( ETrue );
       
   363     CAknView* logsView = View( TUid::Uid( aView ));
       
   364 
       
   365     //If the view does not already exist, let's try to create it first
       
   366     if( !logsView ) 
       
   367         {
       
   368         switch( aView )  //not yet exists, create the view
       
   369             {
       
   370             case ELogAppListViewId:
       
   371                 logsView = CLogsAppListView::NewL();
       
   372                 CleanupStack::PushL(logsView);
       
   373                 break;
       
   374 
       
   375             case ELogSubAppListViewId:
       
   376                 logsView = CLogsSubAppListView::NewL();
       
   377                 CleanupStack::PushL(logsView);
       
   378                 break;
       
   379 
       
   380             case ELogEventListViewId:
       
   381                 logsView = CLogsEventListView::NewL();
       
   382                 CleanupStack::PushL(logsView);
       
   383                 break;
       
   384 
       
   385             case EStmMissedListViewId:
       
   386                 logsView = CLogsRecentListView::NewL( ELogsMissedModel );
       
   387                 CleanupStack::PushL(logsView);
       
   388                 break;
       
   389 
       
   390             case EStmReceivedListViewId:
       
   391                 logsView = CLogsRecentListView::NewL( ELogsReceivedModel );
       
   392                 CleanupStack::PushL(logsView);
       
   393                 break;
       
   394 
       
   395             case EStmDialledListViewId:
       
   396                 logsView = CLogsRecentListView::NewL( ELogsDialledModel );
       
   397                 CleanupStack::PushL(logsView);
       
   398                 break;
       
   399 
       
   400             case ELogDetailViewId:
       
   401                 logsView = CLogsDetailView::NewL();
       
   402                 CleanupStack::PushL(logsView);
       
   403                 break; 
       
   404 
       
   405             case EGprsCounterViewId:
       
   406                 logsView = CGprsCtView::NewL();
       
   407                 CleanupStack::PushL(logsView);
       
   408                 break;
       
   409 
       
   410             case ELogSettingsViewId:  //viewId is implementation UID too in this case
       
   411                 //Settings is a Ecom plugin (implements CGSPluginInterface). CGSPluginInterface.cpp
       
   412                 //takes care of needed ecom clear up issues.
       
   413                 //Note! REComSession::FinalClose() is called in CLogsDocument destructor. Calling
       
   414                 //in CLogsAppUi dtor is too early as view framework destroys the view *after* appui has already 
       
   415                 //been destroyed.
       
   416                 {
       
   417                 CGSPluginInterface* gs = CGSPluginInterface::NewL( TUid::Uid( aView ), NULL); 
       
   418                 logsView = static_cast<CGSPluginInterface*>(gs);
       
   419                 CleanupStack::PushL(logsView);                
       
   420                 gs->CustomOperationL( NULL, NULL );
       
   421                 }
       
   422                 break;
       
   423                                    
       
   424             case ECtViewId:
       
   425                 logsView = CCtView::NewL();
       
   426                 CleanupStack::PushL(logsView);
       
   427                 break;
       
   428 
       
   429             default:
       
   430                 break;
       
   431             }
       
   432 
       
   433         if( logsView )
       
   434             {                       //Registers the view with the view server            
       
   435             AddViewL( logsView );   // takes ownership of logsView 
       
   436             CleanupStack::Pop(logsView);   
       
   437             }
       
   438         else
       
   439             {
       
   440             rc = EFalse;
       
   441             }
       
   442         }
       
   443 
       
   444     //Activate the requested view
       
   445     if( rc )
       
   446         {    
       
   447         ActivateLocalViewL( TUid::Uid( aView ), 
       
   448                             TUid::Uid( aCustomMessageId ), 
       
   449                             aCustomMessage );
       
   450          
       
   451         // If activating settings view, call SetCurrentViewId here, cause
       
   452         // settings view can't access CLogsAppUi's functions
       
   453         if (aView == ELogSettingsViewId)
       
   454         	{
       
   455         	SetCurrentViewId(TUid::Uid(aView));
       
   456         	}
       
   457         }
       
   458         
       
   459     TRACE_EXIT_POINT;
       
   460     }
       
   461 
       
   462 // ----------------------------------------------------------------------------
       
   463 // CLogsAppUi::SetPreviousViewId
       
   464 // ----------------------------------------------------------------------------
       
   465 //
       
   466 void CLogsAppUi::SetPreviousViewId( TUid aView )
       
   467     {
       
   468     iPreviousViewId = aView;
       
   469     }
       
   470 
       
   471 // ----------------------------------------------------------------------------
       
   472 // CLogsAppUi::SetCurrentViewId
       
   473 // ----------------------------------------------------------------------------
       
   474 //
       
   475 void CLogsAppUi::SetCurrentViewId( TUid aView )
       
   476     {
       
   477     iCurrentViewId = aView;
       
   478     }
       
   479 
       
   480 // ----------------------------------------------------------------------------
       
   481 // CLogsAppUi::CmdOkL
       
   482 // ----------------------------------------------------------------------------
       
   483 //
       
   484 void CLogsAppUi::CmdOkL( TInt aIndex )
       
   485     {    
       
   486     if( TUid::Uid( ELogAppListViewId ) == iCurrentViewId )
       
   487         {        
       
   488         switch( aIndex )
       
   489             {
       
   490             case EStmStmSubAppId:
       
   491                 ActivateLogsViewL( ELogSubAppListViewId );
       
   492                 break;
       
   493 
       
   494             case EStmTimersSubAppId:
       
   495                 ActivateLogsViewL( ECtViewId );
       
   496                 break;
       
   497 
       
   498             case EGprsCountSubAppId:
       
   499                 ActivateLogsViewL( EGprsCounterViewId );
       
   500                 break;
       
   501 
       
   502             default:
       
   503                 break;
       
   504             }
       
   505         }
       
   506     
       
   507     else if( TUid::Uid( ELogSubAppListViewId ) == iCurrentViewId )
       
   508         {
       
   509         switch( aIndex )
       
   510             {
       
   511             case EStmMissedId:
       
   512                 ActivateLogsViewL( EStmMissedListViewId );
       
   513                 break;
       
   514 
       
   515             case EStmReceivedId:
       
   516                 ActivateLogsViewL( EStmReceivedListViewId );
       
   517                 break;
       
   518 
       
   519             case EStmDialledId:
       
   520                 ActivateLogsViewL( EStmDialledListViewId );
       
   521                 break;
       
   522 
       
   523             default:
       
   524                 break;
       
   525             }
       
   526         }
       
   527     
       
   528     else if( TUid::Uid( ELogEventListViewId ) == iCurrentViewId )
       
   529         {
       
   530         if( iEngine->Model( ELogsMainModel )->Count() )
       
   531             {
       
   532             ActivateLogsViewL( ELogDetailViewId );
       
   533             }
       
   534         }
       
   535     }
       
   536 
       
   537 // ----------------------------------------------------------------------------
       
   538 // CLogsAppUi::HandleCommandL
       
   539 // ----------------------------------------------------------------------------
       
   540 //
       
   541 void CLogsAppUi::HandleCommandL( TInt aCommand )
       
   542     {
       
   543     TRACE_ENTRY_POINT;
       
   544     switch( aCommand )
       
   545         {
       
   546         case EEikCmdExit:   //We receive this when e.g. close app is selected in fast swapping list.
       
   547             {
       
   548             LOGS_DEBUG_PRINT(LOGS_DEBUG_STRING
       
   549             		( "CLogsAppUi::HandleCommandL(0x%x) - EEikCmdExit: real exit"), this );
       
   550             CmdExit(); //Do real exit (close Logs).
       
   551             break;     
       
   552             }
       
   553             
       
   554         case EAknCmdHideInBackground:
       
   555             {
       
   556             TBool hideInBg( ETrue );
       
   557 #ifdef _DEBUG  //Debug mode, logs exits completely
       
   558             hideInBg = EFalse;  
       
   559 #endif
       
   560             if(hideInBg)
       
   561                 {
       
   562                 LOGS_DEBUG_PRINT(LOGS_DEBUG_STRING
       
   563                         ( "CLogsAppUi::HandleCommandL(0x%x) - EAknCmdHideInBackground: fake exit"), this );
       
   564                 // Fake exit - leave app to memory but hide from user
       
   565                  HideLogsToBackgroundL();
       
   566                 }
       
   567             else
       
   568                 { 
       
   569                 LOGS_DEBUG_PRINT(LOGS_DEBUG_STRING
       
   570                         ( "CLogsAppUi::HandleCommandL(0x%x) - EAknCmdHideInBackground: exit completely"), this );
       
   571                 //logs exits completely
       
   572                 CmdExit();
       
   573                 }
       
   574             break;
       
   575             }
       
   576         
       
   577         case EAknSoftkeyExit:
       
   578         case ELogsCmdMenuExit:
       
   579             {
       
   580             if (ExitHidesInBackground())
       
   581             	{
       
   582             	LOGS_DEBUG_PRINT(LOGS_DEBUG_STRING
       
   583             			( "CLogsAppUi::HandleCommandL(0x%x) - EAknSoftkeyExit: fake exit"), this ); 
       
   584             	// Fake exit - leave app to memory but hide from user
       
   585             	HideLogsToBackgroundL();
       
   586             	}
       
   587             else
       
   588             	{
       
   589             	LOGS_DEBUG_PRINT(LOGS_DEBUG_STRING
       
   590             			( "CLogsAppUi::HandleCommandL(0x%x) - EAknSoftkeyExit: real exit"), this ); 
       
   591             	//Do real exit, close Logs.
       
   592             	CmdExit(); 
       
   593             	}
       
   594             break;
       
   595             }       
       
   596 
       
   597         case ELogsCmdMenuSettings:
       
   598             ActivateLogsViewL( ELogSettingsViewId );
       
   599             break;
       
   600 
       
   601         case ELogsCmdFailedDueActiveCall:
       
   602             {
       
   603             CAknNoteDialog* noteDlg = new( ELeave ) CAknNoteDialog( CAknNoteDialog::ENoTone,
       
   604                             CAknNoteDialog::ELongTimeout );
       
   605             noteDlg->ExecuteLD( R_LOGS_NOTE_DURING_CALL_OPTION_NOT_ALLOWED );
       
   606             break;
       
   607             }
       
   608 
       
   609         case EAknCmdHelp:
       
   610             {
       
   611             HlpLauncher::LaunchHelpApplicationL(iEikonEnv->WsSession(), AppHelpContextL());
       
   612             break;
       
   613             }
       
   614 
       
   615         default:
       
   616             iExitOrEndPressed = ENone;      //Reset also here 
       
   617             break;          
       
   618         }
       
   619         
       
   620     TRACE_EXIT_POINT;
       
   621     }
       
   622 
       
   623 // ----------------------------------------------------------------------------
       
   624 // CLogsAppUi::HideLogsToBackgroundL
       
   625 // Leave the application in memory
       
   626 // ----------------------------------------------------------------------------
       
   627 //
       
   628 void CLogsAppUi::HideLogsToBackgroundL()
       
   629     {  
       
   630     TRACE_ENTRY_POINT;
       
   631     
       
   632     //+ __GFXTRANS__
       
   633        
       
   634     // Always use exit effect even if this is actually application switch
       
   635     // Note: Not allowed to call GfxTransEffect::EndFullScreen() as AVKON takes care of that when
       
   636     // EApplicationExit context is used!  
       
   637     // Set effect begin point
       
   638        			
       
   639    	iExitOrEndPressed = EExitPressed; 	//Reset to obey EEikCmdExit to do real exit (e.g. in case low mem, backup etc)                           
       
   640    	SetExecutionMode( ELogsInBackground_ExitOrEndPressed );
       
   641 
       
   642    	//Clear info whether we were called externally (Provide complete Logs to user next time)
       
   643    	SetProvideOnlyRecentViews( EFalse ); 
       
   644    	                
       
   645    	// In case foreground is later gained without commandline parameters, switch to 
       
   646    	// Logs main view instead of the Dialled calls view.   
       
   647     SetResetViewOnFocusRegain(ETrue);
       
   648     
       
   649     //Reset the ALS view selection for counters view, so that next time when Logs is opened all lines 
       
   650    	//are again shown as default
       
   651    	if ( View( TUid::Uid( ECtViewId ))) //View() returns null if view doesn't exist
       
   652    		{
       
   653    	    CCtView* view = static_cast<CCtView*>( View( TUid::Uid( ECtViewId )));
       
   654    	    view->SetAlsLine( EAllLines );
       
   655    	    }
       
   656     
       
   657     // Delete contact link checker when hiding log to background
       
   658     Engine()->DeleteCntLinkChecker();
       
   659     
       
   660    	// With the ELogsViewActivationBackground message, the ActivateLogsViewL will send
       
   661    	// a view activation message and we can go to background before it completes.
       
   662    	// We leave dialled calls view open as that is the most important use case for Logs
       
   663    	SetCustomControl(1);
       
   664    	ActivateLogsViewL(EStmDialledListViewId, ELogsViewActivationBackground, KNullDesC8());
       
   665    	      
       
   666     TRACE_EXIT_POINT;
       
   667     }
       
   668 
       
   669 // ----------------------------------------------------------------------------
       
   670 // CLogsAppUi::HandleWsEventL
       
   671 // ----------------------------------------------------------------------------
       
   672 //
       
   673 void CLogsAppUi::HandleWsEventL(
       
   674     const TWsEvent& aEvent,
       
   675     CCoeControl* aDestination )
       
   676     {
       
   677     TRACE_ENTRY_POINT;
       
   678     switch (aEvent.Type())
       
   679         {
       
   680         case EEventFocusGained:
       
   681             {
       
   682             // If Logs is on background because Exit has been pressed, and we have not received
       
   683             // a commandline message, Logs main view is to be activated when regaining foreground.
       
   684             //
       
   685             // This handling is needed due to the performance optimization of dialled calls used case
       
   686             // where we leave dialled calls view on background after user selecting Exit. 
       
   687             // This handling prevents errors like MMAN-6VADLV or MMHI-6V7ABV.
       
   688             // 
       
   689             if (ExecutionMode() == ELogsInBackground_ExitOrEndPressed && ResetViewOnFocusRegain())
       
   690                 {
       
   691                 SetResetViewOnFocusRegain(EFalse); // prevent further view switches
       
   692                 ActivateLogsViewL(ELogAppListViewId);
       
   693                 }
       
   694            
       
   695             CAknAppUi::HandleWsEventL( aEvent, aDestination );                    
       
   696             break;
       
   697             }
       
   698             
       
   699         case KAknUidValueEndKeyCloseEvent:  //0x101F87F0  (Avkon.hrh)
       
   700 
       
   701             //We have received KAknUidValueEndKeyCloseEvent. Let it go to FW (so we dont catch it here). 
       
   702             //Next we can wait EEikCmdExit to be received from FW to our HandleCommandL.
       
   703             iExitOrEndPressed = EEndPressed;  
       
   704                    
       
   705           
       
   706             /*******************************************************************************
       
   707              FIXME: Toolbar is currently always on - keeping the toolbar visibility handling 
       
   708                     sources in comments for now - remove later.
       
   709                     
       
   710             //IsShown() happens too late in CmdExit() when End key is pressed as Toolbar
       
   711             //has already hidden itself. So get status here (i.e cannot be done when EEikCmdExit 
       
   712             //is received e.g because of backup)
       
   713             if( CurrentPopupToolbar() ) 
       
   714                 {
       
   715                 iShowToolbar = CurrentPopupToolbar()->IsShown(); //iToolbarRef->IsShown();     
       
   716                 }
       
   717             ********************************************************************************/                 
       
   718 
       
   719         default:
       
   720             
       
   721             // All other events are forwarded normally to base class
       
   722             CAknAppUi::HandleWsEventL( aEvent, aDestination ); 
       
   723             break;
       
   724         }
       
   725         
       
   726     TRACE_EXIT_POINT;    
       
   727     }
       
   728 
       
   729 
       
   730 // ----------------------------------------------------------------------------
       
   731 // CLogsAppUi::ResetToLogsMainView
       
   732 // ----------------------------------------------------------------------------
       
   733 //
       
   734 TBool CLogsAppUi::ResetViewOnFocusRegain() const
       
   735     {
       
   736     return iResetToMain;
       
   737     }
       
   738 
       
   739 // ----------------------------------------------------------------------------
       
   740 // CLogsAppUi::SetResetToLogsMainView
       
   741 // ----------------------------------------------------------------------------
       
   742 //		
       
   743 void CLogsAppUi::SetResetViewOnFocusRegain(TBool aResetToMain)
       
   744     {
       
   745     iResetToMain = aResetToMain;
       
   746     }
       
   747 		
       
   748 		
       
   749 // ----------------------------------------------------------------------------
       
   750 // CLogsAppUi::ActiveViewId
       
   751 // ----------------------------------------------------------------------------
       
   752 //
       
   753 TLogsViewIds CLogsAppUi::ActiveViewId()
       
   754     {
       
   755     return TLogsViewIds( iCurrentViewId.iUid );
       
   756     }
       
   757 
       
   758 // ----------------------------------------------------------------------------
       
   759 // CLogsAppUi::PreviousAppUid
       
   760 // ----------------------------------------------------------------------------
       
   761 //
       
   762 TUid CLogsAppUi::PreviousAppUid() const
       
   763     {
       
   764     return iPreviousAppUid;
       
   765     }
       
   766 
       
   767 
       
   768 // ----------------------------------------------------------------------------
       
   769 // CLogsAppUi::SetPreviousAppUid
       
   770 // ----------------------------------------------------------------------------
       
   771 //
       
   772 void CLogsAppUi::SetPreviousAppUid( TUid aUid )
       
   773     {
       
   774     iPreviousAppUid = aUid;
       
   775     }
       
   776 
       
   777 // ----------------------------------------------------------------------------
       
   778 // CLogsAppUi::SetProvideOnlyRecentViews
       
   779 // ----------------------------------------------------------------------------
       
   780 //
       
   781 void CLogsAppUi::SetProvideOnlyRecentViews( TBool aProvideOnlyRecentViews )
       
   782     {
       
   783     iProvideOnlyRecentViews = aProvideOnlyRecentViews;
       
   784     }
       
   785 
       
   786 // ----------------------------------------------------------------------------
       
   787 // CLogsAppUi::ProvideOnlyRecentViews
       
   788 // ----------------------------------------------------------------------------
       
   789 //
       
   790 TBool CLogsAppUi::ProvideOnlyRecentViews() const
       
   791     {
       
   792     return iProvideOnlyRecentViews;
       
   793     }
       
   794 
       
   795 // ----------------------------------------------------------------------------
       
   796 // CLogsAppUi::TabChangedL
       
   797 //
       
   798 // Activates the Logs view that corresponds to tab id of activated tab in tab group in navi pane
       
   799 // ----------------------------------------------------------------------------
       
   800 //
       
   801 void CLogsAppUi::TabChangedL(TInt aIndex)
       
   802     {
       
   803 #if defined(_DEBUG)
       
   804     _LIT( KPanicMsg, "CLogsAppUi::TabChangedL");
       
   805     CEikStatusPane* statusPane = NULL;
       
   806     statusPane = iEikonEnv->AppUiFactory()->StatusPane();
       
   807 #endif  // _DEBUG
       
   808 
       
   809     __ASSERT_DEBUG( statusPane, User::Panic(KPanicMsg, KErrCorrupt) );
       
   810 
       
   811     CAknNavigationControlContainer* naviCtrlContainer = NULL;
       
   812     naviCtrlContainer = static_cast<CAknNavigationControlContainer*>( StatusPane()->
       
   813                     ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) );
       
   814     __ASSERT_DEBUG( naviCtrlContainer, User::Panic(KPanicMsg, KErrCorrupt) );
       
   815 
       
   816     CAknNavigationDecorator* decorator = naviCtrlContainer->Top();
       
   817     __ASSERT_DEBUG( decorator && decorator->ControlType() == CAknNavigationDecorator::ETabGroup,
       
   818                     User::Panic(KPanicMsg, KErrCorrupt));
       
   819 
       
   820     CAknTabGroup* tabGroup = static_cast<CAknTabGroup*>(decorator->DecoratedControl());
       
   821     __ASSERT_DEBUG( tabGroup && aIndex >= 0 && aIndex < tabGroup->TabCount(),
       
   822                     User::Panic(KPanicMsg, KErrCorrupt));
       
   823 
       
   824     //TabIds in resource file are same as viewIds, so we can use them directly to activate a view
       
   825     const TInt viewId(tabGroup->TabIdFromIndex(aIndex));
       
   826     ActivateLogsViewL(static_cast<TLogsViewIds>(viewId));
       
   827     }
       
   828 
       
   829 // ----------------------------------------------------------------------------
       
   830 // CLogsAppUi::EventListViewCurrent
       
   831 // ----------------------------------------------------------------------------
       
   832 //
       
   833 TInt CLogsAppUi::EventListViewCurrent() const
       
   834     {
       
   835     CAknView* view = View( TUid::Uid( ELogEventListViewId ) );
       
   836 
       
   837     if( view )
       
   838         {
       
   839         return ( static_cast<CLogsEventListView*>( view ) )->EventListCurrent();
       
   840         }
       
   841     else
       
   842         {
       
   843         return KErrNotFound;
       
   844         }
       
   845     }
       
   846 
       
   847 // ----------------------------------------------------------------------------
       
   848 // CLogsAppUi::SetEventListViewCurrent
       
   849 // ----------------------------------------------------------------------------
       
   850 //
       
   851 void CLogsAppUi::SetEventListViewCurrent( TInt aCurrent )
       
   852     {
       
   853     CAknView* view = View( TUid::Uid( ELogEventListViewId ) );
       
   854 
       
   855     if( view )
       
   856         {
       
   857         ( static_cast<CLogsEventListView*>( view ) )->
       
   858                                 SetEventListCurrent( aCurrent );
       
   859         }
       
   860     }
       
   861 
       
   862 // ----------------------------------------------------------------------------
       
   863 // CLogsAppUi::ExecutionMode
       
   864 // ----------------------------------------------------------------------------
       
   865 //
       
   866 TInt CLogsAppUi::ExecutionMode() const
       
   867     {
       
   868     return iExecutionMode;
       
   869     }
       
   870 
       
   871 // ----------------------------------------------------------------------------
       
   872 // CLogsAppUi::SetExecutionMode
       
   873 // ----------------------------------------------------------------------------
       
   874 //
       
   875 void CLogsAppUi::SetExecutionMode( TInt aMode )
       
   876     {
       
   877     if (aMode == ELogsInForeground )
       
   878         {
       
   879         // Make sure that the view gets foreground when view activated.
       
   880         SetCustomControl(0);
       
   881         }
       
   882     iExecutionMode = aMode;
       
   883     }
       
   884 
       
   885 // ----------------------------------------------------------------------------
       
   886 // CLogsAppUi::LogsOpenedWithSendKey
       
   887 // ----------------------------------------------------------------------------
       
   888 //    
       
   889 TBool CLogsAppUi::LogsOpenedWithSendKey()
       
   890     {
       
   891     return iLogsOpenedWithSendKey;
       
   892     }
       
   893 
       
   894 // ----------------------------------------------------------------------------
       
   895 // CLogsAppUi::SetLogsOpenedWithSendKey
       
   896 // ----------------------------------------------------------------------------
       
   897 //  
       
   898 void CLogsAppUi::SetLogsOpenedWithSendKey(TBool aLogsOpenedWithSendKey)
       
   899     {
       
   900     iLogsOpenedWithSendKey = aLogsOpenedWithSendKey;
       
   901     }    
       
   902 
       
   903 /*******************************************************************************
       
   904  FIXME: Toolbar is currently always on - keeping the toolbar visibility handling 
       
   905         sources in comments for now - remove later.
       
   906         
       
   907 // ----------------------------------------------------------------------------
       
   908 // CLogsAppUi::ToolbarVisibility()
       
   909 // ----------------------------------------------------------------------------
       
   910 //
       
   911 TInt CLogsAppUi::ToolbarVisibility() const
       
   912     {
       
   913     return iShowToolbar; 
       
   914     }
       
   915  
       
   916 // ----------------------------------------------------------------------------
       
   917 // CLogsAppUi::RecordToolbarVisibility()
       
   918 //
       
   919 // Record current toolbar visibility 
       
   920 // ----------------------------------------------------------------------------
       
   921 //
       
   922 void CLogsAppUi::RecordToolbarVisibility() 
       
   923     { 
       
   924     CAknView* view = View( iCurrentViewId  );
       
   925 
       
   926     if( view && view->IsForeground())
       
   927         {
       
   928         switch( iCurrentViewId.iUid )
       
   929             {
       
   930             case ELogEventListViewId:
       
   931             case EStmMissedListViewId:
       
   932             case EStmReceivedListViewId:
       
   933             case EStmDialledListViewId:
       
   934             case ELogDetailViewId:
       
   935                 if( CurrentPopupToolbar() ) 
       
   936                     {
       
   937                     iShowToolbar = CurrentPopupToolbar()->IsShown(); 
       
   938                     }
       
   939             }
       
   940         }      
       
   941     }
       
   942  *******************************************************************************/
       
   943    
       
   944 // ----------------------------------------------------------------------------
       
   945 // CLogsAppUi::HandleControlEventL
       
   946 //
       
   947 // from MCoeControlObserver        
       
   948 // ----------------------------------------------------------------------------
       
   949 //
       
   950 void CLogsAppUi::HandleControlEventL( 
       
   951     CCoeControl* /* aControl */,   
       
   952     TCoeEvent /* aEventType */ ) 
       
   953     {
       
   954     }
       
   955 
       
   956 // --------------------------------------------------------------------------
       
   957 // CLogsAppUi::DynInitToolbarL
       
   958 // --------------------------------------------------------------------------
       
   959 //
       
   960 void CLogsAppUi::DynInitToolbarL( 
       
   961     TInt /* aResourceId */, 
       
   962     CAknToolbar* /* aToolbar */ )
       
   963     {
       
   964     }
       
   965 
       
   966 // --------------------------------------------------------------------------
       
   967 // CLogsAppUi::OfferToolbarEventL
       
   968 // --------------------------------------------------------------------------
       
   969 //
       
   970 void CLogsAppUi::OfferToolbarEventL( TInt aCommand )
       
   971     {
       
   972     ProcessCommandL( aCommand );
       
   973     }    
       
   974 
       
   975 // ----------------------------------------------------------------------------
       
   976 // CLogsAppUi::HandleMessageL
       
   977 //
       
   978 // Handle message sent by Logs client. Called by framework, when LogsUiCmdStarter
       
   979 // request invocation of a specific view.
       
   980 // ----------------------------------------------------------------------------
       
   981 //
       
   982 MCoeMessageObserver::TMessageResponse CLogsAppUi::HandleMessageL(
       
   983     TUint32 aClientHandleOfTargetWindowGroup,
       
   984     TUid aMessageUid,
       
   985     const TDesC8& aMessageParameters )
       
   986     {
       
   987     // If aTail is set, other app starts Logs
       
   988     if (aMessageParameters.Length())
       
   989 	    {
       
   990 		TFileName dummy;
       
   991   		TApaCommand cmd=EApaCommandRun;
       
   992   		ProcessCommandParametersL(cmd,dummy,aMessageParameters);
       
   993   		return EMessageHandled;
       
   994 	    }
       
   995 
       
   996     return CAknViewAppUi::HandleMessageL(
       
   997         aClientHandleOfTargetWindowGroup,
       
   998         aMessageUid,
       
   999         aMessageParameters);
       
  1000     }
       
  1001 
       
  1002 // ----------------------------------------------------------------------------
       
  1003 // CLogsAppUi::ProcessCommandParametersL
       
  1004 //
       
  1005 // Called by framework when external application requests startup of Logs and invocation 
       
  1006 // of a specific view. Also called by Logs when Logs has received a message requesting 
       
  1007 // invocation of a specific view. Orginators of these messages are:
       
  1008 // - LogsUiCmdStarter::CmdStartL / LogsUiCmdStarter::CmdStart 
       
  1009 // - CAknSoftNotificationSubject::LaunchMissedCallsAppL()
       
  1010 // - Context sensitive Help application (when certain logs view can be opened from help)
       
  1011 //
       
  1012 // IMPORTANT: This command line parameter interface is PRIVATE and may be replaced
       
  1013 // in future with more generic solution. So do not use this unless agreed with Logs
       
  1014 // project.
       
  1015 //
       
  1016 // For invocation of Logs application use the LogsUiCmdStarter helper functionality 
       
  1017 // available in LogsUiCmdStarter.h.
       
  1018 //
       
  1019 // ----------------------------------------------------------------------------
       
  1020 //
       
  1021 TBool CLogsAppUi::ProcessCommandParametersL(
       
  1022     TApaCommand aCommand,
       
  1023     TFileName& aDocumentName,
       
  1024     const TDesC8& aTail )
       
  1025     {
       
  1026     TRACE_ENTRY_POINT;
       
  1027     
       
  1028     //Parameter strings used to invoke Logs from external applications, e.g Phone, Missed Call
       
  1029     //Notification, Help. Note that AppShell does not use this method but instead uses view 
       
  1030     //based invocation (for ELogAppListViewId)
       
  1031     
       
  1032      //1. Officially supported Logs views fo opening.    
       
  1033     _LIT8(m_old,"m");      //This can be removed when missed indicator uses the new value
       
  1034 
       
  1035      //2. Non-supported Logs views for opening (for private use).    
       
  1036     _LIT8(events,"events");                 //ELogEventListViewId
       
  1037     _LIT8(timers,"timers");                 //ECtViewId
       
  1038     _LIT8(packetcounter,"packetcounter");   //EGprsCounterViewId
       
  1039     _LIT8(settings,"settings");             //ELogSettingsViewId
       
  1040     _LIT8(callregister,"callregister");     //ELogSubAppListViewId
       
  1041 
       
  1042     //For internal use only    
       
  1043     _LIT8(dontActivate, "dontactivate");
       
  1044     TPtrC8 dontActivateMsg = dontActivate(); 
       
  1045     
       
  1046     // Check first if we are going to background
       
  1047     if (aCommand == EApaCommandBackground)
       
  1048     	{
       
  1049     	HideLogsToBackgroundL();
       
  1050     	}
       
  1051     //1. Officially supported Logs views.
       
  1052     else if( aTail.Compare( LogsUiCmdStarterConsts::KDialledView() ) == 0 )
       
  1053         {
       
  1054         SetProvideOnlyRecentViews( ETrue ); 
       
  1055         SetLogsOpenedWithSendKey( ETrue );           
       
  1056         SetExecutionMode( ELogsInForeground );
       
  1057         ActivateLogsViewL( EStmDialledListViewId );      
       
  1058         }
       
  1059     else if( aTail.Compare( LogsUiCmdStarterConsts::KMissedView() ) == 0 || aTail.Compare( m_old ) == 0 )
       
  1060         {
       
  1061         SetProvideOnlyRecentViews( ETrue );     
       
  1062         SetExecutionMode( ELogsInForeground );
       
  1063         ActivateLogsViewL( EStmMissedListViewId );         
       
  1064         }
       
  1065     else if( aTail.Compare( LogsUiCmdStarterConsts::KReceivedView() ) == 0  )
       
  1066         {
       
  1067         SetProvideOnlyRecentViews( ETrue );   
       
  1068         SetExecutionMode( ELogsInForeground );
       
  1069         ActivateLogsViewL( EStmReceivedListViewId );         
       
  1070         }
       
  1071     else if( aTail.Compare( LogsUiCmdStarterConsts::KCountersView() ) == 0  )
       
  1072         {
       
  1073         SetProvideOnlyRecentViews( EFalse );  
       
  1074         SetExecutionMode( ELogsInForeground );
       
  1075         ActivateLogsViewL( ELogAppListViewId );         
       
  1076         }
       
  1077     
       
  1078     //2. The views below are supported privately *only* for Context sensitive help application. 
       
  1079     //For other uses they are not visible, i.e. are not available in LogsUiCmdStarter because
       
  1080     //Logs application may change in the future (e.g. some views may be dropped). 
       
  1081     //However, when Logs application changes, then the corresponding helps need to be changed too 
       
  1082     //in parallel so we don't end up in situation in which default view is opened instead
       
  1083     //of a requested view that has been removed from Logs.
       
  1084     else if( aTail.Compare( events ) == 0  )
       
  1085         {
       
  1086         SetProvideOnlyRecentViews( EFalse ); 
       
  1087         SetExecutionMode( ELogsInForeground );
       
  1088         ActivateLogsViewL( ELogEventListViewId );         
       
  1089         }
       
  1090     else if( aTail.Compare( timers ) == 0  )
       
  1091         {
       
  1092         SetProvideOnlyRecentViews( EFalse ); 
       
  1093         SetExecutionMode( ELogsInForeground );
       
  1094         ActivateLogsViewL( ECtViewId );         
       
  1095         }
       
  1096     else if( aTail.Compare( packetcounter ) == 0  )
       
  1097         {
       
  1098         SetProvideOnlyRecentViews( EFalse );     
       
  1099         SetExecutionMode( ELogsInForeground );
       
  1100         ActivateLogsViewL( EGprsCounterViewId );         
       
  1101         }
       
  1102     else if( aTail.Compare( settings ) == 0  )
       
  1103         {
       
  1104         SetProvideOnlyRecentViews( EFalse );     
       
  1105         SetExecutionMode( ELogsInForeground );
       
  1106         ActivateLogsViewL( ELogSettingsViewId );         
       
  1107         }
       
  1108     else if( aTail.Compare( callregister ) == 0  )
       
  1109         {
       
  1110         SetProvideOnlyRecentViews( EFalse );    
       
  1111         SetExecutionMode( ELogsInForeground );
       
  1112         ActivateLogsViewL( ELogSubAppListViewId );         
       
  1113         }
       
  1114 
       
  1115     //3. Skip view activation attempts        
       
  1116     else if( aTail.Compare( dontActivateMsg ) == 0  )
       
  1117         {
       
  1118         //No op
       
  1119         }
       
  1120         
       
  1121     //3. Default view
       
  1122     else 
       
  1123         {
       
  1124         SetProvideOnlyRecentViews( EFalse ); 
       
  1125         if (aCommand != EApaCommandBackground )
       
  1126             {
       
  1127             SetExecutionMode( ELogsInForeground );
       
  1128             }
       
  1129       
       
  1130         //AppShell doesn't currently provide option to send cmdline parameter, so provide 
       
  1131         //AppListView (or SubAppListView) as it is probably activated later from AppShell.        
       
  1132         if ( FeatureManager::FeatureSupported( KFeatureIdSimpleLogs ) )
       
  1133             {
       
  1134             ActivateLogsViewL( ELogSubAppListViewId, 
       
  1135                                aCommand == EApaCommandBackground ? 
       
  1136                                    ELogsViewActivationBackground : ELogsViewActivationNoMessage, 
       
  1137                                KNullDesC8() );       
       
  1138             }
       
  1139         else
       
  1140             {    
       
  1141             ActivateLogsViewL( ELogAppListViewId, 
       
  1142                                aCommand == EApaCommandBackground ? 
       
  1143                                    ELogsViewActivationBackground : ELogsViewActivationNoMessage, 
       
  1144                                KNullDesC8() ); 
       
  1145             }
       
  1146         }
       
  1147         
       
  1148     // We have received a commandline parameter so no need to reset to Logs main view
       
  1149     // when foreground\focus regained (see HandleWsEvent).
       
  1150     SetResetViewOnFocusRegain(EFalse); 
       
  1151     
       
  1152     TRACE_EXIT_POINT;
       
  1153     return CAknViewAppUi::ProcessCommandParametersL( aCommand, aDocumentName, aTail );        
       
  1154     }
       
  1155 
       
  1156 // ----------------------------------------------------------------------------
       
  1157 // CLogsAppUi::StartApplicationL
       
  1158 //
       
  1159 // Start an external application
       
  1160 // ----------------------------------------------------------------------------
       
  1161 //
       
  1162 TBool CLogsAppUi::StartApplicationL(
       
  1163     TUid aUid,
       
  1164     const TDesC8& aTail )
       
  1165     {
       
  1166     TApaTaskList taskList( CCoeEnv::Static()->WsSession() );
       
  1167     TApaTask task = taskList.FindApp( aUid );
       
  1168     
       
  1169     if( task.Exists() ) 
       
  1170         {
       
  1171         const TUid dummyUID = { 0x0 };
       
  1172         task.SendMessage( dummyUID, aTail );
       
  1173         task.BringToForeground();  
       
  1174         }
       
  1175     else
       
  1176         { 
       
  1177         TApaAppInfo appInfo;
       
  1178         RApaLsSession lsSession;
       
  1179         User::LeaveIfError( lsSession.Connect() );        
       
  1180         CleanupClosePushL( lsSession );
       
  1181         
       
  1182         if( lsSession.GetAppInfo( appInfo, aUid ) == KErrNone )
       
  1183             {
       
  1184             CApaCommandLine* cmdLine = CApaCommandLine::NewLC();
       
  1185             cmdLine->SetExecutableNameL( appInfo.iFullName );
       
  1186             cmdLine->SetCommandL( EApaCommandRun );
       
  1187             cmdLine->SetTailEndL( aTail );
       
  1188 
       
  1189             lsSession.StartApp( *cmdLine );
       
  1190             CleanupStack::PopAndDestroy( cmdLine );
       
  1191             }
       
  1192 
       
  1193         CleanupStack::PopAndDestroy();  // lsSession
       
  1194         }
       
  1195         
       
  1196     return 0;
       
  1197     }
       
  1198 
       
  1199 
       
  1200 //  End of File