csxhelp/src/CSXHAppUi.cpp
branchRCL_3
changeset 45 cbffe13eac63
equal deleted inserted replaced
44:12f60d9a73b3 45:cbffe13eac63
       
     1 /*
       
     2 * Copyright (c) 2006 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:  CCSXHAppUi class definition
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "CSXHAppUi.h"
       
    20 #include "CSXHGenericView.h"
       
    21 #include "CSXHHtmlTopicView.h"
       
    22 #include "CSXHLegacyTopicView.h"
       
    23 #include "CsHelp.hrh"
       
    24 #include <cshelp.rsg>
       
    25 #include "CSXHAppUi.h"
       
    26 #include "CSXHDocument.h"
       
    27 
       
    28 #include "CSXHHelpDataBase.h"
       
    29 #include "CSXHViewIDs.h"
       
    30 
       
    31 #include <avkon.hrh>
       
    32 #include <utf.h>
       
    33 #include <aknnotewrappers.h> 
       
    34 #include <AknGlobalNote.h>
       
    35 #include <akninputblock.h>
       
    36 #include <hlplch.h>
       
    37 
       
    38 #include "csxhconstants.h"
       
    39 
       
    40 #ifdef FF_HELP_TUTORIAL_MERGE
       
    41 #include <AiwServiceHandler.h>
       
    42 
       
    43 #if defined(_DEBUG) && defined(__WINS__)
       
    44 #include <f32file.h>
       
    45 #include <flogger.h>
       
    46 _LIT(KLogDir, "csxh");
       
    47 _LIT(KLogFile, "csxh.txt");
       
    48 inline void FPrint(const TRefByValue<const TDesC> aFmt, ...)
       
    49     {
       
    50     VA_LIST list;
       
    51     VA_START(list,aFmt);
       
    52     RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, aFmt, list);
       
    53     }
       
    54 #define FLOG(a) {FPrint(a);}
       
    55 #define FLOGF   FPrint
       
    56 #else //_DEBUG
       
    57 #define FLOG(a)
       
    58 #define FLOGF
       
    59 #endif //_DEBUG
       
    60 #endif // FF_HELP_TUTORIAL_MERGE
       
    61 CCSXHAppUi* CCSXHAppUi::iInstance = NULL;
       
    62 
       
    63 // ConstructL is called by the application framework
       
    64 void CCSXHAppUi::ConstructL()
       
    65     {
       
    66 #ifndef __SERIES60_30__         
       
    67     BaseConstructL(EAknEnableSkin | EAknEnableMSK | EAknSingleClickCompatible );
       
    68 #else
       
    69     BaseConstructL(EAknEnableSkin);
       
    70 #endif  
       
    71   
       
    72 #ifdef FF_HELP_TUTORIAL_MERGE
       
    73     LoadTutorialService();
       
    74 #endif // FF_HELP_TUTORIAL_MERGE
       
    75     SetKeyEventFlags( CAknAppUiBase::EDisableSendKeyShort | CAknAppUiBase::EDisableSendKeyLong );
       
    76     iTOC1View = CCSXHGenericView::NewL(KCSXHToc1ViewID,R_CSXH_TOC1);
       
    77     AddViewL(iTOC1View); 
       
    78     
       
    79     iTOC2View = NULL;
       
    80     iKywdTOC1View = NULL;
       
    81     iKywdTOC2View = NULL;
       
    82     iHtmlTopicView = NULL;
       
    83     iLegacyTopicView = NULL;
       
    84     iLegacyContextTopicView = NULL;
       
    85     iAppHelpsTOC1View = NULL;
       
    86     iAppHelpsTOC2View = NULL;
       
    87     
       
    88     SetDefaultViewL(*iTOC1View);  
       
    89         
       
    90     iRuntimeWatcher = CCSXHRuntimeAppWatcher::NewL();
       
    91     iRuntimeWatcher->SetObserver( this );
       
    92     iRuntimeWatcher->Start();
       
    93 #ifdef _DEBUG
       
    94     RDebug::Print( _L("Help app launched") );
       
    95 #endif
       
    96     }
       
    97 
       
    98 CCSXHAppUi::CCSXHAppUi()                              
       
    99     {
       
   100     iInstance = this;
       
   101     }
       
   102 
       
   103 CCSXHAppUi::~CCSXHAppUi()
       
   104     {
       
   105 #ifdef FF_HELP_TUTORIAL_MERGE
       
   106 
       
   107     if(iServiceHandler)
       
   108         {
       
   109         delete iServiceHandler;
       
   110         }
       
   111 
       
   112 #endif // FF_HELP_TUTORIAL_MERGE
       
   113 #ifdef _DEBUG
       
   114     RDebug::Print(_L("Help app ended"));
       
   115 #endif
       
   116     if ( iRuntimeWatcher )
       
   117         delete iRuntimeWatcher;
       
   118 
       
   119     }
       
   120 
       
   121 // --------------------------------------------------------------------------
       
   122 // Message Handler
       
   123 // --------------------------------------------------------------------------
       
   124 void CCSXHAppUi::HandleCommandL(TInt aCommand)
       
   125     {
       
   126     switch(aCommand)
       
   127         {
       
   128         case EEikCmdExit:
       
   129         case EAknSoftkeyExit:
       
   130         case EAknSoftkeyClose:
       
   131             Exit();
       
   132             break;
       
   133   
       
   134         case ECSXHOpenTopicText:
       
   135         case ECSXHOpenItemPropagated:
       
   136         case ECSXHOpenItem:        
       
   137             {
       
   138             CAknInputBlock* inputBlock = CAknInputBlock::NewLC();
       
   139             ActivateDisplayTopicViewL();
       
   140             CleanupStack::PopAndDestroy( inputBlock ); 
       
   141             }
       
   142             break;
       
   143         case ECSXHSearchText:
       
   144             {
       
   145             CCSXHDocument* doc = static_cast<CCSXHDocument*>(Document());
       
   146             doc->SetDisplayTopic(doc->GetHelpDataBase()->GetKywdTopics());
       
   147             ActivateDisplayTopicViewL();
       
   148             }
       
   149             break;
       
   150         default:
       
   151             break;
       
   152         }
       
   153     }
       
   154 void CCSXHAppUi::InitDisplayTopicViewL(TUid aViewID)
       
   155 	{
       
   156 	if(aViewID == KCSXHToc1ViewID)
       
   157 		return;
       
   158 	
       
   159 	
       
   160   	if(aViewID == KCSXHContextLegacyTopicViewID && iLegacyContextTopicView == NULL)	
       
   161 	 	{
       
   162         iLegacyContextTopicView = CCSXHLegacyTopicView::NewL (KCSXHContextLegacyTopicViewID,
       
   163                                                               R_CSHELP_TOPICFORCONTEXT,
       
   164                                                               ClientRect());
       
   165     	AddViewL(iLegacyContextTopicView);
       
   166 	 	}	 	   
       
   167 	else if(aViewID == KCSXHToc2ViewID && iTOC2View == NULL)
       
   168 		{
       
   169 		iTOC2View = CCSXHGenericView::NewL(KCSXHToc2ViewID,R_TOPICLIST);
       
   170     	AddViewL(iTOC2View); 
       
   171 		}
       
   172 	else if(aViewID == KCSXHToc2AppHelpsViewID && iAppHelpsTOC2View == NULL)
       
   173 	    {
       
   174 	    iAppHelpsTOC2View = CCSXHGenericView::NewL(KCSXHToc2AppHelpsViewID,R_TOPICLIST);
       
   175 	    AddViewL(iAppHelpsTOC2View);
       
   176 	    }
       
   177 	 else if(aViewID == KCSXHKywdToc1ViewID && iKywdTOC1View == NULL)
       
   178 	 	{
       
   179 	 	iKywdTOC1View = CCSXHGenericView::NewL(KCSXHKywdToc1ViewID,R_KYWDTOC1LIST);
       
   180     	AddViewL(iKywdTOC1View);
       
   181 	 	}
       
   182 	 else if(aViewID == KCSXHKywdToc2ViewID && iKywdTOC2View == NULL)	
       
   183 	 	{
       
   184 	 	iKywdTOC2View = CCSXHGenericView::NewL(KCSXHKywdToc2ViewID,R_KYWDTOC2LIST);
       
   185     	AddViewL(iKywdTOC2View); 
       
   186 	 	}
       
   187 	 else if(aViewID == KCSXHLegacyTopicViewID && iLegacyTopicView == NULL)	
       
   188 	 	{
       
   189         iLegacyTopicView = CCSXHLegacyTopicView::NewL(KCSXHLegacyTopicViewID,
       
   190                                                       R_TOPICTEXTLIST,ClientRect());
       
   191     	AddViewL(iLegacyTopicView);
       
   192 	 	}	
       
   193 	 	
       
   194 	 else if(aViewID == KCSXHContextHtmlTopicViewID )	
       
   195 	 	{
       
   196 	 	if(!iHtmlTopicView)
       
   197 	 		{
       
   198             iHtmlTopicView = CCSXHHtmlTopicView::NewL(KCSXHHtmlTopicViewID,
       
   199                                                       R_CSHELP_HTMLTOPICFORCONTEXT,
       
   200                                                       ClientRect());
       
   201     		AddViewL(iHtmlTopicView);	
       
   202 	 		}
       
   203 	 	else
       
   204 	 		{
       
   205 	 		//View is already created update the softkeys to Options and Close
       
   206 	 		iHtmlTopicView->SetViewTypeL(CCSXHHtmlTopicView::EContextHtmlView);
       
   207 	 		}
       
   208   	 	}	
       
   209 	 else if(aViewID == KCSXHHtmlTopicViewID )	
       
   210 	 	{
       
   211 	 	if(!iHtmlTopicView)
       
   212 	 		{
       
   213             iHtmlTopicView = CCSXHHtmlTopicView::NewL(KCSXHHtmlTopicViewID,
       
   214                                                       R_CSHELP_HTMLTOPICVIEW,
       
   215                                                       ClientRect());
       
   216     		AddViewL(iHtmlTopicView);
       
   217 	 		}
       
   218 	 	else
       
   219 	 		{
       
   220 	 		//View is already created update the softkeys to Options and Back
       
   221 	 		iHtmlTopicView->SetViewTypeL(CCSXHHtmlTopicView::EHtmlView);
       
   222 	 		}
       
   223 	 	}
       
   224     else if ( aViewID == KCSXHToc1AppHelpsViewID && !iAppHelpsTOC1View )
       
   225         {
       
   226         iAppHelpsTOC1View = CCSXHGenericView::NewL( KCSXHToc1AppHelpsViewID, R_TOPICLIST );
       
   227         AddViewL( iAppHelpsTOC1View ); 
       
   228         }
       
   229 	}
       
   230 // --------------------------------------------------------------------------
       
   231 // Activates the view corresponding to the topic to be displayed
       
   232 // It also sets for recreating the container dending on the view to be 
       
   233 // activated, 
       
   234 // 1) Search Pane in Search Result View will be cleared if user 
       
   235 // opens the Search View.
       
   236 // 2)Search Pane in Application Topics view will be cleared, if user opens 
       
   237 //      a)Help Contents View 
       
   238 //      b)Search View 
       
   239 //      c)Context Senisitive view
       
   240 // --------------------------------------------------------------------------
       
   241 void CCSXHAppUi::ActivateDisplayTopicViewL()
       
   242     {
       
   243     CCSXHDocument* doc = static_cast<CCSXHDocument*>(Document());
       
   244     TUid viewId = doc->GetDisplayTopic()->GetViewID();
       
   245     InitDisplayTopicViewL(viewId);
       
   246     
       
   247     if(viewId == KCSXHKywdToc1ViewID )
       
   248         {
       
   249         if(iKywdTOC2View)
       
   250         	iKywdTOC2View->ResetContainer();
       
   251         if(iTOC2View)
       
   252         	iTOC2View->ResetContainer();
       
   253         if (iAppHelpsTOC2View)
       
   254         	iAppHelpsTOC2View->ResetContainer();
       
   255         }
       
   256 	else if(viewId == KCSXHToc1ViewID ||
       
   257 	        viewId == KCSXHContextHtmlTopicViewID ||
       
   258             viewId == KCSXHContextLegacyTopicViewID ||
       
   259             viewId == KCSXHToc1AppHelpsViewID)
       
   260 	    {
       
   261 	    if(iTOC2View)
       
   262 			iTOC2View->ResetContainer();
       
   263 	    if (iAppHelpsTOC2View)
       
   264 	    	iAppHelpsTOC2View->ResetContainer();
       
   265 	    }
       
   266 /*	else if(viewId == KCSXHKywdToc1ViewID)  
       
   267 		{
       
   268 		doc->InitProgressBarL();
       
   269 		}
       
   270 */	
       
   271 	if(viewId == KCSXHContextHtmlTopicViewID)    
       
   272 		viewId = KCSXHHtmlTopicViewID;
       
   273     ActivateLocalViewL(viewId);
       
   274     }
       
   275 void CCSXHAppUi::HandleForegroundEventL(TBool aForeground)
       
   276 	{
       
   277 	// Call Base class method
       
   278  	CAknAppUi::HandleForegroundEventL(aForeground);
       
   279 
       
   280  	if(!aForeground && iView && 
       
   281  	iView->Id() != KCSXHHtmlTopicViewID
       
   282  	&& iHtmlTopicView)
       
   283  		{
       
   284  		//put NUll first in for bug ESXU-7JA9NS
       
   285  		iHtmlTopicView = NULL;
       
   286      	// We have lost the focus
       
   287      	//Check if the HTML view is the last active view. If it not delete it 
       
   288      	//to free the memory used by the browser control
       
   289      	RemoveView(KCSXHHtmlTopicViewID);
       
   290      	//delete iHtmlTopicView;
       
   291     	}
       
   292 	}
       
   293 // --------------------------------------------------------------------------
       
   294 // It sets a flag in the View for recreating the container 
       
   295 // --------------------------------------------------------------------------
       
   296 void CCSXHAppUi::ResetTOC2ViewContainer()
       
   297     {
       
   298     if(iTOC2View)
       
   299     	iTOC2View->ResetContainer();	
       
   300     }
       
   301 // --------------------------------------------------------------------------
       
   302 // Context sensitive help launch handling. Help is not running
       
   303 // --------------------------------------------------------------------------
       
   304 TBool CCSXHAppUi::ProcessCommandParametersL(TApaCommand aCommand,
       
   305                                               TFileName& /* aDocumentName */,
       
   306                                               const TDesC8& aTail)
       
   307     {
       
   308     if (aCommand == EApaCommandOpen)
       
   309         { // when another app launches the help app
       
   310         HandleContextSensitiveLaunchL(aTail);
       
   311         }
       
   312     return EFalse;
       
   313     }
       
   314 
       
   315 // --------------------------------------------------------------------------
       
   316 // Context sensitive help launch handling. Help is already running
       
   317 // --------------------------------------------------------------------------
       
   318 MCoeMessageObserver::TMessageResponse CCSXHAppUi::HandleMessageL(
       
   319            TUint32 aClientHandleOfTargetWindowGroup,
       
   320            TUid aMessageUid,
       
   321            const TDesC8& aMessageParameters)
       
   322     {
       
   323     if (aMessageUid == KHlpAppWsMsg)
       
   324         {
       
   325         HandleContextSensitiveLaunchL(aMessageParameters);
       
   326         return EMessageHandled;
       
   327         }
       
   328     return CAknViewAppUi::HandleMessageL(aClientHandleOfTargetWindowGroup,
       
   329                                          aMessageUid,
       
   330                                          aMessageParameters);
       
   331     }
       
   332 
       
   333 // --------------------------------------------------------------------------
       
   334 // Opens the context topic. If no topic is avbl then toc1 view is activated
       
   335 // --------------------------------------------------------------------------
       
   336 void  CCSXHAppUi::HandleContextSensitiveLaunchL(const TDesC8& aContext )   
       
   337     {
       
   338     CCSXHDocument* doc = static_cast<CCSXHDocument*>(Document());
       
   339         
       
   340     if(doc->SetContextTopicAsDisplayTopicL(aContext))
       
   341         {
       
   342         TRAPD(res,ActivateDisplayTopicViewL());
       
   343         if(res == KErrNone)
       
   344             return;
       
   345         }
       
   346     
       
   347     //No topic avaliable, activate the TOC1 View & Pop a message
       
   348     doc->SetDisplayTopic(doc->GetHelpDataBase()->GetMainTopics());
       
   349     ActivateDisplayTopicViewL();
       
   350         
       
   351 //    HBufC* ErrorMessage = iCoeEnv->AllocReadResourceLC(R_TYPE_NO_HELP_TOPICS);      
       
   352 //    CAknGlobalNote* note = CAknGlobalNote::NewLC();
       
   353 //    note->ShowNoteL(EAknGlobalInformationNote, *ErrorMessage);
       
   354 
       
   355 //    CleanupStack::PopAndDestroy(note); 
       
   356 //    CleanupStack::PopAndDestroy(ErrorMessage); 
       
   357     }
       
   358 
       
   359 CCSXHAppUi* CCSXHAppUi::GetInstance()
       
   360     {
       
   361     return iInstance;
       
   362     }
       
   363 RWsSession& CCSXHAppUi::GetWsSession()
       
   364     {
       
   365     return iInstance->iCoeEnv->WsSession();
       
   366     }
       
   367 CCoeEnv* CCSXHAppUi::GetCoeEnv()
       
   368     {
       
   369     return iInstance->iCoeEnv;
       
   370     }
       
   371 
       
   372 // --------------------------------------------------------------------------
       
   373 // Launches an application based on the Application UID and a View ID
       
   374 // --------------------------------------------------------------------------
       
   375 void CCSXHAppUi::AppLaunchL(TInt32& aAppId,TInt32& aVId)
       
   376     {
       
   377     //Convert from TInt to TUid
       
   378     TUid KtestAppUid( TUid::Uid( aAppId ) ); 
       
   379     TUid KtestViewUid( TUid::Uid( aVId ) ); 
       
   380       
       
   381     //Launch Application
       
   382     TVwsViewId AppLaunch(KtestAppUid,KtestViewUid);
       
   383     ActivateViewL(AppLaunch);
       
   384     }
       
   385 
       
   386 // --------------------------------------------------------------------------
       
   387 // Launches an application based on the Application UID and a View ID
       
   388 // --------------------------------------------------------------------------
       
   389 void CCSXHAppUi::AppLaunchL(TInt32& aAppId,TInt32& aVId,
       
   390                             TInt32& aMsgId,
       
   391                             const TBuf<KMaxParamLength>& aParams)
       
   392     {
       
   393     //Convert from TInt to TUid
       
   394     TUid AplnUid( TUid::Uid( aAppId ) ); 
       
   395     TUid AplnViewUid( TUid::Uid( aVId ) ); 
       
   396     TUid MsgUid( TUid::Uid( aMsgId ) ); 
       
   397       
       
   398     //Launch Application
       
   399     TVwsViewId AppLaunch(AplnUid,AplnViewUid);
       
   400     
       
   401     HBufC8* params = CnvUtfConverter::ConvertFromUnicodeToUtf8L(aParams);
       
   402     CleanupStack::PushL(params);
       
   403     ActivateViewL(AppLaunch,MsgUid,*params);
       
   404     CleanupStack::PopAndDestroy(params);
       
   405     }
       
   406  
       
   407 void CCSXHAppUi::PropagateResourceChange(TInt aType)
       
   408     {
       
   409     iTOC1View->ResourceChangeHdl(aType);
       
   410     if(iKywdTOC1View)
       
   411     	iKywdTOC1View->ResourceChangeHdl(aType);
       
   412     if(iKywdTOC2View)
       
   413     	iKywdTOC2View->ResourceChangeHdl(aType);
       
   414     if(iTOC2View)
       
   415 		iTOC2View->ResourceChangeHdl(aType);    
       
   416     if (iAppHelpsTOC2View)
       
   417     	iAppHelpsTOC2View->ResourceChangeHdl(aType);
       
   418     if (iAppHelpsTOC1View)
       
   419         iAppHelpsTOC1View->ResourceChangeHdl(aType);
       
   420     if(iHtmlTopicView)
       
   421     	iHtmlTopicView->ResourceChangeHdl(aType);
       
   422     if(iLegacyTopicView)
       
   423     	iLegacyTopicView->ResourceChangeHdl(aType);
       
   424     if(iLegacyContextTopicView)
       
   425     	iLegacyContextTopicView->ResourceChangeHdl(aType);
       
   426     }
       
   427  
       
   428 void CCSXHAppUi::RuntimeUpdateIndex()
       
   429     {
       
   430     CAknNoteDialog* dlg = new CAknNoteDialog();
       
   431     if (dlg != NULL)
       
   432         {
       
   433         dlg->SetTimeout( CAknNoteDialog::EShortTimeout );
       
   434         dlg->SetTone( CAknNoteDialog::ENoTone );
       
   435         TRAP_IGNORE(dlg->ExecuteLD(R_CSHELP_INSTALL_UNINSTALL_NOTE));
       
   436         }
       
   437     }
       
   438    
       
   439        
       
   440 #ifdef FF_HELP_TUTORIAL_MERGE
       
   441 // --------------------------------------------------------------------------
       
   442 // CCSXHAppUi::NewParamListLC
       
   443 // Create paramlist for provider.
       
   444 // --------------------------------------------------------------------------
       
   445 CAiwGenericParamList* CCSXHAppUi::NewParamListLC(
       
   446                                             const TCoeHelpContext& aContext)
       
   447     {
       
   448     TAiwVariant variant1;
       
   449     TAiwVariant variant2;
       
   450     variant1.Set(aContext.iMajor);
       
   451     TAiwGenericParam param1(EGenericParamHelpItem, variant1);
       
   452     variant2.Set(aContext.iContext);
       
   453     TAiwGenericParam param2(EGenericParamHelpItem, variant2);
       
   454     CAiwGenericParamList* list = CAiwGenericParamList::NewLC();
       
   455     list->AppendL(param1);
       
   456     list->AppendL(param2);
       
   457     return list;
       
   458     }
       
   459 
       
   460 // --------------------------------------------------------------------------
       
   461 // CCSXHAppUi::LoadTutorialService
       
   462 // Load service handler and attach interest for using tutorial service command.
       
   463 // --------------------------------------------------------------------------
       
   464 void CCSXHAppUi::LoadTutorialServiceL()
       
   465     {
       
   466     iServiceHandler = CAiwServiceHandler::NewL();
       
   467 
       
   468     // Create AIW interest
       
   469     RCriteriaArray interest;
       
   470 
       
   471     iServiceHandler->AttachL(R_AIWTUTORIALAPP_INTEREST);
       
   472 
       
   473     //Tutorial AIW provider exists or not
       
   474     iTutorialExists = EFalse;
       
   475     iServiceHandler->GetInterest(interest);
       
   476     if(interest.Count() > 0)
       
   477         {
       
   478         FLOGF(_L("CCSXHAppUi::LoadTutorialService() - interest.Count()=%d"), interest.Count());
       
   479         CAiwCriteriaItem* testCriteria = interest[0];
       
   480         if(iServiceHandler->NbrOfProviders(interest[0]) > 0)
       
   481             {
       
   482             FLOGF(_L("CCSXHAppUi::LoadTutorialService() - NbrOfProviders()=%d"), iServiceHandler->NbrOfProviders(interest[0]));
       
   483             iTutorialExists = ETrue;
       
   484             }
       
   485         }
       
   486     interest.Close();
       
   487     }
       
   488 
       
   489 // --------------------------------------------------------------------------
       
   490 // CCSXHAppUi::CallTutorialAiwProviderL
       
   491 // If tutorial exists,call play presentation command.
       
   492 // --------------------------------------------------------------------------
       
   493 void CCSXHAppUi::CallTutorialAiwProviderL()
       
   494     {
       
   495     CAiwGenericParamList* inlist = NewParamListLC( iTCoeHelpContext );
       
   496 
       
   497     iServiceHandler->ExecuteServiceCmdL( KPlayPresentation,
       
   498                                          *inlist,
       
   499                                          iServiceHandler->OutParamListL() );
       
   500     CleanupStack::PopAndDestroy();   //inlist
       
   501     }
       
   502 
       
   503 // --------------------------------------------------------------------------
       
   504 // CCSXHAppUi::IsApplicationPresentInTutorialL
       
   505 // If tutorial exists,identify the presentation needed exist or not.
       
   506 // --------------------------------------------------------------------------
       
   507 TBool CCSXHAppUi::IsApplicationPresentInTutorialL()
       
   508     {
       
   509     TBool Result = EFalse;
       
   510     //__ASSERT_DEBUG( iTutorialExists, User::Panic(_L("TutAiwHlp"),-1));
       
   511     if(iTutorialExists )
       
   512         {
       
   513         CAiwGenericParamList* inlist = NewParamListLC(iTCoeHelpContext) ;
       
   514 
       
   515         CAiwGenericParamList* outlist = CAiwGenericParamList::NewLC();
       
   516 
       
   517         TUid maj = iTCoeHelpContext.iMajor;
       
   518         TCoeContextName con = iTCoeHelpContext.iContext;
       
   519 
       
   520         FLOGF(_L("CCSXHAppUi::IsApplicationPresentInTutorialL() - 0x%08x %S"),maj,&con);
       
   521 
       
   522         //checks if the application specific presentation exists.
       
   523         //Parameter list inlist must contain AppUid which refers to presentation.
       
   524         // The other parameters are not used.
       
   525         //The result is returned in outlist parameter list.
       
   526         //First parameter in the outlist contains ETrue if there is presentation
       
   527         //available and EFalse if there is not.
       
   528         iServiceHandler->ExecuteServiceCmdL( KPresentationExists,
       
   529                                              *inlist, *outlist );
       
   530 
       
   531         FLOG(_L("CCSXHAppUi::IsApplicationPresentInTutorialL() - cp-1"));
       
   532 
       
   533         //__ASSERT_DEBUG( outlist->Count() > 0, User::Panic(_L("TutAiwHlpO"),-1));
       
   534         __ASSERT_DEBUG(outlist->Count(), User::Panic(_L("outlist"),0));
       
   535 
       
   536         FLOG(_L("CCSXHAppUi::IsApplicationPresentInTutorialL() - cp-2"));
       
   537         if( outlist->Count() > 0)
       
   538             {
       
   539             FLOG(_L("CCSXHAppUi::IsApplicationPresentInTutorialL() - cp-2.4"));
       
   540             TAiwGenericParam param = (*outlist)[0];
       
   541             TAiwVariant variant = param.Value();
       
   542             TInt32 val(0);
       
   543 
       
   544             if(variant.Get(val) && val)
       
   545                 {
       
   546                 Result = ETrue;
       
   547                 }
       
   548             FLOG(_L("CCSXHAppUi::IsApplicationPresentInTutorialL() - cp-3"));
       
   549             __ASSERT_DEBUG( variant.Get(val) && val, User::Panic(_L("TutAiwHlpV"),-1));
       
   550             }
       
   551         CleanupStack::PopAndDestroy();   //outlist
       
   552         CleanupStack::PopAndDestroy();   //inlist
       
   553         }
       
   554     return Result;
       
   555     }
       
   556 
       
   557 // --------------------------------------------------------------------------
       
   558 // CCSXHAppUi::SetHelpContext
       
   559 // If tutorial exists,identify the presentation needed exist or not.
       
   560 // --------------------------------------------------------------------------
       
   561 void CCSXHAppUi::SetHelpContext(TCoeHelpContext aTCoeHelpContext)
       
   562     {
       
   563     iTCoeHelpContext = aTCoeHelpContext;
       
   564     }
       
   565 #endif // FF_HELP_TUTORIAL_MERGE