userguide/src/HelpContentsView.cpp
changeset 15 c0dfc135a46c
parent 13 1eb8015a8491
child 18 375271912456
child 24 bce8d4d2cc72
equal deleted inserted replaced
13:1eb8015a8491 15:c0dfc135a46c
    23 #include <hbaction.h>
    23 #include <hbaction.h>
    24 #include <hbmainwindow.h>
    24 #include <hbmainwindow.h>
    25 #include <hbmenu.h>
    25 #include <hbmenu.h>
    26 
    26 
    27 #include "BrowserWrapper.h"
    27 #include "BrowserWrapper.h"
    28 #include "HelpDocumentLoader.h"
       
    29 #include "HelpDataProvider.h"
    28 #include "HelpDataProvider.h"
    30 #include "HelpUtils.h"
    29 #include "HelpUtils.h"
    31 #include "HelpContentsView.h"
    30 #include "HelpContentsView.h"
    32 
    31 
    33 HelpContentsView::HelpContentsView() : mBrowser(NULL)
    32 HelpContentsView::HelpContentsView() : mBrowser(NULL)
    38 {
    37 {
    39 }
    38 }
    40 
    39 
    41 void HelpContentsView::init()
    40 void HelpContentsView::init()
    42 {
    41 {
       
    42 	initDocMl();
    43     initBackAction();
    43     initBackAction();
    44     mBrowser = HelpUIBuilder::findWidget<BrowserWrapper*>(DOCML_BROWSER_CONTENTS);
    44     mBrowser = mBuilder.findWidget<BrowserWrapper*>(DOCML_BROWSER_CONTENTS);
    45     mBrowser->init();
    45     mBrowser->init();
    46 
    46 
    47     connect(mBrowser, SIGNAL(linkClicked(const QUrl&)), this, SLOT(onLinkClicked(const QUrl&)));
    47     connect(mBrowser, SIGNAL(linkClicked(const QUrl&)), this, SLOT(onLinkClicked(const QUrl&)));
    48     connect(mBrowser, SIGNAL(urlChanged(const QUrl&)), this, SLOT(onUrlChanged(const QUrl&)));
    48     connect(mBrowser, SIGNAL(urlChanged(const QUrl&)), this, SLOT(onUrlChanged(const QUrl&)));
    49     connect(mainWindow(), SIGNAL(currentViewChanged(HbView*)), this, SLOT(onCurrentViewChanged(HbView*)));
    49     connect(mainWindow(), SIGNAL(currentViewChanged(HbView*)), this, SLOT(onCurrentViewChanged(HbView*)));
       
    50 }
       
    51 
       
    52 void HelpContentsView::initDocMl()
       
    53 {
       
    54  // Create widget hierarchy
       
    55     setObjectName( DOCML_VIEW_CONTENTS );
       
    56 
       
    57     // List existing root elements - this allows us to refer to objects in the XML 
       
    58     // which are created outside the document.
       
    59     QObjectList roots;
       
    60     roots.append( this );
       
    61 
       
    62 	mBuilder.setObjectTree(roots);
       
    63 
       
    64     mBuilder.load(QRC_DOCML_CONTENTS);
    50 }
    65 }
    51 
    66 
    52 void HelpContentsView::initBackAction()
    67 void HelpContentsView::initBackAction()
    53 {
    68 {
    54     mSoftKeyAction = new HbAction(Hb::BackAction);
    69     mSoftKeyAction = new HbAction(Hb::BackAction);
   117 
   132 
   118 ///////////////////////////////////////////////////////////////////////////////////////
   133 ///////////////////////////////////////////////////////////////////////////////////////
   119 
   134 
   120 void HelpContentsView::onBackAction()
   135 void HelpContentsView::onBackAction()
   121 {
   136 {
   122 	if(this == mainWindow()->currentView())
   137 	if(mBrowser->canGoBack())
   123 	{
   138 	{
   124 		if(mBrowser->canGoBack())
   139 		mBrowser->back();
   125 		{
   140 	}
   126 			mBrowser->back();
   141 	else
   127 		}
   142 	{
   128 		else
   143 		emit activateView(HelpViewCategory);
   129 		{
       
   130 			emit activateView(HelpViewCategory);
       
   131 		}
       
   132 	}
   144 	}
   133 }
   145 }
   134 
   146 
   135 ///////////////////////////////////////////////////////////////////////////////////////
   147 ///////////////////////////////////////////////////////////////////////////////////////
   136 
   148