userguide/src/HelpContentsView.cpp
changeset 15 c0dfc135a46c
parent 13 1eb8015a8491
child 18 375271912456
child 24 bce8d4d2cc72
--- a/userguide/src/HelpContentsView.cpp	Fri Apr 16 14:53:45 2010 +0300
+++ b/userguide/src/HelpContentsView.cpp	Mon May 03 12:24:47 2010 +0300
@@ -25,7 +25,6 @@
 #include <hbmenu.h>
 
 #include "BrowserWrapper.h"
-#include "HelpDocumentLoader.h"
 #include "HelpDataProvider.h"
 #include "HelpUtils.h"
 #include "HelpContentsView.h"
@@ -40,8 +39,9 @@
 
 void HelpContentsView::init()
 {
+	initDocMl();
     initBackAction();
-    mBrowser = HelpUIBuilder::findWidget<BrowserWrapper*>(DOCML_BROWSER_CONTENTS);
+    mBrowser = mBuilder.findWidget<BrowserWrapper*>(DOCML_BROWSER_CONTENTS);
     mBrowser->init();
 
     connect(mBrowser, SIGNAL(linkClicked(const QUrl&)), this, SLOT(onLinkClicked(const QUrl&)));
@@ -49,6 +49,21 @@
     connect(mainWindow(), SIGNAL(currentViewChanged(HbView*)), this, SLOT(onCurrentViewChanged(HbView*)));
 }
 
+void HelpContentsView::initDocMl()
+{
+ // Create widget hierarchy
+    setObjectName( DOCML_VIEW_CONTENTS );
+
+    // List existing root elements - this allows us to refer to objects in the XML 
+    // which are created outside the document.
+    QObjectList roots;
+    roots.append( this );
+
+	mBuilder.setObjectTree(roots);
+
+    mBuilder.load(QRC_DOCML_CONTENTS);
+}
+
 void HelpContentsView::initBackAction()
 {
     mSoftKeyAction = new HbAction(Hb::BackAction);
@@ -119,16 +134,13 @@
 
 void HelpContentsView::onBackAction()
 {
-	if(this == mainWindow()->currentView())
+	if(mBrowser->canGoBack())
 	{
-		if(mBrowser->canGoBack())
-		{
-			mBrowser->back();
-		}
-		else
-		{
-			emit activateView(HelpViewCategory);
-		}
+		mBrowser->back();
+	}
+	else
+	{
+		emit activateView(HelpViewCategory);
 	}
 }