Revision: 201023
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 23 Jun 2010 18:03:20 +0300
changeset 33 1038206aa0cb
parent 23 99b096216bc8
child 34 4533d75b8d4e
Revision: 201023 Kit: 2010125
userguide/Userguide.pro
userguide/inc/HelpBaseView.h
userguide/inc/HelpDataProvider.h
userguide/inc/HelpKeywordView.h
userguide/inc/HelpMainWindow.h
userguide/inc/HelpUtils.h
userguide/resources/xml/keywordView.docml
userguide/src/HelpDataProvider.cpp
userguide/src/HelpKeywordView.cpp
userguide/src/HelpMainWindow.cpp
userguide/src/HelpUtils.cpp
--- a/userguide/Userguide.pro	Fri Jun 11 13:29:58 2010 +0300
+++ b/userguide/Userguide.pro	Wed Jun 23 18:03:20 2010 +0300
@@ -58,6 +58,8 @@
   	TARGET.CAPABILITY = CAP_APPLICATION
   	TARGET.EPOCHEAPSIZE = 0x020000 0x1000000
 
+    CONFIG += mobility
+    MOBILITY = systeminfo
   	LIBS += -lezip -lxqservice -lxqserviceutil
   	include(rom/userguide.pri)
 }
--- a/userguide/inc/HelpBaseView.h	Fri Jun 11 13:29:58 2010 +0300
+++ b/userguide/inc/HelpBaseView.h	Wed Jun 23 18:03:20 2010 +0300
@@ -45,8 +45,8 @@
     void onToolbarFind()	{ emit showFindList(); };
     void onToolbarOnlineSupport();
 
-private slots:
-	void onOrientationChanged(Qt::Orientation orientation);
+protected slots:
+	virtual void onOrientationChanged(Qt::Orientation orientation);
 
 protected:
 	void initBaseDocMl();
--- a/userguide/inc/HelpDataProvider.h	Fri Jun 11 13:29:58 2010 +0300
+++ b/userguide/inc/HelpDataProvider.h	Wed Jun 23 18:03:20 2010 +0300
@@ -61,7 +61,7 @@
 	//parse xml
 	void parseCategoryIndexXml(const QString& path, QStringList& uidList, QStringList& titleList);
 	void parseCategory2IndexXml(const QString& path, QStringList& hrefList, QStringList& titleList);
-	void parseBuiltInMetaxml(const QString& path, int& featureId, int& priority);
+	void parseBuiltInMetaxml(const QString& path, int& priority);
 	void parseAppMetaxml(const QString& path, QString& title);	
 
 private:
--- a/userguide/inc/HelpKeywordView.h	Fri Jun 11 13:29:58 2010 +0300
+++ b/userguide/inc/HelpKeywordView.h	Wed Jun 23 18:03:20 2010 +0300
@@ -25,7 +25,7 @@
 class HbListView;
 class HbSearchPanel;
 class HbStaticVkbHost;
