226 if(titleStr.isEmpty()) |
226 if(titleStr.isEmpty()) |
227 { |
227 { |
228 continue; |
228 continue; |
229 } |
229 } |
230 |
230 |
231 if(uidList.contains(uid)) |
231 if(uidList.contains(uid) || mUpdateUidList.contains(uid)) |
232 { |
232 { |
233 mUpdateUidList.append(uid); |
233 mUpdateUidList.append(uid); |
234 constructBuiltInCategoryItem(pathUid, titleStr); |
234 constructBuiltInCategoryItem(pathUid, titleStr); |
235 continue; |
235 continue; |
236 } |
236 } |
237 |
237 |
238 HelpStandardItem* item = NULL; |
238 HelpStandardItem* item = NULL; |
239 item = new HelpStandardItem(titleStr); |
239 item = new HelpStandardItem(titleStr); |
|
240 |
|
241 if(!item) |
|
242 { |
|
243 //no memory |
|
244 return; |
|
245 } |
|
246 |
240 item->setData(pathUid, UidRole); |
247 item->setData(pathUid, UidRole); |
241 |
248 |
242 if(!mAppItem) |
249 if(!mAppItem) |
243 { |
250 { |
244 mAppItem = new HelpStandardItem(qtTrId(TXT_APPLICATIONS)); |
251 mAppItem = new HelpStandardItem(qtTrId(TXT_APPLICATIONS)); |
|
252 if(!mAppItem) |
|
253 { |
|
254 //no memory |
|
255 return; |
|
256 } |
245 mAppItem->setData(APPPRIORITY, PriorityRole); |
257 mAppItem->setData(APPPRIORITY, PriorityRole); |
246 } |
258 } |
247 mAppItem->appendRow(item); |
259 mAppItem->appendRow(item); |
248 } |
260 } |
249 } |
261 } |
253 int priority; |
265 int priority; |
254 parseBuiltInMetaxml(uid, priority); |
266 parseBuiltInMetaxml(uid, priority); |
255 |
267 |
256 HelpStandardItem* item = NULL; |
268 HelpStandardItem* item = NULL; |
257 item = new HelpStandardItem(title); |
269 item = new HelpStandardItem(title); |
|
270 |
|
271 if(!item) |
|
272 { |
|
273 //no memory |
|
274 return; |
|
275 } |
258 item->setData(uid, UidRole); |
276 item->setData(uid, UidRole); |
259 |
277 item->setData(priority, PriorityRole); |
260 if(item) |
278 mHelpModel->appendRow(item); |
261 { |
|
262 item->setData(priority, PriorityRole); |
|
263 mHelpModel->appendRow(item); |
|
264 } |
|
265 } |
279 } |
266 |
280 |
267 void HelpDataProvider::constructCategory2(HelpStandardItem* itemParent) |
281 void HelpDataProvider::constructCategory2(HelpStandardItem* itemParent) |
268 { |
282 { |
269 int count = itemParent->rowCount(); |
283 int count = itemParent->rowCount(); |
287 return; |
301 return; |
288 } |
302 } |
289 |
303 |
290 for(int i = 0; i < hrefList.count(); i++) |
304 for(int i = 0; i < hrefList.count(); i++) |
291 { |
305 { |
292 HelpStandardItem* item = new HelpStandardItem(titleList[i]); |
306 HelpStandardItem* item = NULL; |
|
307 item = new HelpStandardItem(titleList[i]); |
|
308 if(!item) |
|
309 { |
|
310 //no memory |
|
311 return; |
|
312 } |
293 item->setData(hrefList[i], HrefRole); |
313 item->setData(hrefList[i], HrefRole); |
|
314 item->setData(uid, UidRole); |
294 itemParent->appendRow(item); |
315 itemParent->appendRow(item); |
295 constructKeywordModel(titleList[i], uid, hrefList[i]); |
316 constructKeywordModel(titleList[i], uid, hrefList[i]); |
296 } |
317 } |
297 |
318 |
298 itemParent->sortChildren(0, HelpUtils::sortOrder()); |
319 itemParent->sortChildren(0, HelpUtils::sortOrder()); |
299 } |
320 } |
300 |
321 |
301 void HelpDataProvider::constructKeywordModel(const QString& title, const QString& uid, const QString& href) |
322 void HelpDataProvider::constructKeywordModel(const QString& title, const QString& uid, const QString& href) |
302 { |
323 { |
303 HelpStandardItem* itemTemp = new HelpStandardItem(title); |
324 HelpStandardItem* item = NULL; |
304 itemTemp->setData(uid, UidRole); |
325 item = new HelpStandardItem(title); |
305 itemTemp->setData(href, HrefRole); |
326 if(!item) |
306 mKeywordModel->appendRow(itemTemp); |
327 { |
|
328 //no memory |
|
329 return; |
|
330 } |
|
331 item->setData(uid, UidRole); |
|
332 item->setData(href, HrefRole); |
|
333 mKeywordModel->appendRow(item); |
307 } |
334 } |
308 |
335 |
309 void HelpDataProvider::parseCategoryIndexXml(const QString& path, QStringList& uidList, QStringList& titleList) |
336 void HelpDataProvider::parseCategoryIndexXml(const QString& path, QStringList& uidList, QStringList& titleList) |
310 { |
337 { |
311 QString pathIndex(path); |
338 QString pathIndex(path); |