# HG changeset patch # User William Roberts # Date 1279812658 -3600 # Node ID 3ae60d69bf222caf1c819876925251551b1e7932 # Parent e70b37c1a9d5efe28f399489ad64a5a909c9511f# Parent 4533d75b8d4e5b3e8ed45d48cd7d486012ba74f1 Catchup to latest Symbian^4 diff -r e70b37c1a9d5 -r 3ae60d69bf22 helps_info/helps_metadata/helps_metadata.mrp --- a/helps_info/helps_metadata/helps_metadata.mrp Fri Jun 11 16:23:42 2010 +0100 +++ /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 e70b37c1a9d5 -r 3ae60d69bf22 layers.sysdef.xml --- a/layers.sysdef.xml Fri Jun 11 16:23:42 2010 +0100 +++ b/layers.sysdef.xml Thu Jul 22 16:30:58 2010 +0100 @@ -9,6 +9,9 @@ + + + diff -r e70b37c1a9d5 -r 3ae60d69bf22 package_definition.xml --- a/package_definition.xml Fri Jun 11 16:23:42 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff -r e70b37c1a9d5 -r 3ae60d69bf22 symhelp/helpmodel/TestData/Source/ER5Help/epochlp.alp.tmp --- a/symhelp/helpmodel/TestData/Source/ER5Help/epochlp.alp.tmp Fri Jun 11 16:23:42 2010 +0100 +++ /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 e70b37c1a9d5 -r 3ae60d69bf22 symhelp/helpmodel/TestData/Source/ER5Help/epochlp.alp.xml.bak --- a/symhelp/helpmodel/TestData/Source/ER5Help/epochlp.alp.xml.bak Fri Jun 11 16:23:42 2010 +0100 +++ /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 e70b37c1a9d5 -r 3ae60d69bf22 symhelp/helpmodel/TestData/Source/ER5Help/epochlp.tmp --- a/symhelp/helpmodel/TestData/Source/ER5Help/epochlp.tmp Fri Jun 11 16:23:42 2010 +0100 +++ /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 e70b37c1a9d5 -r 3ae60d69bf22 symhelp/helpmodel/TestData/Source/ER5Help/uk.alc.tmp --- a/symhelp/helpmodel/TestData/Source/ER5Help/uk.alc.tmp Fri Jun 11 16:23:42 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ - - - - - - - - -Tip: -Note: -Important: - diff -r e70b37c1a9d5 -r 3ae60d69bf22 userguide/Userguide.pro --- a/userguide/Userguide.pro Fri Jun 11 16:23:42 2010 +0100 +++ b/userguide/Userguide.pro Thu Jul 22 16:30:58 2010 +0100 @@ -58,11 +58,13 @@ TARGET.CAPABILITY = CAP_APPLICATION TARGET.EPOCHEAPSIZE = 0x020000 0x1000000 - LIBS += -lezip -lxqservice -lxqserviceutil + CONFIG += mobility + MOBILITY = systeminfo + LIBS += -lezip -lxqservice -lxqserviceutil -lcone -leikcore -lmediaclientaudio -leikcoctl -leiksrv -lapparc -lavkon -lefsrv -lcharconv -lws32 -lhal -lgdi -lapgrfx include(rom/userguide.pri) + SKINICON = qtg_large_help } - -ICON = resources/qtg_large_help.svg + RESOURCES += resources/Userguide.qrc debug: DESTDIR = ./debug diff -r e70b37c1a9d5 -r 3ae60d69bf22 userguide/inc/BrowserWrapper.h --- a/userguide/inc/BrowserWrapper.h Fri Jun 11 16:23:42 2010 +0100 +++ b/userguide/inc/BrowserWrapper.h Thu Jul 22 16:30:58 2010 +0100 @@ -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 e70b37c1a9d5 -r 3ae60d69bf22 userguide/inc/HelpBaseView.h --- a/userguide/inc/HelpBaseView.h Fri Jun 11 16:23:42 2010 +0100 +++ b/userguide/inc/HelpBaseView.h Thu Jul 22 16:30:58 2010 +0100 @@ -45,18 +45,12 @@ void onToolbarFind() { emit showFindList(); }; void onToolbarOnlineSupport(); -private slots: - void onOrientationChanged(Qt::Orientation orientation); - protected: void initBaseDocMl(); protected: HelpUIBuilder mBuilder; HbToolBar* mToolBar; - -private: - void RefreshToolbarText(Qt::Orientation orientation); }; #endif //HELPBATHVIEW_H diff -r e70b37c1a9d5 -r 3ae60d69bf22 userguide/inc/HelpCommon.h --- a/userguide/inc/HelpCommon.h Fri Jun 11 16:23:42 2010 +0100 +++ b/userguide/inc/HelpCommon.h Thu Jul 22 16:30:58 2010 +0100 @@ -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 e70b37c1a9d5 -r 3ae60d69bf22 userguide/inc/HelpContentsView.h --- a/userguide/inc/HelpContentsView.h Fri Jun 11 16:23:42 2010 +0100 +++ b/userguide/inc/HelpContentsView.h Thu Jul 22 16:30:58 2010 +0100 @@ -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 e70b37c1a9d5 -r 3ae60d69bf22 userguide/inc/HelpDataProvider.h --- a/userguide/inc/HelpDataProvider.h Fri Jun 11 16:23:42 2010 +0100 +++ b/userguide/inc/HelpDataProvider.h Thu Jul 22 16:30:58 2010 +0100 @@ -35,27 +35,42 @@ static void destroyInstance(); public: + void createHelpCategory(); QAbstractItemModel* getCategoryData(); QAbstractItemModel* getSearchData(const QString& key=QString()); void setHelpContentUrl(const QString& uid, const QString& href); void getHelpContentData(QString& content, QString& url); 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& 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 e70b37c1a9d5 -r 3ae60d69bf22 userguide/inc/HelpKeywordView.h --- a/userguide/inc/HelpKeywordView.h Fri Jun 11 16:23:42 2010 +0100 +++ b/userguide/inc/HelpKeywordView.h Thu Jul 22 16:30:58 2010 +0100 @@ -25,7 +25,7 @@ class HbListView; class HbSearchPanel; class HbStaticVkbHost; -class HbGroupBox; +class HbLabel; class HelpKeywordView : public HelpBaseView { @@ -42,18 +42,22 @@ void initSearchList(); void initSearchPanel(); void initBackAction(); - void initEmptyLabel(); void initVirtualKeyboard(); - + private: - HbGroupBox* groupBox(); + HbLabel* label(); private: void updateVisibleItems(bool visible); void ResetSearchPanel(); + void updateLabelPos(); + void showToolBar(bool visible); + +private slots: + void onOrientationChanged(Qt::Orientation orientation); private slots: // handle system event - void onCurrentViewChanged(HbView *view); + void onViewReady(); private slots: // handle button action void onBackAction(); diff -r e70b37c1a9d5 -r 3ae60d69bf22 userguide/inc/HelpMainWindow.h --- a/userguide/inc/HelpMainWindow.h Fri Jun 11 16:23:42 2010 +0100 +++ b/userguide/inc/HelpMainWindow.h Thu Jul 22 16:30:58 2010 +0100 @@ -38,6 +38,7 @@ private slots: void onActivateView(HelpViewName viewName); + void saveActivity(); private: // activate views void activateCategoryView(); diff -r e70b37c1a9d5 -r 3ae60d69bf22 userguide/inc/HelpUtils.h --- a/userguide/inc/HelpUtils.h Fri Jun 11 16:23:42 2010 +0100 +++ b/userguide/inc/HelpUtils.h Thu Jul 22 16:30:58 2010 +0100 @@ -25,6 +25,7 @@ public: static void loadHtmlFromZipFile(const QString& path, const QString& htmlFile, QString& htmlContent); static int launchApplication(const QString& appUid); + static bool suppportFeatureID(int featureID); static QString rootPath(); static QString UILocaleFromQtToSymbian(); static Qt::Orientation defaultOrientation(); diff -r e70b37c1a9d5 -r 3ae60d69bf22 userguide/resources/Userguide.qrc --- a/userguide/resources/Userguide.qrc Fri Jun 11 16:23:42 2010 +0100 +++ b/userguide/resources/Userguide.qrc Thu Jul 22 16:30:58 2010 +0100 @@ -6,10 +6,4 @@ xml/contentsView.docml xml/baseView.docml - - - images/qtg_mono_show_all.svg - images/qtg_mono_link_nokia.svg - - \ No newline at end of file diff -r e70b37c1a9d5 -r 3ae60d69bf22 userguide/resources/qtg_large_help.svg --- a/userguide/resources/qtg_large_help.svg Fri Jun 11 16:23:42 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r e70b37c1a9d5 -r 3ae60d69bf22 userguide/resources/xml/baseView.docml --- a/userguide/resources/xml/baseView.docml Fri Jun 11 16:23:42 2010 +0100 +++ b/userguide/resources/xml/baseView.docml Thu Jul 22 16:30:58 2010 +0100 @@ -2,13 +2,13 @@ - + - + diff -r e70b37c1a9d5 -r 3ae60d69bf22 userguide/resources/xml/keywordView.docml --- a/userguide/resources/xml/keywordView.docml Fri Jun 11 16:23:42 2010 +0100 +++ b/userguide/resources/xml/keywordView.docml Thu Jul 22 16:30:58 2010 +0100 @@ -1,126 +1,99 @@ - - + - - - - - - - - - - + + + - + + + + + + + + + + + -
- - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + +
-
- - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + +
-
- - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + +
-
- - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + +
- + + + + + + + +
diff -r e70b37c1a9d5 -r 3ae60d69bf22 userguide/resources/xml/toolbar.docml --- a/userguide/resources/xml/toolbar.docml Fri Jun 11 16:23:42 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -r e70b37c1a9d5 -r 3ae60d69bf22 userguide/rom/userguide.iby --- a/userguide/rom/userguide.iby Fri Jun 11 16:23:42 2010 +0100 +++ b/userguide/rom/userguide.iby Thu Jul 22 16:30:58 2010 +0100 @@ -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 e70b37c1a9d5 -r 3ae60d69bf22 userguide/rom/userguide.pri --- a/userguide/rom/userguide.pri Fri Jun 11 16:23:42 2010 +0100 +++ b/userguide/rom/userguide.pri Thu Jul 22 16:30:58 2010 +0100 @@ -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 e70b37c1a9d5 -r 3ae60d69bf22 userguide/src/BrowserWrapper.cpp --- a/userguide/src/BrowserWrapper.cpp Fri Jun 11 16:23:42 2010 +0100 +++ b/userguide/src/BrowserWrapper.cpp Thu Jul 22 16:30:58 2010 +0100 @@ -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 e70b37c1a9d5 -r 3ae60d69bf22 userguide/src/HelpBaseView.cpp --- a/userguide/src/HelpBaseView.cpp Fri Jun 11 16:23:42 2010 +0100 +++ b/userguide/src/HelpBaseView.cpp Thu Jul 22 16:30:58 2010 +0100 @@ -57,22 +57,5 @@ notificationDialog->show(); } -void HelpBaseView::onOrientationChanged(Qt::Orientation orientation) -{ - RefreshToolbarText(orientation); -} - -void HelpBaseView::RefreshToolbarText(Qt::Orientation orientation) -{ - bool isLandscape = (Qt::Horizontal==orientation); - HbAction* tollbarAction = mBuilder.findObject(DOCML_ACTION_ALL); - tollbarAction->setText(isLandscape ? qtTrId(TXT_BUTTON_ALL) : QString()); - - tollbarAction = mBuilder.findObject(DOCML_ACTION_SEARCH); - tollbarAction->setText(isLandscape ? qtTrId(TXT_BUTTON_FIND) : QString()); - - tollbarAction = mBuilder.findObject(DOCML_ACTION_LINK_NOKIA); - tollbarAction->setText(isLandscape ? qtTrId(TXT_BUTTON_LINK_SUPPORT) : QString()); -} // end of file diff -r e70b37c1a9d5 -r 3ae60d69bf22 userguide/src/HelpCategoryView.cpp --- a/userguide/src/HelpCategoryView.cpp Fri Jun 11 16:23:42 2010 +0100 +++ b/userguide/src/HelpCategoryView.cpp Thu Jul 22 16:30:58 2010 +0100 @@ -25,6 +25,7 @@ #include #include #include +#include #include "HelpDataProvider.h" diff -r e70b37c1a9d5 -r 3ae60d69bf22 userguide/src/HelpContentsView.cpp --- a/userguide/src/HelpContentsView.cpp Fri Jun 11 16:23:42 2010 +0100 +++ b/userguide/src/HelpContentsView.cpp Thu Jul 22 16:30:58 2010 +0100 @@ -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 e70b37c1a9d5 -r 3ae60d69bf22 userguide/src/HelpDataProvider.cpp --- a/userguide/src/HelpDataProvider.cpp Fri Jun 11 16:23:42 2010 +0100 +++ b/userguide/src/HelpDataProvider.cpp Thu Jul 22 16:30:58 2010 +0100 @@ -36,6 +36,7 @@ mKeywordModel = new QStandardItemModel(); mSearhResultModel = new HelpProxyModel(); mSearhResultModel->setSourceModel(mKeywordModel); + mAppItem = NULL; } HelpDataProvider::~HelpDataProvider() @@ -71,35 +72,15 @@ QAbstractItemModel* HelpDataProvider::getCategoryData() { - if(!mHelpModel->rowCount()) - { - createHelpCategory(); - } - return mHelpModel; } 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); @@ -146,6 +127,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 +153,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 +171,142 @@ { 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) +{ + 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 priority; + parseBuiltInMetaxml(uid, 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 +320,164 @@ //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; + } + + query.setQuery("doc($inputdoc)/collections/collection/xs:string(@navtitle)"); + if(!query.isValid()) + { + return; + } + if(!query.evaluateTo(&titleList)) { return; } - foreach(QString str, strLst) + QStringList featureIdLst; + + query.setQuery("doc($inputdoc)/collections/collection/number(@FeatureId)"); + if(!query.isValid()) + { + return; + } + if(!query.evaluateTo(&featureIdLst)) { - QStringList temp; - temp = str.split(SPECIALCHAR); - QString uid(path); - uid.append(BACKSLASH); - uid.append(temp[0]); - HelpStandardItem* item = constructCategory2(temp[1], uid); - if(item) + 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)) { - mHelpModel->appendRow(item); + uidList.removeAt(i); + titleList.removeAt(i); } } - file.close(); - mHelpModel->sort(0, HelpUtils::sortOrder()); } -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 NULL; + return; } - - QStringList strLst; - if(!query.evaluateTo(&strLst)) + if(!query.evaluateTo(&hrefList)) { - return NULL; + return; } - if(strLst.count() <= 0) + + query.setQuery("doc($inputdoc)/topics/topicref/xs:string(@navtitle)"); + if(!query.isValid()) { - return NULL; + return; + } + if(!query.evaluateTo(&titleList)) + { + return; } - HelpStandardItem* itemParent = NULL; - itemParent = new HelpStandardItem(title); - itemParent->setData(uid, UidRole); - foreach(QString str, strLst) + QStringList featureIdLst; + + query.setQuery("doc($inputdoc)/topics/topicref/number(@FeatureId)"); + if(!query.isValid()) { - 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; + } + if(!query.evaluateTo(&featureIdLst)) + { + return; } - file.close(); - itemParent->sortChildren(0, HelpUtils::sortOrder()); - return itemParent; -} - -void HelpDataProvider::constructAppHelp(const QString& path) -{ - QDir dir(path); - if(!dir.exists()) + if(featureIdLst.count() != hrefList.count()) { return; } - QStringList uidList = dir.entryList(); - HelpStandardItem* itemApp = NULL; - QString pathTemp; - foreach(QString uid, uidList) + for(int i = featureIdLst.count() - 1; i >= 0; i--) { - 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; - } - - //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)) + int featureID = featureIdLst.at(i).toInt(); + if(!HelpUtils::suppportFeatureID(featureID)) { - 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(); - } - - if(itemApp) - { - itemApp->sortChildren(0, HelpUtils::sortOrder()); - mHelpModel->appendRow(itemApp); - } -} - -/* -void HelpDataProvider::searchInAllData(HelpStandardItem* item, const QString& key) -{ - if(item->rowCount() > 0) - { - for(int i = 0; i < item->rowCount(); i++) - { - searchInAllData((HelpStandardItem*)item->child(i),key); - } - } - else - { - 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); + hrefList.removeAt(i); + titleList.removeAt(i); } } } -void HelpDataProvider::searchInResult(const QString& key) +void HelpDataProvider::parseBuiltInMetaxml(const QString& path, int& priority) { - for(int i = 0; i < mSearhResultModel->rowCount();) + QString pathMetaxml(path); + pathMetaxml.append(BACKSLASH); + pathMetaxml.append(METAXML); + + priority = -1; + + QFile file(pathMetaxml); + if (!file.open(QIODevice::ReadOnly)) { - QStandardItem* item = mSearhResultModel->item(i); - if(HelpUtils::findStr(item->text(), key) == -1) - { - mSearhResultModel->removeRow(i); - } - else - { - i++; - } + return; + } + + QXmlQuery query; + QString str; + query.bindVariable("inputdoc", &file); + + query.setQuery("doc($inputdoc)/meta/number(priority)"); + if(query.isValid() && query.evaluateTo(&str)) + { + priority = str.toInt(); } } -*/ -void HelpDataProvider::constructKeywordModel(const QString& title, const QString& uid, const QString& href) + +void HelpDataProvider::parseAppMetaxml(const QString& path, QString& title) { - HelpStandardItem* itemTemp = new HelpStandardItem(title); - itemTemp->setData(uid, UidRole); - itemTemp->setData(href, HrefRole); - mKeywordModel->appendRow(itemTemp); -} + QString pathMetaxml(path); + pathMetaxml.append(BACKSLASH); + pathMetaxml.append(METAXML); + QFile file(pathMetaxml); + if (!file.open(QIODevice::ReadOnly)) { + return; + } -HelpStandardItem* HelpDataProvider::findItemWithHref(HelpStandardItem* itemParent, const QString& href) -{ - for(int i = 0; i < itemParent->rowCount(); i++) + //parse meta xml, get the title string + QXmlQuery query; + query.bindVariable("inputdoc", &file); + query.setQuery("doc($inputdoc)/meta/string(title)"); + if(!query.isValid()) { - if(QString::compare(itemParent->child(i)->data(HrefRole).toString(), href, Qt::CaseInsensitive) == 0) - { - return (HelpStandardItem *)(itemParent->child(i)); - } + return; } - return NULL; + + if(!query.evaluateTo(&title)) + { + return; + } } diff -r e70b37c1a9d5 -r 3ae60d69bf22 userguide/src/HelpKeywordView.cpp --- a/userguide/src/HelpKeywordView.cpp Fri Jun 11 16:23:42 2010 +0100 +++ b/userguide/src/HelpKeywordView.cpp Thu Jul 22 16:30:58 2010 +0100 @@ -31,7 +31,6 @@ #include #include #include -#include #include "HelpDataProvider.h" #include "HelpProxyModel.h" @@ -61,9 +60,8 @@ initSearchList(); initSearchPanel(); initVirtualKeyboard(); - initEmptyLabel(); - connect(mainWindow(), SIGNAL(currentViewChanged(HbView*)), this, SLOT(onCurrentViewChanged(HbView*))); + connect(mainWindow(), SIGNAL(viewReady()), this, SLOT(onViewReady())); } void HelpKeywordView::initDocMl() @@ -99,22 +97,17 @@ connect(mVirtualKeyboard, SIGNAL(keypadClosed()), this, SLOT(onHandleKeypadClose())); } -void HelpKeywordView::initEmptyLabel() +HbLabel* HelpKeywordView::label() { - HbLabel* label = mBuilder.findWidget(DOCML_NO_MATCH_LABEL); - label->setFontSpec(HbFontSpec(HbFontSpec::Primary)); + return mBuilder.findWidget(DOCML_NO_MATCH_LABEL); } void HelpKeywordView::loadAllContent() { + showToolBar(false); mBuilder.load(QRC_DOCML_KEYWORD, DOCML_LAYOUT_SEARCH); ResetSearchPanel(); - toolBar()->hide(); -} - -HbGroupBox* HelpKeywordView::groupBox() -{ - return mBuilder.findWidget(DOCML_GROUPBOX); + } //////////////////////////////////////////////////////////////////////////////////////////// @@ -143,20 +136,62 @@ if(lineEdit != NULL) { lineEdit->setText(""); + lineEdit->setFocus(); break; } } } } +void HelpKeywordView::updateLabelPos() +{ + HbDeviceProfile profile = HbDeviceProfile::profile(mainWindow()); + qreal unValue = profile.unitValue(); + if(mainWindow()->orientation() == Qt::Vertical) + { + if(mVirtualKeyboard->keypadStatus() == HbVkbHost::HbVkbStatusClosed) + { + label()->setContentsMargins(0,30 * unValue,0,0); + } + else + { + label()->setContentsMargins(0,10 * unValue,0,0); + } + } + else + { + if(mVirtualKeyboard->keypadStatus() == HbVkbHost::HbVkbStatusClosed) + { + label()->setContentsMargins(0,10 * unValue,0,0); + } + else + { + label()->setContentsMargins(0,0,0,0); + label()->setAlignment(label()->alignment() | Qt::AlignVCenter); + } + } +} + +void HelpKeywordView::showToolBar(bool visible) +{ + Hb::SceneItems items = Hb::ToolBarItem; + if(visible) + { + showItems(items); + } + else + { + hideItems(items); + } +} + //////////////////////////////////////////////////////////////////////////////////////////// // handle system event -void HelpKeywordView::onCurrentViewChanged(HbView *view) +void HelpKeywordView::onViewReady() { - if(this == view) - { - setVisible(true); + if(isVisible()) + { setNavigationAction(mSoftKeyAction); } } @@ -201,7 +236,7 @@ { mBuilder.load(QRC_DOCML_KEYWORD, DOCML_LAYOUT_SEARCH_NO_SRHPAL); } - toolBar()->show(); + showToolBar(true); } void HelpKeywordView::onSearchPanelCriteriaChanged(const QString &criteria) @@ -215,20 +250,7 @@ { mBuilder.load(QRC_DOCML_KEYWORD, DOCML_LAYOUT_SEARCH); } - - toolBar()->hide(); - - if(criteria.isEmpty()) - { - groupBox()->setHeading(hbTrId(TXT_SETLABEL_SEARCH)); - } - else - { - QString heading = qtTrId(TXT_SETLABEL_SEARCH_RESULTS); - heading.append(COLON); - heading.append(criteria); - groupBox()->setHeading(heading); - } + showToolBar(false); } //////////////////////////////////////////////////////////////////////////////////////////// @@ -239,6 +261,7 @@ updateVisibleItems(false); qreal heightToSet = mainWindow()->layoutRect().height() - mVirtualKeyboard->keyboardArea().height(); this->setMaximumHeight(heightToSet); + updateLabelPos(); } void HelpKeywordView::onHandleKeypadClose() @@ -246,8 +269,15 @@ updateVisibleItems(true); qreal mainHeight = mainWindow()->layoutRect().height(); qreal toolbarHeight = toolBar()->size().height(); - qreal height = mainHeight - (toolBar()->isVisible() ? toolbarHeight : 0); + qreal height = mainHeight - ( toolBar()->isVisible() ? toolbarHeight : 0); this->setMaximumHeight(height); + updateLabelPos(); +} + +void HelpKeywordView::onOrientationChanged(Qt::Orientation orientation) +{ + Q_UNUSED(orientation); + updateLabelPos(); } // end of file diff -r e70b37c1a9d5 -r 3ae60d69bf22 userguide/src/HelpMainWindow.cpp --- a/userguide/src/HelpMainWindow.cpp Fri Jun 11 16:23:42 2010 +0100 +++ b/userguide/src/HelpMainWindow.cpp Thu Jul 22 16:30:58 2010 +0100 @@ -18,6 +18,8 @@ #include #include #include +#include +#include #include "HelpBaseView.h" #include "HelpCategoryView.h" @@ -32,6 +34,8 @@ mKeywordView(NULL), mContentsView(NULL) { + QObject::connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(saveActivity())); + HelpDataProvider::instance()->createHelpCategory(); activateCategoryView(); } @@ -59,6 +63,7 @@ } break; default: + HbApplication::exit(); break; } } @@ -129,5 +134,32 @@ mKeywordView->loadAllContent(); } +void HelpMainWindow::saveActivity() +{ + HbActivityManager* activityManager = qobject_cast(qApp)->activityManager(); + + // clean up any previous versions of this activity from the activity manager. + bool ok = activityManager->removeActivity("UserGuideMainView"); + if ( !ok ) + { + //qFatal("Remove failed" ); + } + + // get a screenshot for saving to the activity manager + QVariantHash metadata; + metadata.insert("screenshot", QPixmap::grabWidget(this, rect())); + + // save any data necessary to save the state + QByteArray serializedActivity; + QDataStream stream(&serializedActivity, QIODevice::WriteOnly | QIODevice::Append); + + // add the activity to the activity manager + ok = activityManager->addActivity("UserGuideMainView", serializedActivity, metadata); + if ( !ok ) + { + qFatal("Add failed" ); + } +} + // end of file diff -r e70b37c1a9d5 -r 3ae60d69bf22 userguide/src/HelpUtils.cpp --- a/userguide/src/HelpUtils.cpp Fri Jun 11 16:23:42 2010 +0100 +++ b/userguide/src/HelpUtils.cpp Thu Jul 22 16:30:58 2010 +0100 @@ -28,8 +28,10 @@ #ifdef Q_OS_SYMBIAN +#include +#include + #include -#include #include #include @@ -249,6 +251,21 @@ return 0; } +bool HelpUtils::suppportFeatureID(int featureID) +{ +#ifdef Q_OS_SYMBIAN + if(featureID == -1) + { + return true; + } + QtMobility::QSystemInfo sysInfo; + return sysInfo.hasFeatureSupported((QtMobility::QSystemInfo::Feature)featureID); +#else + Q_UNUSED(featureID); + return true; +#endif +} + Qt::Orientation HelpUtils::defaultOrientation() { return Qt::Vertical;