-class HbGroupBox;
+class HbLabel;
 
 class HelpKeywordView : public HelpBaseView
 {
@@ -42,15 +42,18 @@
 	void initSearchList();
 	void initSearchPanel();
 	void initBackAction();
-	void initEmptyLabel();
 	void initVirtualKeyboard();
-	
+
 private:
-	HbGroupBox* groupBox();
+	void onOrientationChanged(Qt::Orientation orientation);
+
+private:
+	HbLabel* label();
     
 private:
 	void updateVisibleItems(bool visible);
 	void ResetSearchPanel();	
+	void updateLabelPos();
 
 private slots: // handle system event
     void onViewReady();
--- a/userguide/inc/HelpMainWindow.h	Fri Jun 11 13:29:58 2010 +0300
+++ b/userguide/inc/HelpMainWindow.h	Wed Jun 23 18:03:20 2010 +0300
@@ -38,6 +38,7 @@
 
 private slots:
     void onActivateView(HelpViewName viewName);
+    void saveActivity();
 
 private: // activate views
 	void activateCategoryView();
--- a/userguide/inc/HelpUtils.h	Fri Jun 11 13:29:58 2010 +0300
+++ b/userguide/inc/HelpUtils.h	Wed Jun 23 18:03:20 2010 +0300
@@ -25,6 +25,7 @@
 public:
 	static void loadHtmlFromZipFile(const QString& path, const QString& htmlFile, QString& htmlContent);
 	static int launchApplication(const QString& appUid);
+	static bool suppportFeatureID(int featureID);
 	static QString rootPath();
 	static QString UILocaleFromQtToSymbian();
 	static Qt::Orientation defaultOrientation();
--- a/userguide/resources/xml/keywordView.docml	Fri Jun 11 13:29:58 2010 +0300
+++ b/userguide/resources/xml/keywordView.docml	Wed Jun 23 18:03:20 2010 +0300
@@ -1,126 +1,99 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<hbdocument version="1.0">
-  
+<hbdocument version="1.1">
   <widget name="view_help" type="HbView">
     <widget name="content" role="HbView:widget" type="HbWidget">
-      <widget name="no_match_label" type="HbLabel">
-        <rect height="83.33582un" name="geometry" width="51.04478un" x="1.34328un" y="1.34328un"/>
-        <string locid="txt_user_guide_list_no_match_found" name="plainText" value="Label"/>
-        <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
-        <sizepolicy horizontalPolicy="Preferred" horizontalStretch="0" verticalPolicy="Expanding" verticalStretch="0"/>
-      </widget>
-      <widget name="groupBox" type="HbGroupBox">
-        <bool name="collapsable" value="FALSE"/>
-        <string locid="txt_user_guide_setlabel_search" name="heading" value="Group Box"/>
-      </widget>
       <widget name="list_search" type="HbListView">
         <widget name="listItemPrototype" role="HbAbstractView:prototype" type="HbListViewItem"/>
+        <sizehint height="85.52239un" type="PREFERRED" width="45.8209un"/>
+        <rect height="63.20149un" name="geometry" width="51.04478un" x="1.64179un" y="11.79105un"/>
+        <bool name="visible" value="FALSE"/>
       </widget>
-      <widget name="search_panel" type="HbSearchPanel"/>
+      <widget name="search_panel" type="HbSearchPanel">
+        <rect height="9.3806un" name="geometry" width="51.04478un" x="1.79104un" y="75.22388un"/>
+        <bool name="visible" value="FALSE"/>
+      </widget>
+      <widget name="no_match_label" type="HbLabel">
+        <real name="z" value="1"/>
+        <string locid="txt_user_guide_list_no_match_found" name="plainText" value="Label"/>
+        <enums name="alignment" value="AlignTop|AlignHCenter"/>
+        <fontspec name="fontSpec" role="Primary" textheight="26.8"/>
+        <bool name="visible" value="FALSE"/>
+      </widget>
     </widget>
     <string locid="txt_user_guide_title_user_guide" name="title" value="View"/>
   </widget>
-  
   <section name="layout_find">
-    <widget name="view_help" type="HbView">
-      <widget name="content" role="HbView:widget" type="HbWidget">
-        <widget name="groupBox" type="HbGroupBox">
-          <bool name="visible" value="TRUE"/>
-        </widget>
-        <widget name="no_match_label" type="HbLabel">
-          <bool name="visible" value="FALSE"/>
-        </widget>
-        <widget name="list_search" type="HbListView">
-          <bool name="visible" value="TRUE"/>
-        </widget>
-        <widget name="search_panel" type="HbSearchPanel">
-          <bool name="visible" value="TRUE"/>
-        </widget>
-        <real name="z" value="0"/>
-        <layout orientation="Vertical" type="linear">
-          <contentsmargins bottom="0px" left="0px" right="0px" top="0px"/>
-          <linearitem itemname="groupBox"/>
-          <linearitem itemname="list_search"/>
-          <linearitem itemname="search_panel"/>
-        </layout>
-      </widget>
+    <widget name="list_search" type="HbListView">
+      <bool name="visible" value="TRUE"/>
+    </widget>
+    <widget name="content" role="HbView:widget" type="HbWidget">
+      <layout orientation="Vertical" type="linear">
+        <linearitem itemname="list_search"/>
+        <linearitem itemname="search_panel"/>
+      </layout>
+    </widget>
+    <widget name="search_panel" type="HbSearchPanel">
+      <bool name="visible" value="TRUE"/>
+    </widget>
+    <widget name="no_match_label" type="HbLabel">
+      <bool name="visible" value="FALSE"/>
     </widget>
   </section>
-
   <section name="layout_find_no_searchpanel">
-    <widget name="view_help" type="HbView">
-      <widget name="content" role="HbView:widget" type="HbWidget">
-        <widget name="groupBox" type="HbGroupBox">
-          <bool name="visible" value="TRUE"/>
-        </widget>
-        <widget name="no_match_label" type="HbLabel">
-          <bool name="visible" value="FALSE"/>
-        </widget>
-        <widget name="list_search" type="HbListView">
-          <bool name="visible" value="TRUE"/>
-        </widget>
-        <widget name="search_panel" type="HbSearchPanel">
-          <bool name="visible" value="FALSE"/>
-        </widget>
-        <real name="z" value="0"/>
-        <layout orientation="Vertical" type="linear">
-          <contentsmargins bottom="0px" left="0px" right="0px" top="0px"/>
-          <linearitem itemname="groupBox"/>
-          <linearitem itemname="list_search"/>
-        </layout>
-      </widget>
+    <widget name="list_search" type="HbListView">
+      <bool name="visible" value="TRUE"/>
+    </widget>
+    <widget name="content" role="HbView:widget" type="HbWidget">
+      <layout orientation="Vertical" type="linear">
+        <linearitem itemname="list_search"/>
+      </layout>
+    </widget>
+    <widget name="search_panel" type="HbSearchPanel">
+      <bool name="visible" value="FALSE"/>
+    </widget>
+    <widget name="no_match_label" type="HbLabel">
+      <bool name="visible" value="FALSE"/>
     </widget>
   </section>
-
   <section name="layout_find_no_match">
-    <widget name="view_help" type="HbView">
-      <widget name="content" role="HbView:widget" type="HbWidget">
-        <widget name="groupBox" type="HbGroupBox">
-          <bool name="visible" value="TRUE"/>
-        </widget>
-        <widget name="no_match_label" type="HbLabel">
-          <bool name="visible" value="TRUE"/>
-        </widget>
-        <widget name="list_search" type="HbListView">
-          <bool name="visible" value="FALSE"/>
-        </widget>
-        <widget name="search_panel" type="HbSearchPanel">
-          <bool name="visible" value="TRUE"/>
-        </widget>
-        <real name="z" value="0"/>
-        <layout orientation="Vertical" type="linear">
-          <contentsmargins bottom="0px" left="0px" right="0px" top="0px"/>
-          <linearitem itemname="groupBox"/>
-          <linearitem itemname="no_match_label"/>
-          <linearitem itemname="search_panel"/>
-        </layout>
-      </widget>
+    <widget name="list_search" type="HbListView">
+      <bool name="visible" value="FALSE"/>
+    </widget>
+    <widget name="content" role="HbView:widget" type="HbWidget">
+      <layout orientation="Vertical" type="linear">
+        <linearitem itemname="no_match_label"/>
+        <linearitem itemname="search_panel"/>
+      </layout>
+    </widget>
+    <widget name="search_panel" type="HbSearchPanel">
+      <bool name="visible" value="TRUE"/>
+    </widget>
+    <widget name="no_match_label" type="HbLabel">
+      <bool name="visible" value="TRUE"/>
     </widget>
   </section>
-
   <section name="layout_find_no_searchpanel_no_match">
-    <widget name="view_help" type="HbView">
-      <widget name="content" role="HbView:widget" type="HbWidget">
-        <widget name="groupBox" type="HbGroupBox">
-          <bool name="visible" value="TRUE"/>
-        </widget>
-        <widget name="no_match_label" type="HbLabel">
-          <bool name="visible" value="TRUE"/>
-        </widget>
-        <widget name="list_search" type="HbListView">
-          <bool name="visible" value="FALSE"/>
-        </widget>
-        <widget name="search_panel" type="HbSearchPanel">
-          <bool name="visible" value="FALSE"/>
-        </widget>
-        <real name="z" value="0"/>
-        <layout orientation="Vertical" type="linear">
-          <contentsmargins bottom="0px" left="0px" right="0px" top="0px"/>
-          <linearitem itemname="groupBox"/>
-          <linearitem itemname="no_match_label"/>
-         </layout>
-      </widget>
+    <widget name="list_search" type="HbListView">
+      <bool name="visible" value="FALSE"/>
+    </widget>
+    <widget name="content" role="HbView:widget" type="HbWidget">
+      <layout orientation="Vertical" type="linear">
+        <linearitem itemname="no_match_label"/>
+      </layout>
+    </widget>
+    <widget name="search_panel" type="HbSearchPanel">
+      <bool name="visible" value="FALSE"/>
+    </widget>
+    <widget name="no_match_label" type="HbLabel">
+      <bool name="visible" value="TRUE"/>
     </widget>
   </section>
-  
+  <metadata activeUIState="search_no_match_no_panel" display="NHD-3.2-inch_portrait" unit="un">
+    <uistate name="Common ui state" sections="#common"/>
+    <uistate name="search" sections="#common layout_find"/>
+    <uistate name="search_no_panel" sections="#common layout_find_no_searchpanel"/>
+    <uistate name="search_no_match" sections="#common layout_find_no_match"/>
+    <uistate name="search_no_match_no_panel" sections="#common layout_find_no_searchpanel_no_match"/>
+    <dummydata objectName="list_search" section="#common" value="app_list_template5"/>
+  </metadata>
 </hbdocument>
--- a/userguide/src/HelpDataProvider.cpp	Fri Jun 11 13:29:58 2010 +0300
+++ b/userguide/src/HelpDataProvider.cpp	Wed Jun 23 18:03:20 2010 +0300
@@ -255,9 +255,8 @@
 
 void HelpDataProvider::constructBuiltInCategoryItem(const QString& uid, const QString& title)
 {
-	int featureId;
 	int priority;
-	parseBuiltInMetaxml(uid, featureId, priority);
+	parseBuiltInMetaxml(uid, priority);
 	
 	HelpStandardItem* item = NULL;
 	item = new HelpStandardItem(title);
@@ -346,6 +345,33 @@
 	{
 		return;
 	}
+
+	QStringList featureIdLst;
+
+	query.setQuery("doc($inputdoc)/collections/collection/number(@FeatureId)");
+	if(!query.isValid())
+	{
+		return;
+	}
+	if(!query.evaluateTo(&featureIdLst))
+	{
+		return;
+	}
+
+	if(featureIdLst.count() != uidList.count())
+	{
+		return;
+	}
+
+	for(int i = featureIdLst.count()  - 1; i <= 0; i--)
+	{
+		int featureID = featureIdLst.at(i).toInt();
+		if(!HelpUtils::suppportFeatureID(featureID))
+		{
+			uidList.removeAt(i);
+			titleList.removeAt(i);
+		}
+	}
 }
 
 void HelpDataProvider::parseCategory2IndexXml(const QString& path, QStringList& hrefList, QStringList& titleList)
@@ -361,7 +387,6 @@
 
 	//parse index xml to a stringlist, each string include href and navtitle and seperate by "specilchar"
 	QXmlQuery query;
-	QXmlItem xmlItem(SPECIALCHAR);
 	query.bindVariable("inputdoc", &file);
 
 	query.setQuery("doc($inputdoc)/topics/topicref/xs:string(@href)");	
@@ -383,15 +408,41 @@
 	{
 		return;
 	}
+
+	QStringList featureIdLst;
+
+	query.setQuery("doc($inputdoc)/topics/topicref/number(@FeatureId)");
+	if(!query.isValid())
+	{
+		return;
+	}
+	if(!query.evaluateTo(&featureIdLst))
+	{
+		return;
+	}
+
+	if(featureIdLst.count() != hrefList.count())
+	{
+		return;
+	}
+
+	for(int i = featureIdLst.count()  - 1; i <= 0; i--)
+	{
+		int featureID = featureIdLst.at(i).toInt();
+		if(!HelpUtils::suppportFeatureID(featureID))
+		{
+			hrefList.removeAt(i);
+			titleList.removeAt(i);
+		}
+	}
 }
 
