userguide/src/HelpDataProvider.cpp
changeset 33 1038206aa0cb
parent 23 99b096216bc8
child 34 4533d75b8d4e
--- 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))
 	{