userguide/src/HelpContentsView.cpp
changeset 24 bce8d4d2cc72
parent 15 c0dfc135a46c
equal deleted inserted replaced
15:c0dfc135a46c 24:bce8d4d2cc72
    44     mBrowser = mBuilder.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(viewReady()), this, SLOT(onViewReady()));
    50 }
    50 }
    51 
    51 
    52 void HelpContentsView::initDocMl()
    52 void HelpContentsView::initDocMl()
    53 {
    53 {
    54  // Create widget hierarchy
    54 	initBaseDocMl();
    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);
    55     mBuilder.load(QRC_DOCML_CONTENTS);
    65 }
    56 }
    66 
    57 
    67 void HelpContentsView::initBackAction()
    58 void HelpContentsView::initBackAction()
    68 {
    59 {
    69     mSoftKeyAction = new HbAction(Hb::BackAction);
    60     mSoftKeyAction = new HbAction(Hb::BackNaviAction  );
    70     connect(mSoftKeyAction, SIGNAL(triggered()), this, SLOT(onBackAction()));
    61     connect(mSoftKeyAction, SIGNAL(triggered()), this, SLOT(onBackAction()));
    71 }
    62 }
    72 
    63 
    73 ///////////////////////////////////////////////////////////////////////////////////////
    64 ///////////////////////////////////////////////////////////////////////////////////////
    74 
    65 
   108 }
    99 }
   109 
   100 
   110 void HelpContentsView::openHelpContent(const QUrl& url)
   101 void HelpContentsView::openHelpContent(const QUrl& url)
   111 {
   102 {
   112     QString html;
   103     QString html;
   113     QString baseUrl = url.toString();
   104     QString urlStr = url.toString();
   114     HelpDataProvider::instance()->getHelpContentData(html, baseUrl);
   105     HelpDataProvider::instance()->getHelpContentData(html, urlStr);
   115     mBrowser->setHtml(html, baseUrl);
   106 	mBrowser->setHtml(html, urlStr);
   116 }
   107 }
   117 
   108 
   118 ////////////////////////////////////////////////////////////////////////////////////////////
   109 ////////////////////////////////////////////////////////////////////////////////////////////
   119 
   110 
   120 void HelpContentsView::onCurrentViewChanged(HbView *view)
   111 void HelpContentsView::onViewReady()
   121 {
   112 {
   122     if(this == view)
   113     if(isVisible())
   123     {
   114     {
   124         setNavigationAction(mSoftKeyAction);
   115         setNavigationAction(mSoftKeyAction);
   125         openHelpContent();
   116         openHelpContent();
   126     }
   117     }
   127     else
   118     else
   138 	{
   129 	{
   139 		mBrowser->back();
   130 		mBrowser->back();
   140 	}
   131 	}
   141 	else
   132 	else
   142 	{
   133 	{
   143 		emit activateView(HelpViewCategory);
   134 		emit activateView(PreviousView);
   144 	}
   135 	}
   145 }
   136 }
   146 
   137 
   147 ///////////////////////////////////////////////////////////////////////////////////////
   138 ///////////////////////////////////////////////////////////////////////////////////////
   148 
   139