-void HelpDataProvider::parseBuiltInMetaxml(const QString& path, int& featureId, int& priority)
+void HelpDataProvider::parseBuiltInMetaxml(const QString& path, int& priority)
 {
 	QString pathMetaxml(path);
 	pathMetaxml.append(BACKSLASH);
 	pathMetaxml.append(METAXML);
 
-	featureId = -1;
 	priority = -1;
 
 	QFile file(pathMetaxml);
@@ -404,12 +455,6 @@
 	QString str;
 	query.bindVariable("inputdoc", &file);
 
-	query.setQuery("doc($inputdoc)/meta/title/number(@FeatureId)");
-	if(query.isValid() && query.evaluateTo(&str))
-	{
-		featureId = str.toInt();
-	}
-
 	query.setQuery("doc($inputdoc)/meta/number(priority)");	
 	if(query.isValid() && query.evaluateTo(&str))
 	{
--- a/userguide/src/HelpKeywordView.cpp	Fri Jun 11 13:29:58 2010 +0300
+++ b/userguide/src/HelpKeywordView.cpp	Wed Jun 23 18:03:20 2010 +0300
@@ -31,7 +31,6 @@
 #include <hblineedit.h>
 #include <hbmenu.h>
 #include <hbstaticvkbhost.h>
-#include <hbgroupbox.h>
 
 #include "HelpDataProvider.h"
 #include "HelpProxyModel.h"
@@ -61,7 +60,6 @@
     initSearchList();
     initSearchPanel();
 	initVirtualKeyboard();
-	initEmptyLabel();
     
     connect(mainWindow(), SIGNAL(viewReady()), this, SLOT(onViewReady()));
 }
@@ -99,22 +97,17 @@
     connect(mVirtualKeyboard, SIGNAL(keypadClosed()), this, SLOT(onHandleKeypadClose()));
 }
 
