csxhelp/src/CSXHHtmlTopicContainer.cpp
changeset 0 1f04cf54edd8
child 1 27f5851bd5a5
equal deleted inserted replaced
-1:000000000000 0:1f04cf54edd8
       
     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:  CCSXHHtmlTopicContainer class definition
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "CSXHHtmlTOC2.h"
       
    20 #include "CSXHHtmlTOC1.h"
       
    21 #include "CSXHDocument.h"
       
    22 #include "CSXHAppUi.h"
       
    23 #include "CSXHHtmlTopicView.h"
       
    24 #include "CSXHViewIDs.h"
       
    25 #include <cshelp.rsg>
       
    26 #include "CsHelp.hrh"
       
    27 #include "CSXHHtmlTopicContainer.h"
       
    28 #include "AppLauncherForCSXH.h"
       
    29 #include "csxhconstants.h"
       
    30 
       
    31 
       
    32 #include <brctlinterface.h>
       
    33 #include <BrowserLauncher.h>
       
    34 #include <BrCtlDefs.h>
       
    35 
       
    36 #include <coemain.h>
       
    37 #include <AknUtils.h>
       
    38 #include <akntitle.h>
       
    39 #include <aknnotewrappers.h> 
       
    40 #include <AknGlobalNote.h>
       
    41 #include <apmrec.h>
       
    42 #include <apgcli.h>
       
    43 #include <zipfile.h> 
       
    44 #include <utf.h>
       
    45 #include <charconv.h>
       
    46 #include <bautils.h>
       
    47 
       
    48 _LIT(KContentType,"text/html");
       
    49 _LIT(KCsstextToRemovePathinfo,"<style>\n #APP_LAUNCH_LINK{display:none}\n</style>");
       
    50 
       
    51 // Standard construction sequence
       
    52 CCSXHHtmlTopicContainer* CCSXHHtmlTopicContainer::NewL(const TRect& aRect,CCSXHDocument 
       
    53 &aDocument,CCSXHHtmlTopicView *aView)
       
    54     {
       
    55     CCSXHHtmlTopicContainer* self = CCSXHHtmlTopicContainer::NewLC(aRect,aDocument,aView);
       
    56     CleanupStack::Pop(self);
       
    57     return self;
       
    58     }
       
    59 
       
    60 CCSXHHtmlTopicContainer* CCSXHHtmlTopicContainer::NewLC(const TRect& aRect,CCSXHDocument 
       
    61 &aDocument,CCSXHHtmlTopicView *aView)
       
    62     {
       
    63     CCSXHHtmlTopicContainer* self = new (ELeave) CCSXHHtmlTopicContainer(aDocument,aView);
       
    64     CleanupStack::PushL(self);
       
    65     self->ConstructL(aRect);
       
    66     return self;
       
    67     }
       
    68 
       
    69 CCSXHHtmlTopicContainer::CCSXHHtmlTopicContainer(CCSXHDocument &aDocument,CCSXHHtmlTopicView *aView)
       
    70         : iTopic(NULL),iDocument(aDocument),iView(aView)
       
    71         ,iAppLauncher(NULL), iLoadHtml(EFalse), iPrevPageCount(0), iBack(EFalse)
       
    72 
       
    73     {
       
    74     // no implementation required
       
    75     }
       
    76 
       
    77 CCSXHHtmlTopicContainer::~CCSXHHtmlTopicContainer()
       
    78     {
       
    79     if(iBrCtrl)
       
    80         {
       
    81         iBrCtrl->SetFocus(EFalse);
       
    82         iBrCtrl->RemoveLoadEventObserver(this);
       
    83         delete iBrCtrl;
       
    84         iBrLibrary.Close();
       
    85         }
       
    86     if(iAppLauncher)
       
    87     	{
       
    88     	delete iAppLauncher;
       
    89     	}     
       
    90     }
       
    91 
       
    92 void CCSXHHtmlTopicContainer::ConstructL(const TRect& aRect)
       
    93     {
       
    94     // Create a window for this application view
       
    95     CreateWindowL();
       
    96 
       
    97     // Set the windows size
       
    98     SetRect(aRect);
       
    99     if(KErrNone != iBrLibrary.Load(_L("BrowserEngine.dll")))
       
   100     	{
       
   101        	HBufC* ErrorMessage = CCSXHAppUi::GetCoeEnv()->AllocReadResourceLC(
       
   102     				R_CSHELP_RETRIEVE_NO_MEMORY_TEXT);      
       
   103     	CAknGlobalNote* note = CAknGlobalNote::NewLC();
       
   104     	note->ShowNoteL(EAknGlobalInformationNote, *ErrorMessage);
       
   105     	CleanupStack::PopAndDestroy(note); 
       
   106     	CleanupStack::PopAndDestroy(ErrorMessage); 
       
   107     	iDocument.SetDisplayTopic(iDocument.GetPrevTopic());
       
   108 		CCSXHAppUi::GetInstance()->HandleCommandL(ECSXHOpenItem);
       
   109 		User::Leave(KErrNoMemory);
       
   110     	}     
       
   111 
       
   112 #ifdef __WINS__    
       
   113     TLibraryFunction result = iBrLibrary.Lookup(10); 
       
   114 #else
       
   115     TLibraryFunction result = iBrLibrary.Lookup(1);   
       
   116 #endif    
       
   117 		
       
   118 	FuncPtr_CreateBrowserControlL fptr  = (FuncPtr_CreateBrowserControlL)result;
       
   119     
       
   120     iBrCtrl = (*fptr)(
       
   121                     this,aRect,
       
   122                     TBrCtlDefs::ECapabilityDisplayScrollBar|
       
   123                     TBrCtlDefs::ECapabilityClientResolveEmbeddedURL|
       
   124 #ifndef __SERIES60_30__                                 
       
   125                     TBrCtlDefs::ECapabilityCursorNavigation|
       
   126                     TBrCtlDefs::ECapabilityWebKitLite|
       
   127 #endif                                  
       
   128                     TBrCtlDefs::ECapabilityClientNotifyURL,
       
   129                     TBrCtlDefs::ECommandIdBase,this,this,NULL,this
       
   130                     );
       
   131     iBrCtrl->SetBrowserSettingL(TBrCtlDefs::ESettingsCSSFetchEnabled,1);    
       
   132     iBrCtrl->AddLoadEventObserverL(this);   
       
   133     
       
   134     
       
   135     SetSelectedFontSizeL(iView->GetCurrentFontSize());
       
   136     iBrCtrl->MakeVisible(ETrue);
       
   137     
       
   138     ActivateL();
       
   139     }
       
   140 
       
   141 void CCSXHHtmlTopicContainer::Draw(const TRect& /*aRect*/) const
       
   142     {
       
   143     CWindowGc& gc = SystemGc();
       
   144     TRect rect = Rect();
       
   145     gc.Clear(rect);    
       
   146     }
       
   147 void CCSXHHtmlTopicContainer::SetAndLoadInitialTopicL(CCSXHHtmlTOC2* aTopic)
       
   148 	{
       
   149 	iTopic = aTopic;
       
   150 	TRAPD(err,LoadHtmlL());
       
   151     if( KErrNone != err )
       
   152 	    {
       
   153 	    HBufC* ErrorMessage = CCSXHAppUi::GetCoeEnv()->AllocReadResourceLC(
       
   154     				R_CSHELP_RETRIEVE_NO_MEMORY_TEXT);      
       
   155     	CAknGlobalNote* note = CAknGlobalNote::NewLC();
       
   156     	note->ShowNoteL(EAknGlobalInformationNote, *ErrorMessage);
       
   157     	CleanupStack::PopAndDestroy(note); 
       
   158     	CleanupStack::PopAndDestroy(ErrorMessage); 
       
   159     	iDocument.SetDisplayTopic(iDocument.GetPrevTopic());
       
   160 		CCSXHAppUi::GetInstance()->HandleCommandL(ECSXHOpenItem);
       
   161 		User::Leave(KErrNoMemory);	    
       
   162 	    }
       
   163  
       
   164 	}
       
   165 
       
   166 void CCSXHHtmlTopicContainer::LoadHtmlL()
       
   167     {
       
   168     HBufC8 *htmlBuffer = STATIC_CAST(HBufC8*,iTopic->GetTopicContentL());
       
   169     if(htmlBuffer)
       
   170         {
       
   171         CleanupStack::PushL(htmlBuffer);
       
   172         TUid uid;
       
   173         uid.iUid = KCharacterSetIdentifierIso88591;
       
   174         _LIT8(KContentType,"text/html");
       
   175         TDataType dataType(KContentType());
       
   176         iTopic->GetHtmlUrlL(iUrlNoAnchors);
       
   177         iBack = EFalse;
       
   178         ClearHistoryL();
       
   179         iLoadHtml = ETrue;
       
   180         
       
   181         //RUNTIME
       
   182         //if it is context sensitive launch, Add CSS content to remove
       
   183         //Application launch link.
       
   184         if(iView->GetViewType() == CCSXHHtmlTopicView::EContextHtmlView)
       
   185 	        {
       
   186 	        HBufC8* ContextHtmlbuffer = HBufC8::NewLC(htmlBuffer->Size() + 100);
       
   187 	        TPtr8 bufferPtr = ContextHtmlbuffer->Des();
       
   188 	        bufferPtr.Copy(KCsstextToRemovePathinfo);
       
   189 	        bufferPtr.Append(htmlBuffer->Des());
       
   190 	        iBrCtrl->LoadDataL(iUrlNoAnchors,*ContextHtmlbuffer,dataType,uid);	
       
   191 	    	CleanupStack::PopAndDestroy(ContextHtmlbuffer);    	
       
   192 	        }
       
   193         else
       
   194 	        {
       
   195 	        iBrCtrl->LoadDataL(iUrlNoAnchors,*htmlBuffer,dataType,uid);	
       
   196 	        }
       
   197         CleanupStack::PopAndDestroy(htmlBuffer);
       
   198         }
       
   199     else
       
   200         {
       
   201         iTopic->GetHtmlUrlL(iUrlNoAnchors);
       
   202         iBrCtrl->LoadUrlL(iUrlNoAnchors);
       
   203         }
       
   204     CheckForMSK();  
       
   205     }
       
   206 
       
   207 TKeyResponse CCSXHHtmlTopicContainer::OfferKeyEventL(const TKeyEvent &  
       
   208 aKeyEvent,TEventCode  aType )
       
   209     {
       
   210     TKeyResponse result(EKeyWasNotConsumed);
       
   211     
       
   212     if ((aKeyEvent.iCode == EKeyEnter )&& (aType == EEventKey)
       
   213     	&& (IsHyperLinkFocused()))
       
   214         { 
       
   215         HandleCommandOpenHyperLinkL();
       
   216         CheckForMSK();
       
   217         return EKeyWasConsumed; 
       
   218         }
       
   219     
       
   220     if(iBrCtrl)
       
   221         {
       
   222         result = iBrCtrl->OfferKeyEventL(aKeyEvent, aType);        
       
   223 		CheckForMSK();
       
   224 		}       
       
   225     return result;  
       
   226     }
       
   227 
       
   228 TInt CCSXHHtmlTopicContainer::CountComponentControls() const
       
   229     {
       
   230     return 1; 
       
   231     }
       
   232 
       
   233 CCoeControl* CCSXHHtmlTopicContainer::ComponentControl(TInt aIndex) const
       
   234     {
       
   235     switch (aIndex)
       
   236         {
       
   237         case 0:
       
   238             return iBrCtrl;
       
   239         default:
       
   240             return NULL;
       
   241         }
       
   242     }
       
   243     
       
   244 void CCSXHHtmlTopicContainer::HandleResourceChange(TInt aType)
       
   245     {
       
   246     CCSXHAppUi::GetInstance()->PropagateResourceChange(aType); 
       
   247     }
       
   248 void CCSXHHtmlTopicContainer::HandleResourceChangeImpl(TInt aType)
       
   249     {
       
   250     if (aType == KEikDynamicLayoutVariantSwitch)
       
   251         {
       
   252         iBrCtrl->HandleResourceChange(aType);
       
   253         TRect mainRect; 
       
   254         TRect statusPaneRect;
       
   255         AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane,mainRect);
       
   256         SetRect(mainRect);
       
   257             if(iBrCtrl)
       
   258 #ifndef __SERIES60_30__             
       
   259                 iBrCtrl->SetRect(Rect());
       
   260 #else                       
       
   261                 iBrCtrl->SetRect(mainRect);
       
   262 #endif              
       
   263         DrawNow();
       
   264         }
       
   265     else
       
   266         {
       
   267         CCoeControl::HandleResourceChange(aType);   
       
   268         }
       
   269     }
       
   270 
       
   271 void CCSXHHtmlTopicContainer::SizeChanged()
       
   272     {
       
   273 #ifndef __SERIES60_30__ 
       
   274     if(iBrCtrl)
       
   275         iBrCtrl->SetRect(Rect());
       
   276 #endif  
       
   277     }
       
   278 
       
   279 void CCSXHHtmlTopicContainer::HandleCommandBackL()
       
   280     {
       
   281     iBrCtrl->HandleCommandL(TBrCtlDefs::ECommandIdBase + TBrCtlDefs::ECommandBack);
       
   282     }
       
   283  
       
   284 
       
   285 TBool CCSXHHtmlTopicContainer::IsPrevPageAvbl()
       
   286     {
       
   287     if (iPrevPageCount > 0)
       
   288       	{
       
   289       	return ETrue;
       
   290       	}
       
   291      else
       
   292       	{
       
   293       	return EFalse;
       
   294       	}
       
   295     } 
       
   296 
       
   297 
       
   298 
       
   299 void CCSXHHtmlTopicContainer::ClearHistoryL()
       
   300     {
       
   301     iBrCtrl->HandleCommandL(TBrCtlDefs::ECommandIdBase + TBrCtlDefs::ECommandClearHistory);
       
   302     iPrevPageCount = 0;
       
   303     }
       
   304  
       
   305 TBool CCSXHHtmlTopicContainer::ResolveEmbeddedLinkL(const TDesC& /*aEmbeddedUrl*/,
       
   306                                            const TDesC& /*aCurrentUrl*/,
       
   307                                            TBrCtlLoadContentType /*aLoadContentType*/, 
       
   308                                            MBrCtlLinkContent& /*aEmbeddedLinkContent*/)
       
   309     {
       
   310     return EFalse;
       
   311     }
       
   312 // --------------------------------------------------------------------------
       
   313 // Handling for
       
   314 // 1) Compressed HTML content
       
   315 // 2) Application Launch Links
       
   316 // 3) External Hyperlinks
       
   317 // --------------------------------------------------------------------------
       
   318 TBool CCSXHHtmlTopicContainer::ResolveLinkL(const TDesC& aUrl, const TDesC& aCurrentUrl,
       
   319                                    MBrCtlLinkContent& aBrCtlLinkContent)
       
   320     {
       
   321 #ifdef FF_HELP_TUTORIAL_MERGE
       
   322     if( KErrNotFound != aUrl.Find( KTutorialFileExtn ))
       
   323         {
       
   324         iView->LaunchTutorial();
       
   325         return ETrue;
       
   326         }
       
   327 #endif // FF_HELP_TUTORIAL_MERGE
       
   328     if(NULL == iAppLauncher)
       
   329 		{
       
   330 		iAppLauncher = AppLauncherForCSXH::NewL();	
       
   331 		}
       
   332         //Handling for application launch.
       
   333     if(iAppLauncher->LaunchAppL(aUrl,aCurrentUrl))
       
   334         return ETrue;//Link is resolved locally.
       
   335         
       
   336     if(CheckForExternalLinkL(aUrl))     
       
   337         return ETrue;//Link is resolved locally.
       
   338     
       
   339     //Remove the Anchor, if any     
       
   340     TInt DotPos = aUrl.LocateReverseF('.');
       
   341     TInt HashPos = aUrl.LocateReverseF('#');
       
   342     if(KErrNotFound != HashPos && HashPos > DotPos )
       
   343         {
       
   344         //Direct assignment does not work
       
   345         iUrlNoAnchors.Copy(KEmptyString);
       
   346         iUrlNoAnchors.Append(aUrl.Mid(0,HashPos));
       
   347         }
       
   348     else
       
   349         {
       
   350         //Direct assignment does not work
       
   351         iUrlNoAnchors.Copy(KEmptyString);
       
   352         iUrlNoAnchors.Append(aUrl);
       
   353         }   
       
   354     
       
   355     HBufC8 *htmlBuffer = CCSXHHtmlTOC2::GetContentsFromUrlL(iUrlNoAnchors,CCSXHAppUi::GetCoeEnv(),iFeatureControl);
       
   356     if(htmlBuffer)
       
   357         {
       
   358         TPtrC p(NULL,0);
       
   359         aBrCtlLinkContent.HandleResolveComplete(KContentType,p,htmlBuffer);
       
   360         delete htmlBuffer;
       
   361         iLoadHtml = EFalse;
       
   362         if (iBack)
       
   363         	{
       
   364         	iPrevPageCount--;
       
   365         	iBack = EFalse;
       
   366         	}
       
   367         else
       
   368         	{
       
   369             iPrevPageCount++;
       
   370         	}
       
   371 
       
   372         return ETrue;//Link is resolved locally.    
       
   373         }
       
   374         
       
   375     return  EFalse;
       
   376     }
       
   377 
       
   378 void CCSXHHtmlTopicContainer::CancelFetchL()
       
   379     {
       
   380     if (iBrCtrl)
       
   381         {
       
   382         iBrCtrl->HandleCommandL(
       
   383         	    		(TInt)TBrCtlDefs::ECommandCancelFetch + (TInt)TBrCtlDefs::ECommandIdBase ); 
       
   384         }
       
   385     }
       
   386 
       
   387 void CCSXHHtmlTopicContainer::CancelAll()
       
   388     {
       
   389 
       
   390     }
       
   391 
       
   392 
       
   393 void CCSXHHtmlTopicContainer::HandleResolveComplete(const TDesC& /*aContentType*/,
       
   394                                            const TDesC& /*aCharset*/,
       
   395                                            const HBufC8* /*aContentBuf*/)
       
   396     {
       
   397 
       
   398     }
       
   399 
       
   400 void CCSXHHtmlTopicContainer::HandleResolveError(TInt /*aError*/)
       
   401     {
       
   402     
       
   403     }
       
   404 void CCSXHHtmlTopicContainer::RefreshL(CCSXHHtmlTOC2 *aTopic)
       
   405     {
       
   406   	SetAndLoadInitialTopicL(aTopic);
       
   407     }
       
   408 
       
   409 // --------------------------------------------------------------------------
       
   410 // This callback function is used for the following
       
   411 // 1) When an HTML page is loaded, this callback function will be called. If 
       
   412 // this callback is invoked for hyperlink navigation, then the display topic
       
   413 // has to be updated. For example, the Application Topics option menu is
       
   414 // dependent on the dipslay topic.
       
   415 // 2) Updation of the softkey from Options-Close to Options-Back (& Vice-Versa)
       
   416 // in the context view as a result of hyperlink traveral
       
   417 // --------------------------------------------------------------------------
       
   418 void CCSXHHtmlTopicContainer::HandleBrowserLoadEventL(TBrCtlDefs::TBrCtlLoadEvent aLoadEvent, 
       
   419                                     TUint /*aSize*/, TUint16 /*aTransactionId*/)
       
   420     {
       
   421     if(aLoadEvent == TBrCtlDefs::EEventLoadFinished)
       
   422         {
       
   423         
       
   424         HBufC* title = iBrCtrl->PageInfoLC(TBrCtlDefs::EPageInfoTitle);
       
   425         if(!title)
       
   426             {
       
   427             CleanupStack::PopAndDestroy(title);
       
   428             return;
       
   429             }
       
   430         
       
   431         //Update the title bar
       
   432         CEikStatusPane* sp = CCSXHAppUi::GetInstance()->StatusPane();
       
   433         CAknTitlePane* titlePane = STATIC_CAST(CAknTitlePane*, 
       
   434         sp->ControlL(TUid::Uid(EEikStatusPaneUidTitle)));
       
   435         titlePane->SetTextL(*title);
       
   436         CleanupStack::PopAndDestroy(title);
       
   437         
       
   438         //For the context sensitive view, the softkey texts need to be changed.
       
   439         //add label iLoadHtml for ESNN-7N9CLN.If the html is opened by 
       
   440         //loadHtmlL, the iLoadHtml will be set to ETrue, which 
       
   441         //can guarantee the RSK keep as "CLOSE" when context is sensitive.
       
   442         if ((!iLoadHtml) && (iView->GetViewType() == CCSXHHtmlTopicView::EContextHtmlView))
       
   443         {  
       
   444             iView->SetViewTypeL(IsPrevHtmlPageAvblL() ? 
       
   445                     CCSXHHtmlTopicView::EHtmlView : CCSXHHtmlTopicView::EContextHtmlView);
       
   446         }
       
   447         
       
   448         //TSW Error:TKOI-74KE89: Help crashes when closing after viewing a link topic
       
   449         //When user presses back keys very quickly, TOC2 objects use to destroy and 
       
   450         //then browser call back function triggers which leads to crash. This check 
       
   451         //will avoid crash.
       
   452         TUid viewId = iDocument.GetDisplayTopic()->GetViewID();
       
   453 		if(viewId == KCSXHToc1ViewID ||	viewId == KCSXHKywdToc1ViewID
       
   454 		|| viewId == KCSXHToc2ViewID || viewId == KCSXHKywdToc2ViewID)
       
   455 			return;
       
   456 		
       
   457         //When user clicks on Application Topics, application topics 
       
   458         //corresponding to the topic being displayed has to be opened
       
   459         //Hence update the Display topic information if required.
       
   460         
       
   461         //Check if this event is triggered for the first load after construction
       
   462         TFileName url;
       
   463         iTopic->GetHtmlUrlL(url);
       
   464         if(url.Compare(iUrlNoAnchors) == 0)
       
   465         	{
       
   466         	iDocument.SetDisplayTopic(iTopic);
       
   467         	iNewTopic = NULL;
       
   468         	//Move the code from SetAndLoadInitialTopicL
       
   469         	//TSW Error:EJZG-7E2BUV
       
   470         	ClearHistoryL();
       
   471         	return;
       
   472         	}
       
   473             
       
   474         iNewTopic = iDocument.GetHtmlTopicForUrlL(iUrlNoAnchors);            
       
   475         CheckForMSK();
       
   476         }
       
   477     }
       
   478     
       
   479 CCSXHHelpContentBase* CCSXHHtmlTopicContainer::GetCurrActiveObject()
       
   480     	{
       
   481     	return iNewTopic;
       
   482     	}    
       
   483 // --------------------------------------------------------------------------
       
   484 // Back Key Handling
       
   485 // --------------------------------------------------------------------------
       
   486 TBool CCSXHHtmlTopicContainer::HandleBackKeyL()
       
   487     {
       
   488     //When this view is initially created, the HTML content is loaded 
       
   489     //using the LoadDataL function and hence it will not be part of the
       
   490     //History stack but all other subsequest navigation by the user 
       
   491     //using the hyperlinks will be part of the History Stack
       
   492     if(IsPrevPageAvbl())
       
   493         {
       
   494         iBack = ETrue;
       
   495         TRAPD(res,HandleCommandBackL());
       
   496         if(res == KErrNone)
       
   497             return ETrue;
       
   498         else
       
   499             ClearHistoryL();
       
   500         }
       
   501     ClearHistoryL();
       
   502         
       
   503     return EFalse;  
       
   504     }
       
   505 TBool CCSXHHtmlTopicContainer::IsPrevHtmlPageAvblL()
       
   506     {
       
   507     if(IsPrevPageAvbl())
       
   508         return ETrue;
       
   509     
       
   510     return EFalse;  
       
   511     }
       
   512 
       
   513 void CCSXHHtmlTopicContainer::SetSelectedFontSizeL(TInt aValue)
       
   514     {
       
   515     iBrCtrl->SetBrowserSettingL(TBrCtlDefs::ESettingsFontSize,aValue);  
       
   516     }
       
   517     
       
   518 TInt CCSXHHtmlTopicContainer::GetCurrentValueL(TInt aSetting)
       
   519     {
       
   520         return iBrCtrl->BrowserSettingL(aSetting);  
       
   521     }   
       
   522 
       
   523 void CCSXHHtmlTopicContainer::UpdateSoftkeyL(TBrCtlKeySoftkey /*aKeySoftkey*/,
       
   524                                     const TDesC& /*aLabel*/,
       
   525                                     TUint32 /*aCommandId*/,
       
   526                                     TBrCtlSoftkeyChangeReason /*aBrCtlSoftkeyChangeReason*/)
       
   527     {
       
   528     }
       
   529 
       
   530 void CCSXHHtmlTopicContainer::UpdateBrowserVScrollBarL(TInt /*aDocumentHeight*/, 
       
   531                                               TInt /*aDisplayHeight*/,
       
   532                                               TInt /*aDisplayPosY*/ ) 
       
   533     {
       
   534     if(iBrCtrl)
       
   535         CheckForMSK();
       
   536 }
       
   537 void CCSXHHtmlTopicContainer::UpdateBrowserHScrollBarL(TInt /*aDocumentWidth*/, 
       
   538                                               TInt /*aDisplayWidth*/,
       
   539                                               TInt /*aDisplayPosX*/ )
       
   540     {
       
   541     if(iBrCtrl)
       
   542         CheckForMSK();
       
   543     }
       
   544 void CCSXHHtmlTopicContainer::NotifyLayoutChange( TBrCtlLayout /*aNewLayout*/ )
       
   545     {
       
   546     }
       
   547         
       
   548 void CCSXHHtmlTopicContainer::UpdateTitleL( const TDesC& /*aTitle*/ )
       
   549     {
       
   550     }
       
   551 
       
   552 void CCSXHHtmlTopicContainer::CheckForMSK()
       
   553     {
       
   554     if(IsHyperLinkFocused())
       
   555         {
       
   556         iView->SetMiddleSoftKey(ETrue); 
       
   557         }
       
   558     else
       
   559         {
       
   560         iView->SetMiddleSoftKey(EFalse);    
       
   561         }
       
   562     }
       
   563     
       
   564 TBool CCSXHHtmlTopicContainer::IsHyperLinkFocused() 
       
   565     {
       
   566     if(TBrCtlDefs::EElementAnchor == iBrCtrl->FocusedElementType())
       
   567         return ETrue;
       
   568     else
       
   569         return EFalse;
       
   570     }
       
   571     
       
   572 void CCSXHHtmlTopicContainer::HandleCommandOpenHyperLinkL()
       
   573     {
       
   574     iBrCtrl->HandleCommandL(TBrCtlDefs::ECommandIdBase + TBrCtlDefs::ECommandOpen);
       
   575     }
       
   576 
       
   577 TBool CCSXHHtmlTopicContainer::CheckForExternalLinkL(const TDesC& aUrl)
       
   578 	{
       
   579     TBool Result = EFalse;
       
   580         
       
   581     if( KErrNotFound != aUrl.Find(_L("http://")) |
       
   582         KErrNotFound != aUrl.Find(_L("https://")) |
       
   583         KErrNotFound != aUrl.Find(_L("ftp://")))
       
   584         {
       
   585         iAppLauncher->LaunchBrowserNGL(aUrl);           
       
   586         Result = ETrue;
       
   587         }
       
   588         
       
   589     return Result;
       
   590 	}
       
   591