# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1276252198 -10800 # Node ID 99b096216bc8685ead0facdfc850d7ffd1a29c22 # Parent 3752719124563d43b538d7e0e2596ab71c130683 Revision: 201021 Kit: 2010123 diff -r 375271912456 -r 99b096216bc8 helps_info/helps_metadata/helps_metadata.mrp --- 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 diff -r 375271912456 -r 99b096216bc8 layers.sysdef.xml --- 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 @@ + + + diff -r 375271912456 -r 99b096216bc8 package_definition.xml --- 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 @@ - - - - - - - - - - - - - - - - - - - - - - - diff -r 375271912456 -r 99b096216bc8 symhelp/helpmodel/TestData/Source/ER5Help/epochlp.alp.tmp --- 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 @@ - - - - - 0x10006000 - - \work\help\ - \epoc32\wins\c\system\help\ - \work\help\ - \work\help\temp\ - - - - agen-hlp.rtf - bomb-hlp.rtf - calc-hlp.rtf - comm-hlp.rtf - cont-hlp.rtf - data-hlp.rtf - dial-hlp.rtf - dict-hlp.rtf - gen--hlp.rtf - hard-hlp.rtf - jott-hlp.rtf - prog-hlp.rtf - rec--hlp.rtf - shet-hlp.rtf - sket-hlp.rtf - spel-hlp.rtf - syst-hlp.rtf - time-hlp.rtf - word-hlp.rtf - xtra-hlp.rtf - - EPOCHlp - \work\help\uk.alc.xml - - diff -r 375271912456 -r 99b096216bc8 symhelp/helpmodel/TestData/Source/ER5Help/epochlp.alp.xml.bak --- 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 @@ - - - - - 0x10006000 - - H:\aleppo\work\help\ - H:\epoc32\wins\c\system\help\ - H:\aleppo\work\help\ - H:\aleppo\work\help\temp\ - - - - sket-hlp.rtf - - EPOCHlp - H:\aleppo\work\help\uk.alc.xml - - diff -r 375271912456 -r 99b096216bc8 symhelp/helpmodel/TestData/Source/ER5Help/epochlp.tmp --- 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 diff -r 375271912456 -r 99b096216bc8 symhelp/helpmodel/TestData/Source/ER5Help/uk.alc.tmp --- 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 @@ - - - - - - - - -Tip: -Note: -Important: - diff -r 375271912456 -r 99b096216bc8 userguide/inc/BrowserWrapper.h --- 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(); diff -r 375271912456 -r 99b096216bc8 userguide/inc/HelpCommon.h --- 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 +//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 }; diff -r 375271912456 -r 99b096216bc8 userguide/inc/HelpContentsView.h --- 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(); diff -r 375271912456 -r 99b096216bc8 userguide/inc/HelpDataProvider.h --- 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; }; diff -r 375271912456 -r 99b096216bc8 userguide/inc/HelpKeywordView.h --- 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(); diff -r 375271912456 -r 99b096216bc8 userguide/resources/xml/baseView.docml --- 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 @@ - + - + diff -r 375271912456 -r 99b096216bc8 userguide/resources/xml/toolbar.docml --- 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 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -r 375271912456 -r 99b096216bc8 userguide/rom/userguide.iby --- 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 diff -r 375271912456 -r 99b096216bc8 userguide/rom/userguide.pri --- 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 " - } else { - BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include " - } - + BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include " 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)" } diff -r 375271912456 -r 99b096216bc8 userguide/src/BrowserWrapper.cpp --- 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); } } diff -r 375271912456 -r 99b096216bc8 userguide/src/HelpContentsView.cpp --- 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(); } diff -r 375271912456 -r 99b096216bc8 userguide/src/HelpDataProvider.cpp --- 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; -} diff -r 375271912456 -r 99b096216bc8 userguide/src/HelpKeywordView.cpp --- 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); } }