-void HelpKeywordView::initEmptyLabel()
+HbLabel* HelpKeywordView::label()
 {
-	HbLabel* label = mBuilder.findWidget<HbLabel*>(DOCML_NO_MATCH_LABEL);
-	label->setFontSpec(HbFontSpec(HbFontSpec::Primary));
+	return mBuilder.findWidget<HbLabel*>(DOCML_NO_MATCH_LABEL);
 }
 
 void HelpKeywordView::loadAllContent()
 {
+	toolBar()->hide();
 	mBuilder.load(QRC_DOCML_KEYWORD, DOCML_LAYOUT_SEARCH);
 	ResetSearchPanel();
-	toolBar()->hide();
-}
-
-HbGroupBox* HelpKeywordView::groupBox()
-{
-	return mBuilder.findWidget<HbGroupBox*>(DOCML_GROUPBOX);
+	
 }
 
 ////////////////////////////////////////////////////////////////////////////////////////////
@@ -150,6 +143,35 @@
     }
 }
 
+void HelpKeywordView::updateLabelPos()
+{
+	HbDeviceProfile profile = HbDeviceProfile::profile(mainWindow());
+	qreal unValue = profile.unitValue();
+	if(mainWindow()->orientation() == Qt::Vertical)
+	{
+		if(mVirtualKeyboard->keypadStatus() == HbVkbHost::HbVkbStatusClosed)
+		{
+			label()->setContentsMargins(0,30 * unValue,0,0);
+		}
+		else
+		{
+			label()->setContentsMargins(0,10 * unValue,0,0);
+		}
+	}
+	else
+	{
+		if(mVirtualKeyboard->keypadStatus() == HbVkbHost::HbVkbStatusClosed)
+		{
+			label()->setContentsMargins(0,10 * unValue,0,0);
+		}
+		else
+		{
+            label()->setContentsMargins(0,0,0,0);
+			label()->setAlignment(label()->alignment() | Qt::AlignVCenter);
+		}
+	}
+}
+
 ////////////////////////////////////////////////////////////////////////////////////////////
 // handle system event
 
