--- a/helps_info/helps_metadata/helps_metadata.mrp Fri May 14 15:42:52 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-
-component helps_metadata
-source \sf\app\helps\helps_info\helps_metadata
-source \sf\app\helps\package_definition.xml
-source \sf\app\helps\distribution.policy.s60
-notes_source \component_defs\release.src
-ipr T
--- a/layers.sysdef.xml Fri May 14 15:42:52 2010 +0300
+++ b/layers.sysdef.xml Fri Jun 11 13:29:58 2010 +0300
@@ -9,6 +9,9 @@
<module name="helps">
<unit name="helps" unitID="abs.helps" bldFile="&layer_real_source_path;/userguide" mrp="" proFile="Userguide.pro" />
</module>
+ <module name="symhelp">
+ <unit name="symhelp" unitID="abs.symhelp" bldFile="&layer_real_source_path;/symhelp/helpmodel/group" mrp="" />
+ </module>
</layer>
</systemModel>
</SystemDefinition>
--- a/package_definition.xml Fri May 14 15:42:52 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<SystemDefinition schema="3.0.0">
- <package id="helps" name="Help Apps" levels="eng tools if ui">
- <collection id="csxhelp" name="Context Sensitive Extended Help" level="if">
- <component id="aiwhelpprovider" filter="s60" name="AIW Help Provider" class="plugin">
- <!-- <unit bldFile="csxhelp/aiwhelpprovider/group"/> -->
- </component>
- <component id="csxhelp_build" filter="s60" name="Context Sensitive Extended Help Build">
- <unit bldFile="csxhelp/group"/>
- </component>
- </collection>
- <collection id="symhelp" name="Symbian Help" level="eng">
- <component id="helpmodel" name="Help" introduced="6.0" purpose="optional">
- <unit bldFile="symhelp/helpmodel/group" mrp="symhelp/helpmodel/group/app-services_hlpmodel.mrp"/>
- </component>
- </collection>
- <collection id="helps_info" name="Help Apps Info" level="ui">
- <component id="helps_metadata" name="Help Apps Metadata" class="config" introduced="^2" purpose="development" target="desktop">
- <unit mrp="helps_info/helps_metadata/helps_metadata.mrp"/>
- </component>
- </collection>
- </package>
-</SystemDefinition>
--- a/symhelp/helpmodel/TestData/Source/ER5Help/epochlp.alp.tmp Fri May 14 15:42:52 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE cshproj PUBLIC "/EPOC32/tools/cshlpcmp/dtd/CSHproj.dtd" "SYSTEM">
-<?xml:stylesheet href="/EPOC32/tools/cshlpcmp/xsl/CSHproj.xsl" title="CS-Help project" type="text/xsl"?>
-<cshproj>
- <helpfileUID>0x10006000</helpfileUID>
- <directories>
- <input>\work\help\</input>
- <output>\epoc32\wins\c\system\help\</output>
- <graphics>\work\help\</graphics>
- <working>\work\help\temp\</working>
- </directories>
- <files>
- <source>
- <file>agen-hlp.rtf</file>
- <file>bomb-hlp.rtf</file>
- <file>calc-hlp.rtf</file>
- <file>comm-hlp.rtf</file>
- <file>cont-hlp.rtf</file>
- <file>data-hlp.rtf</file>
- <file>dial-hlp.rtf</file>
- <file>dict-hlp.rtf</file>
- <file>gen--hlp.rtf</file>
- <file>hard-hlp.rtf</file>
- <file>jott-hlp.rtf</file>
- <file>prog-hlp.rtf</file>
- <file>rec--hlp.rtf</file>
- <file>shet-hlp.rtf</file>
- <file>sket-hlp.rtf</file>
- <file>spel-hlp.rtf</file>
- <file>syst-hlp.rtf</file>
- <file>time-hlp.rtf</file>
- <file>word-hlp.rtf</file>
- <file>xtra-hlp.rtf</file>
- </source>
- <destination>EPOCHlp</destination>
- <customization>\work\help\uk.alc.xml</customization>
- </files>
-</cshproj>
--- a/symhelp/helpmodel/TestData/Source/ER5Help/epochlp.alp.xml.bak Fri May 14 15:42:52 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE cshproj PUBLIC "/EPOC32/tools/cshlpcmp/dtd/CSHproj.dtd" "SYSTEM">
-<?xml:stylesheet href="/EPOC32/tools/cshlpcmp/xsl/CSHproj.xsl" title="CS-Help project" type="text/xsl"?>
-<cshproj>
- <helpfileUID>0x10006000</helpfileUID>
- <directories>
- <input>H:\aleppo\work\help\</input>
- <output>H:\epoc32\wins\c\system\help\</output>
- <graphics>H:\aleppo\work\help\</graphics>
- <working>H:\aleppo\work\help\temp\</working>
- </directories>
- <files>
- <source>
- <file>sket-hlp.rtf</file>
- </source>
- <destination>EPOCHlp</destination>
- <customization>H:\aleppo\work\help\uk.alc.xml</customization>
- </files>
-</cshproj>
--- a/symhelp/helpmodel/TestData/Source/ER5Help/epochlp.tmp Fri May 14 15:42:52 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-inputdirectory c:\aleppo\work\help\
-outputdirectory c:\epoc32\wins\c\documents\
-outputfile EPOCHlp
-sourcefile agen-hlp bomb-hlp calc-hlp comm-hlp cont-hlp data-hlp dial-hlp dict-hlp gen--hlp hard-hlp jott-hlp prog-hlp rec--hlp shet-hlp sket-hlp spel-hlp syst-hlp time-hlp word-hlp xtra-hlp
-orderfile EPOCHlp.order
-graphicsdirectory c:\aleppo\work\help\
-workingdirectory c:\aleppo\work\help\temp\
-customizationfile c:\aleppo\work\help\uk.alc
--- a/symhelp/helpmodel/TestData/Source/ER5Help/uk.alc.tmp Fri May 14 15:42:52 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE cshcust PUBLIC "/EPOC32/tools/cshlpcmp/dtd/CSHcush.dtd" "SYSTEM">
-<?xml:stylesheet href="/EPOC32/tools/cshlpcmp/xsl/CSHcust.xsl" title="CS-Help customisation" type="text/xsl"?>
-<cshcust>
-<bodystyle fontstyle="sansserif" size="10"/>
-<titlestyle fontstyle="sansserif" size="14"/>
-<listbullet1style bulletchar="149"></listbullet1style>
-<listbullet2style bulletchar="45"></listbullet2style>
-<tipeffects leftindent="36"><b>Tip:</b></tipeffects>
-<noteeffects leftindent="36"><b>Note:</b></noteeffects>
-<importanteffects leftindent="60"><b>Important:</b></importanteffects>
-</cshcust>
--- a/userguide/inc/BrowserWrapper.h Fri May 14 15:42:52 2010 +0300
+++ b/userguide/inc/BrowserWrapper.h Fri Jun 11 13:29:58 2010 +0300
@@ -35,7 +35,7 @@
void init();
public:
- void setHtml(const QString& html, const QUrl& baseUrl);
+ void setHtml(const QString& html, const QUrl& url);
void clearHistory();
bool canGoBack();
void back();
--- a/userguide/inc/HelpCommon.h Fri May 14 15:42:52 2010 +0300
+++ b/userguide/inc/HelpCommon.h Fri Jun 11 13:29:58 2010 +0300
@@ -20,6 +20,8 @@
#include <Qt>
+//const
+const int APPPRIORITY = 2001;
// words
const char* const BACKSLASH = "/";
const char* const SPECIALCHAR = "+";
@@ -92,6 +94,7 @@
enum HelpItemRole
{
UidRole = Qt::UserRole + 1,
+ PriorityRole,
HrefRole,
KeywordRole
};
--- a/userguide/inc/HelpContentsView.h Fri May 14 15:42:52 2010 +0300
+++ b/userguide/inc/HelpContentsView.h Fri Jun 11 13:29:58 2010 +0300
@@ -47,7 +47,7 @@
void openHelpContent(const QUrl& url=QUrl());
private slots: // handle system event
- void onCurrentViewChanged(HbView *view);
+ void onViewReady();
private slots: // handle button action
void onBackAction();
--- a/userguide/inc/HelpDataProvider.h Fri May 14 15:42:52 2010 +0300
+++ b/userguide/inc/HelpDataProvider.h Fri Jun 11 13:29:58 2010 +0300
@@ -42,20 +42,36 @@
private:
void createHelpCategory();
- void createBuiltInCategory(const QString& path);
- void constructAppHelp(const QString& path);
+
+ //construct 1st category
+ void constructCategory();
+ //construct help category in rom
+ void constructBuiltInCategory(const QString& path, const QStringList& uidList, const QStringList& titleList);
+ //construct help category for 3rd party application
+ void constructAppCategory(const QString& path, QStringList& uidList);
+ void constructBuiltInCategoryItem(const QString& uid, const QString& title);
+
+ //construct 2nd category
+ void constructCategory2(HelpStandardItem* itemParent);
+ void constructCategory2Item(HelpStandardItem* itemParent);
+
+ //construct keyword list
void constructKeywordModel(const QString& title, const QString& uid, const QString& href);
-// void searchInAllData(HelpStandardItem* item, const QString& key=QString());
-// void searchInResult(const QString& key=QString());
- HelpStandardItem* constructCategory2(const QString& title, const QString& uid);
- HelpStandardItem* findItemWithHref(HelpStandardItem* itemParent, const QString& href);
+
+ //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 parseAppMetaxml(const QString& path, QString& title);
private:
QStandardItemModel* mHelpModel; //category tree model
QStandardItemModel* mKeywordModel; //keyword list model
- HelpProxyModel* mSearhResultModel; //search result proxy model of keyword model
+ HelpProxyModel* mSearhResultModel; //search result proxy model of keyword model
+ HelpStandardItem* mAppItem;
QString mHelpContentRoot;
QString mLastSrhKey;
+ QStringList mUpdateUidList;
};
--- a/userguide/inc/HelpKeywordView.h Fri May 14 15:42:52 2010 +0300
+++ b/userguide/inc/HelpKeywordView.h Fri Jun 11 13:29:58 2010 +0300
@@ -53,7 +53,7 @@
void ResetSearchPanel();
private slots: // handle system event
- void onCurrentViewChanged(HbView *view);
+ void onViewReady();
private slots: // handle button action
void onBackAction();
--- a/userguide/resources/xml/baseView.docml Fri May 14 15:42:52 2010 +0300
+++ b/userguide/resources/xml/baseView.docml Fri Jun 11 13:29:58 2010 +0300
@@ -2,13 +2,13 @@
<hbdocument version="0.9">
<object name="help_config" type="QObject">
<object name="action_all" type="HbAction">
- <icon name="icon" iconName=":/images/show_all.svg" />
+ <icon name="icon" iconName="qtg_mono_help_all" />
</object>
<object name="action_find" type="HbAction">
<icon name="icon" iconName="qtg_mono_search" />
</object>
<object name="action_online_support" type="HbAction">
- <icon name="icon" iconName=":/images/link_nokia.svg" />
+ <icon name="icon" iconName="qtg_mono_online_support" />
</object>
</object>
--- a/userguide/resources/xml/toolbar.docml Fri May 14 15:42:52 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<hbdocument version="0.9">
- <object name="help_config" type="QObject">
- <object name="action_all" type="HbAction">
- <icon name="icon" iconName=":/images/show_all.svg" />
- </object>
- <object name="action_find" type="HbAction">
- <icon name="icon" iconName="qtg_mono_search" />
- </object>
- <object name="action_online_support" type="HbAction">
- <icon name="icon" iconName=":/images/link_nokia.svg" />
- </object>
- </object>
-
- <widget name="toolbar" type="HbToolBar">
- <ref object="action_all" role="HbToolBar:addAction" />
- <ref object="action_find" role="HbToolBar:addAction" />
- <ref object="action_online_support" role="HbToolBar:addAction" />
- </widget>
-
-</hbdocument>
\ No newline at end of file
--- a/userguide/rom/userguide.iby Fri May 14 15:42:52 2010 +0300
+++ b/userguide/rom/userguide.iby Fri Jun 11 13:29:58 2010 +0300
@@ -1,19 +1,19 @@
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-#
-# Description:
-# Rom exports for Help
-#
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
#ifndef __HELP_IBY__
#define __HELP_IBY__
@@ -25,8 +25,11 @@
file=ABI_DIR\BUILD_DIR\Userguide.exe SHARED_LIB_DIR\Userguide.exe
data = DATAZ_\APP_RESOURCE_DIR\Userguide.mif APP_RESOURCE_DIR\Userguide.mif
+
+
+
+
HB_UPGRADABLE_APP_REG_RSC(Userguide)
-S60_APP_RESOURCE(Userguide)
#endif
--- a/userguide/rom/userguide.pri Fri May 14 15:42:52 2010 +0300
+++ b/userguide/rom/userguide.pri Fri Jun 11 13:29:58 2010 +0300
@@ -17,13 +17,7 @@
symbian {
HELP_IBY_DIR = $$section(PWD, ":", 1)
-
- exists(/epoc32/include/platform_paths.hrh) {
- BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include <platform_paths.hrh>"
- } else {
- BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include <domain\osextensions\platform_paths.hrh>"
- }
-
+ BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include <platform_paths.hrh>"
BLD_INF_RULES.prj_exports += "$$HELP_IBY_DIR/userguide.iby CORE_APP_LAYER_IBY_EXPORT_PATH(userguide.iby)"
BLD_INF_RULES.prj_exports += "$$HELP_IBY_DIR/userguide_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(userguide_resources.iby)"
}
--- a/userguide/src/BrowserWrapper.cpp Fri May 14 15:42:52 2010 +0300
+++ b/userguide/src/BrowserWrapper.cpp Fri Jun 11 13:29:58 2010 +0300
@@ -49,13 +49,13 @@
setLayout(vLayout);
}
-void BrowserWrapper::setHtml(const QString& html, const QUrl& baseUrl)
+void BrowserWrapper::setHtml(const QString& html, const QUrl& url)
{
- mWebView->setHtml(html, baseUrl);
+ mWebView->setHtml(html, url);
- if(!mHistory.count() || mHistory.top()!=baseUrl)
+ if(!mHistory.count() || mHistory.top()!=url)
{
- mHistory.append(baseUrl);
+ mHistory.append(url);
}
}
--- a/userguide/src/HelpContentsView.cpp Fri May 14 15:42:52 2010 +0300
+++ b/userguide/src/HelpContentsView.cpp Fri Jun 11 13:29:58 2010 +0300
@@ -46,7 +46,7 @@
connect(mBrowser, SIGNAL(linkClicked(const QUrl&)), this, SLOT(onLinkClicked(const QUrl&)));
connect(mBrowser, SIGNAL(urlChanged(const QUrl&)), this, SLOT(onUrlChanged(const QUrl&)));
- connect(mainWindow(), SIGNAL(currentViewChanged(HbView*)), this, SLOT(onCurrentViewChanged(HbView*)));
+ connect(mainWindow(), SIGNAL(viewReady()), this, SLOT(onViewReady()));
}
void HelpContentsView::initDocMl()
@@ -101,18 +101,17 @@
void HelpContentsView::openHelpContent(const QUrl& url)
{
QString html;
- QString baseUrl = url.toString();
- HelpDataProvider::instance()->getHelpContentData(html, baseUrl);
- mBrowser->setHtml(html, baseUrl);
+ QString urlStr = url.toString();
+ HelpDataProvider::instance()->getHelpContentData(html, urlStr);
+ mBrowser->setHtml(html, urlStr);
}
////////////////////////////////////////////////////////////////////////////////////////////
-void HelpContentsView::onCurrentViewChanged(HbView *view)
+void HelpContentsView::onViewReady()
{
- if(this == view)
+ if(isVisible())
{
- setVisible(true);
setNavigationAction(mSoftKeyAction);
openHelpContent();
}
--- a/userguide/src/HelpDataProvider.cpp Fri May 14 15:42:52 2010 +0300
+++ b/userguide/src/HelpDataProvider.cpp Fri Jun 11 13:29:58 2010 +0300
@@ -36,6 +36,7 @@
mKeywordModel = new QStandardItemModel();
mSearhResultModel = new HelpProxyModel();
mSearhResultModel->setSourceModel(mKeywordModel);
+ mAppItem = NULL;
}
HelpDataProvider::~HelpDataProvider()
@@ -81,29 +82,13 @@
QAbstractItemModel* HelpDataProvider::getSearchData(const QString& key)
{
-/* if(key.isEmpty())
- {
- return mKeywordModel;
- }*/
-
if(key == mLastSrhKey)
{
return mSearhResultModel;
}
-/*
- if(!mLastSrhKey.isEmpty() && HelpUtils::findStr(key, mLastSrhKey) != -1)
- {
- searchInResult(key);
- }
- else
- {
- mSearhResultModel->removeRows(0, mSearhResultModel->rowCount());
- searchInAllData((HelpStandardItem*)mKeywordModel->invisibleRootItem(), key);
- }*/
mLastSrhKey = key;
mSearhResultModel->setFilterRegExp(key);
-
return mSearhResultModel;
}
@@ -146,6 +131,24 @@
void HelpDataProvider::createHelpCategory()
{
+ constructCategory();
+
+ mHelpModel->setSortRole(Qt::DisplayRole);
+
+ constructCategory2((HelpStandardItem*)mHelpModel->invisibleRootItem());
+
+ if(mAppItem)
+ {
+ mHelpModel->appendRow(mAppItem);
+ mAppItem->sortChildren(0, HelpUtils::sortOrder());
+ constructCategory2(mAppItem);
+ }
+
+ mKeywordModel->sort(0, HelpUtils::sortOrder());
+}
+
+void HelpDataProvider::constructCategory()
+{
QFileInfoList driveList = QDir::drives();
QDir dir;
QString lang = HelpUtils::UILocaleFromQtToSymbian();
@@ -154,8 +157,9 @@
path.append(XHTMLPATH);
path.append(lang);
- //construct help in rom
- createBuiltInCategory(path);
+ QStringList uidList;
+ QStringList titleList;
+ parseCategoryIndexXml(path, uidList, titleList);
//scan other root path and construct 3rd party help
foreach(QFileInfo fi, driveList)
@@ -171,13 +175,144 @@
{
continue;
}
- constructAppHelp(path);
+ constructAppCategory(path, uidList);
}
}
- mKeywordModel->sort(0, HelpUtils::sortOrder());
+
+ constructBuiltInCategory(path, uidList, titleList);
+
+ mHelpModel->setSortRole(PriorityRole);
+ mHelpModel->sort(0, HelpUtils::sortOrder());
+}
+
+void HelpDataProvider::constructBuiltInCategory(const QString& path, const QStringList& uidList, const QStringList& titleList)
+{
+// constructCategory2(title, uid);
+ if(uidList.count() != titleList.count())
+ {
+ //ToDo
+ return;
+ }
+
+ for(int i = 0; i < uidList.count(); i++)
+ {
+ if(mUpdateUidList.contains(uidList[i]))
+ {
+ continue;
+ }
+
+ QString uid(path);
+ uid.append(BACKSLASH);
+ uid.append(uidList[i]);
+
+ constructBuiltInCategoryItem(uid, titleList[i]);
+ }
}
-void HelpDataProvider::createBuiltInCategory(const QString& path)
+void HelpDataProvider::constructAppCategory(const QString& path, QStringList& uidList)
+{
+ QDir dir(path);
+ if(!dir.exists())
+ {
+ return;
+ }
+
+ QStringList uidDirList = dir.entryList();
+ QString pathUid;
+ foreach(QString uid, uidDirList)
+ {
+ pathUid.clear();
+ pathUid.append(path);
+ pathUid.append(BACKSLASH);
+ pathUid.append(uid);
+
+ QString titleStr;
+ parseAppMetaxml(pathUid, titleStr);
+ if(titleStr.isEmpty())
+ {
+ continue;
+ }
+
+ if(uidList.contains(uid))
+ {
+ mUpdateUidList.append(uid);
+ constructBuiltInCategoryItem(pathUid, titleStr);
+ continue;
+ }
+
+ HelpStandardItem* item = NULL;
+ item = new HelpStandardItem(titleStr);
+ item->setData(pathUid, UidRole);
+
+ if(!mAppItem)
+ {
+ mAppItem = new HelpStandardItem(qtTrId(TXT_APPLICATIONS));
+ mAppItem->setData(APPPRIORITY, PriorityRole);
+ }
+ mAppItem->appendRow(item);
+ }
+}
+
+void HelpDataProvider::constructBuiltInCategoryItem(const QString& uid, const QString& title)
+{
+ int featureId;
+ int priority;
+ parseBuiltInMetaxml(uid, featureId, priority);
+
+ HelpStandardItem* item = NULL;
+ item = new HelpStandardItem(title);
+ item->setData(uid, UidRole);
+
+ if(item)
+ {
+ item->setData(priority, PriorityRole);
+ mHelpModel->appendRow(item);
+ }
+}
+
+void HelpDataProvider::constructCategory2(HelpStandardItem* itemParent)
+{
+ int count = itemParent->rowCount();
+ for(int i =0; i < count; i++)
+ {
+ HelpStandardItem* item = (HelpStandardItem*)itemParent->child(i);
+ constructCategory2Item(item);
+ }
+}
+
+void HelpDataProvider::constructCategory2Item(HelpStandardItem* itemParent)
+{
+ QStringList hrefList;
+ QStringList titleList;
+
+ QString uid = itemParent->data(UidRole).toString();
+ parseCategory2IndexXml(uid, hrefList, titleList);
+
+ if(hrefList.count() == 0 || hrefList.count() != titleList.count())
+ {
+ return;
+ }
+
+ for(int i = 0; i < hrefList.count(); i++)
+ {
+ HelpStandardItem* item = new HelpStandardItem(titleList[i]);
+ item->setData(hrefList[i], HrefRole);
+ itemParent->appendRow(item);
+ constructKeywordModel(titleList[i], uid, hrefList[i]);
+ }
+
+ itemParent->sortChildren(0, HelpUtils::sortOrder());
+}
+
+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);
+}
+
+void HelpDataProvider::parseCategoryIndexXml(const QString& path, QStringList& uidList, QStringList& titleList)
{
QString pathIndex(path);
pathIndex.append(BACKSLASH);
@@ -191,204 +326,118 @@
//parse index xml to a stringlist, each string include id and navtitle and seperate by "specilchar"
QXmlQuery query;
query.bindVariable("inputdoc", &file);
- QXmlItem xmlItem(SPECIALCHAR);
- query.bindVariable("specilchar", xmlItem);
- query.setQuery("doc($inputdoc)/collections/collection/ \
- string-join((xs:string(@id), xs:string(@navtitle)), $specilchar)");
+ query.setQuery("doc($inputdoc)/collections/collection/xs:string(@id)");
if(!query.isValid())
{
return;
}
- QStringList strLst;
- if(!query.evaluateTo(&strLst))
+ if(!query.evaluateTo(&uidList))
{
return;
}
- foreach(QString str, strLst)
+ query.setQuery("doc($inputdoc)/collections/collection/xs:string(@navtitle)");
+ if(!query.isValid())
{
- QStringList temp;
- temp = str.split(SPECIALCHAR);
- QString uid(path);
- uid.append(BACKSLASH);
- uid.append(temp[0]);
- HelpStandardItem* item = constructCategory2(temp[1], uid);
- if(item)
- {
- mHelpModel->appendRow(item);
- }
+ return;
}
- file.close();
- mHelpModel->sort(0, HelpUtils::sortOrder());
+ if(!query.evaluateTo(&titleList))
+ {
+ return;
+ }
}
-HelpStandardItem* HelpDataProvider::constructCategory2(const QString& title, const QString& uid)
+void HelpDataProvider::parseCategory2IndexXml(const QString& path, QStringList& hrefList, QStringList& titleList)
{
- QString pathIndex(uid);
+ QString pathIndex(path);
pathIndex.append(BACKSLASH);
pathIndex.append(INDEXXML);
QFile file(pathIndex);
if (!file.open(QIODevice::ReadOnly)) {
- return NULL;
+ return;
}
//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.bindVariable("specilchar", xmlItem);
- query.setQuery("doc($inputdoc)/topics/topicref/ \
- string-join((xs:string(@href), xs:string(@navtitle)), $specilchar)");
+
+ query.setQuery("doc($inputdoc)/topics/topicref/xs:string(@href)");
+ if(!query.isValid())
+ {
+ return;
+ }
+ if(!query.evaluateTo(&hrefList))
+ {
+ return;
+ }
+
+ query.setQuery("doc($inputdoc)/topics/topicref/xs:string(@navtitle)");
if(!query.isValid())
{
- return NULL;
- }
-
- QStringList strLst;
- if(!query.evaluateTo(&strLst))
- {
- return NULL;
- }
- if(strLst.count() <= 0)
- {
- return NULL;
+ return;
}
-
- HelpStandardItem* itemParent = NULL;
- itemParent = new HelpStandardItem(title);
- itemParent->setData(uid, UidRole);
- foreach(QString str, strLst)
+ if(!query.evaluateTo(&titleList))
{
- QStringList temp;
- temp = str.split(SPECIALCHAR);
- HelpStandardItem* item = new HelpStandardItem(temp[1]);
- item->setData(temp[0], HrefRole);
- itemParent->appendRow(item);
- constructKeywordModel(temp[1], uid, temp[0]);
+ return;
}
-
- file.close();
- itemParent->sortChildren(0, HelpUtils::sortOrder());
- return itemParent;
}
-void HelpDataProvider::constructAppHelp(const QString& path)
+void HelpDataProvider::parseBuiltInMetaxml(const QString& path, int& featureId, int& priority)
{
- QDir dir(path);
- if(!dir.exists())
+ QString pathMetaxml(path);
+ pathMetaxml.append(BACKSLASH);
+ pathMetaxml.append(METAXML);
+
+ featureId = -1;
+ priority = -1;
+
+ QFile file(pathMetaxml);
+ if (!file.open(QIODevice::ReadOnly))
{
return;
}
- QStringList uidList = dir.entryList();
- HelpStandardItem* itemApp = NULL;
- QString pathTemp;
- foreach(QString uid, uidList)
- {
- pathTemp.clear();
- pathTemp.append(path);
- pathTemp.append(BACKSLASH);
- pathTemp.append(uid);
- pathTemp.append(BACKSLASH);
- pathTemp.append(METAXML);
- QFile file(pathTemp);
- if (!file.open(QIODevice::ReadOnly)) {
- continue;
- }
+ QXmlQuery query;
+ QString str;
+ query.bindVariable("inputdoc", &file);
- //parse meta xml, get the title string
- QXmlQuery query;
- query.bindVariable("inputdoc", &file);
- query.setQuery("doc($inputdoc)/meta/string(title)");
- if(!query.isValid())
- {
- continue;
- }
- QString titleStr;
- if(!query.evaluateTo(&titleStr))
- {
- continue;
- }
-
- pathTemp.clear();
- pathTemp.append(path);
- pathTemp.append(BACKSLASH);
- pathTemp.append(uid);
- HelpStandardItem* item = constructCategory2(titleStr, pathTemp);
- if(item)
- {
- if(!itemApp)
- {
- itemApp = new HelpStandardItem(qtTrId(TXT_APPLICATIONS));
- }
- itemApp->appendRow(item);
- }
- file.close();
+ query.setQuery("doc($inputdoc)/meta/title/number(@FeatureId)");
+ if(query.isValid() && query.evaluateTo(&str))
+ {
+ featureId = str.toInt();
}
- if(itemApp)
+ query.setQuery("doc($inputdoc)/meta/number(priority)");
+ if(query.isValid() && query.evaluateTo(&str))
{
- itemApp->sortChildren(0, HelpUtils::sortOrder());
- mHelpModel->appendRow(itemApp);
+ priority = str.toInt();
}
}
-/*
-void HelpDataProvider::searchInAllData(HelpStandardItem* item, const QString& key)
+void HelpDataProvider::parseAppMetaxml(const QString& path, QString& title)
{
- if(item->rowCount() > 0)
- {
- for(int i = 0; i < item->rowCount(); i++)
- {
- searchInAllData((HelpStandardItem*)item->child(i),key);
- }
+ QString pathMetaxml(path);
+ pathMetaxml.append(BACKSLASH);
+ pathMetaxml.append(METAXML);
+ QFile file(pathMetaxml);
+ if (!file.open(QIODevice::ReadOnly)) {
+ return;
}
- else
+
+ //parse meta xml, get the title string
+ QXmlQuery query;
+ query.bindVariable("inputdoc", &file);
+ query.setQuery("doc($inputdoc)/meta/string(title)");
+ if(!query.isValid())
{
- if(HelpUtils::findStr(item->text(), key) != -1)
- {
- HelpStandardItem* itemSearch = new HelpStandardItem(item->text());
- itemSearch->setData(item->data(UidRole), UidRole);
- itemSearch->setData(item->data(HrefRole), HrefRole);
- mSearhResultModel->appendRow(itemSearch);
- }
+ return;
+ }
+
+ if(!query.evaluateTo(&title))
+ {
+ return;
}
}
-
-void HelpDataProvider::searchInResult(const QString& key)
-{
- for(int i = 0; i < mSearhResultModel->rowCount();)
- {
- QStandardItem* item = mSearhResultModel->item(i);
- if(HelpUtils::findStr(item->text(), key) == -1)
- {
- mSearhResultModel->removeRow(i);
- }
- else
- {
- i++;
- }
- }
-}
-*/
-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* HelpDataProvider::findItemWithHref(HelpStandardItem* itemParent, const QString& href)
-{
- for(int i = 0; i < itemParent->rowCount(); i++)
- {
- if(QString::compare(itemParent->child(i)->data(HrefRole).toString(), href, Qt::CaseInsensitive) == 0)
- {
- return (HelpStandardItem *)(itemParent->child(i));
- }
- }
- return NULL;
-}
--- a/userguide/src/HelpKeywordView.cpp Fri May 14 15:42:52 2010 +0300
+++ b/userguide/src/HelpKeywordView.cpp Fri Jun 11 13:29:58 2010 +0300
@@ -63,7 +63,7 @@
initVirtualKeyboard();
initEmptyLabel();
- connect(mainWindow(), SIGNAL(currentViewChanged(HbView*)), this, SLOT(onCurrentViewChanged(HbView*)));
+ connect(mainWindow(), SIGNAL(viewReady()), this, SLOT(onViewReady()));
}
void HelpKeywordView::initDocMl()
@@ -143,6 +143,7 @@
if(lineEdit != NULL)
{
lineEdit->setText("");
+ lineEdit->setFocus();
break;
}
}
@@ -152,11 +153,10 @@
////////////////////////////////////////////////////////////////////////////////////////////
// handle system event
-void HelpKeywordView::onCurrentViewChanged(HbView *view)
+void HelpKeywordView::onViewReady()
{
- if(this == view)
- {
- setVisible(true);
+ if(isVisible())
+ {
setNavigationAction(mSoftKeyAction);
}
}