201031
authorhgs
Fri, 06 Aug 2010 16:46:22 +0800
changeset 37 4eefeeb3cd2d
parent 36 b29c02149a27
child 41 272a0bda78b3
201031
userguide/src/HelpCategoryView.cpp
userguide/src/HelpDataProvider.cpp
--- a/userguide/src/HelpCategoryView.cpp	Fri Jul 23 16:36:59 2010 +0800
+++ b/userguide/src/HelpCategoryView.cpp	Fri Aug 06 16:46:22 2010 +0800
@@ -113,7 +113,7 @@
         return;
     }
 
-    QString uid = mListAll->model()->data(index.parent(), UidRole).toString();
+	QString uid = mListAll->model()->data(index, UidRole).toString();
     QString href = mListAll->model()->data(index, HrefRole).toString();
     HelpDataProvider::instance()->setHelpContentUrl(uid, href);
     emit activateView(HelpViewContents);
--- a/userguide/src/HelpDataProvider.cpp	Fri Jul 23 16:36:59 2010 +0800
+++ b/userguide/src/HelpDataProvider.cpp	Fri Aug 06 16:46:22 2010 +0800
@@ -228,7 +228,7 @@
 			continue;
 		}
 
-		if(uidList.contains(uid))
+		if(uidList.contains(uid) || mUpdateUidList.contains(uid))
 		{
 			mUpdateUidList.append(uid);
 			constructBuiltInCategoryItem(pathUid, titleStr);
@@ -237,11 +237,23 @@
 
 		HelpStandardItem* item = NULL;
 		item = new HelpStandardItem(titleStr);
+
+		if(!item)
+		{
+			//no memory
+			return;
+		}
+
 		item->setData(pathUid, UidRole);
 
 		if(!mAppItem)
 		{
 			mAppItem = new HelpStandardItem(qtTrId(TXT_APPLICATIONS));
+			if(!mAppItem)
+			{
+				//no memory
+				return;
+			}
 			mAppItem->setData(APPPRIORITY, PriorityRole);
 		}
 		mAppItem->appendRow(item);
@@ -255,13 +267,15 @@
 	
 	HelpStandardItem* item = NULL;
 	item = new HelpStandardItem(title);
-	item->setData(uid, UidRole);
 
-	if(item)
+	if(!item)
 	{
-		item->setData(priority, PriorityRole);
-		mHelpModel->appendRow(item);
+		//no memory
+		return;
 	}
+	item->setData(uid, UidRole);
+	item->setData(priority, PriorityRole);
+	mHelpModel->appendRow(item);
 }
 
 void HelpDataProvider::constructCategory2(HelpStandardItem* itemParent)
@@ -289,8 +303,15 @@
 
 	for(int i = 0; i < hrefList.count(); i++)
 	{
-		HelpStandardItem* item = new HelpStandardItem(titleList[i]);
+		HelpStandardItem* item = NULL;
+		item = new HelpStandardItem(titleList[i]);
+		if(!item)
+		{
+			//no memory
+			return;
+		}
 		item->setData(hrefList[i], HrefRole);
+		item->setData(uid, UidRole);
 		itemParent->appendRow(item);
 		constructKeywordModel(titleList[i], uid, hrefList[i]);
 	}
@@ -300,10 +321,16 @@
 
 void HelpDataProvider::constructKeywordModel(const QString& title, const QString& uid, const QString& href)
 {
-	HelpStandardItem* itemTemp = new HelpStandardItem(title);
-	itemTemp->setData(uid, UidRole);
-	itemTemp->setData(href, HrefRole);
-	mKeywordModel->appendRow(itemTemp);
+	HelpStandardItem* item = NULL;
+	item = new HelpStandardItem(title);
+	if(!item)
+	{
+		//no memory
+		return;
+	}
+	item->setData(uid, UidRole);
+	item->setData(href, HrefRole);
+	mKeywordModel->appendRow(item);
 }
 
 void HelpDataProvider::parseCategoryIndexXml(const QString& path, QStringList& uidList, QStringList& titleList)