@@ -217,18 +239,6 @@
 	}
 
 	toolBar()->hide();
-
-	if(criteria.isEmpty())
-	{
-		groupBox()->setHeading(hbTrId(TXT_SETLABEL_SEARCH));
-	}
-	else
-	{
-		QString heading = qtTrId(TXT_SETLABEL_SEARCH_RESULTS);
-		heading.append(COLON);
-		heading.append(criteria);
-		groupBox()->setHeading(heading);
-	}
 }
 
 ////////////////////////////////////////////////////////////////////////////////////////////
@@ -239,6 +249,7 @@
 	updateVisibleItems(false);
     qreal heightToSet = mainWindow()->layoutRect().height() - mVirtualKeyboard->keyboardArea().height();
     this->setMaximumHeight(heightToSet);
+	updateLabelPos();
 }
 
 void HelpKeywordView::onHandleKeypadClose()
@@ -248,6 +259,13 @@
 	qreal toolbarHeight = toolBar()->size().height();
 	qreal height = mainHeight - (toolBar()->isVisible() ? toolbarHeight : 0);
 	this->setMaximumHeight(height);
+	updateLabelPos();
+}
+
+void HelpKeywordView::onOrientationChanged(Qt::Orientation orientation)
+{
+	HelpBaseView::onOrientationChanged(orientation);
+	updateLabelPos();
 }
 
 // end of file
--- a/userguide/src/HelpMainWindow.cpp	Fri Jun 11 13:29:58 2010 +0300
+++ b/userguide/src/HelpMainWindow.cpp	Wed Jun 23 18:03:20 2010 +0300
@@ -18,6 +18,8 @@
 #include <hbtoolbar.h>
 #include <hbnotificationdialog.h>
 #include <hbaction.h>
+#include <hbapplication.h>
+#include <hbactivitymanager.h>
 
 #include "HelpBaseView.h"
 #include "HelpCategoryView.h"
@@ -32,6 +34,7 @@
 mKeywordView(NULL),
 mContentsView(NULL)
 {
+    QObject::connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(saveActivity()));
     activateCategoryView();
 }
 
@@ -129,5 +132,33 @@
 	mKeywordView->loadAllContent();
 }
 
+void HelpMainWindow::saveActivity()
+{
+  HbActivityManager* activityManager = qobject_cast<HbApplication*>(qApp)->activityManager();
+
+  // clean up any previous versions of this activity from the activity manager.
+  bool ok = activityManager->removeActivity("UserGuideMainView");
+  if ( !ok )
+      {
+      //qFatal("Remove failed" );
+      }
+
+  // get a screenshot for saving to the activity manager
+  QVariantHash metadata;
+  metadata.insert("screenshot", QPixmap::grabWidget(this, rect()));
+
+  // save any data necessary to save the state
+  QByteArray serializedActivity;
+  QDataStream stream(&serializedActivity, QIODevice::WriteOnly | QIODevice::Append);
+  stream << "whatever data you need to save the state adequately";
+
+  // add the activity to the activity manager
+  ok = activityManager->addActivity("UserGuideMainView", serializedActivity, metadata);
+  if ( !ok )
+      {
+      qFatal("Add failed" );
+      }
+}
+
 // end of file
 
--- a/userguide/src/HelpUtils.cpp	Fri Jun 11 13:29:58 2010 +0300
+++ b/userguide/src/HelpUtils.cpp	Wed Jun 23 18:03:20 2010 +0300
@@ -28,8 +28,10 @@
 
 #ifdef Q_OS_SYMBIAN
 
+#include <qsysteminfo.h>
+#include <xqappmgr.h>
+
 #include <e32const.h>
-#include <xqappmgr.h>
 #include <eikenv.h>
 #include <zipfile.h>
 
@@ -230,6 +232,9 @@
 
     QString uriStr("appto://");
     uriStr.append(appUid);
+  /*  uriStr.append("?");
+    uriStr.append("activityname");
+    uriStr.append("=MainView&key1=data1&key2=data2");*/
     QUrl uri(uriStr); 
     
     XQApplicationManager appmgr;
@@ -249,6 +254,21 @@
     return 0;
 }
 
+bool HelpUtils::suppportFeatureID(int featureID)
+{
+#ifdef Q_OS_SYMBIAN
+	if(featureID == -1)
+	{
+		return true;
+	}
+    QtMobility::QSystemInfo sysInfo;
+	return sysInfo.hasFeatureSupported((QtMobility::QSystemInfo::Feature)featureID);
+#else
+	Q_UNUSED(featureID);
+	return true;
+#endif
+}
+
 Qt::Orientation HelpUtils::defaultOrientation()
 {
 	return Qt::Vertical;