--- a/userguide/inc/BrowserWrapper.h Mon May 03 12:24:47 2010 +0300
+++ b/userguide/inc/BrowserWrapper.h Wed May 26 00:57:05 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 Mon May 03 12:24:47 2010 +0300
+++ b/userguide/inc/HelpCommon.h Wed May 26 00:57:05 2010 +0300
@@ -20,6 +20,8 @@
#include <Qt>
+//const
+const int APPPRIORITY = 2001;
// words
const char* const BACKSLASH = "/";
const char* const SPECIALCHAR = "+";
@@ -50,29 +52,33 @@
const char* const TXT_BUTTON_LINK_SUPPORT = "txt_user_guide_button_link_to_nokiacomsupport";
const char* const TXT_SETLABEL_SEARCH = "txt_user_guide_setlabel_search";
const char* const TXT_SETLABEL_SEARCH_RESULTS = "txt_user_guide_setlabel_search_results";
+const char* const TXT_APPLICATIONS = "txt_user_guide_list_applications";
+const char* const TXT_COLLAPSE_ALL = "txt_user_guide_opt_collapse_all";
+const char* const TXT_EXPAND_ALL = "txt_user_guide_opt_expand_all";
// docml
+const char* const QRC_DOCML_BASE = ":/xml/baseView.docml";
const char* const QRC_DOCML_CATEGORY = ":/xml/categoryView.docml";
+const char* const QRC_DOCML_KEYWORD = ":/xml/keywordView.docml";
const char* const QRC_DOCML_CONTENTS = ":/xml/contentsView.docml";
const char* const QRC_DOCML_TOOLBAR = ":/xml/toolbar.docml";
+const char* const DOCML_VIEW_NAME = "view_help";
const char* const DOCML_ACTION_ALL = "action_all";
const char* const DOCML_ACTION_SEARCH = "action_find";
const char* const DOCML_ACTION_LINK_NOKIA = "action_online_support";
-const char* const DOCML_VIEW_CATEGORY = "view_category";
-const char* const DOCML_VIEW_CONTENTS = "view_contents";
const char* const DOCML_LIST_CATEGORY_ALL = "list_category_all";
-const char* const DOCML_LIST_CATEGORY_SEARCH = "list_category_search";
-const char* const DOCML_SEARCH_PANEL_CATEGORY = "search_panel_category";
+const char* const DOCML_LIST_SEARCH = "list_search";
+const char* const DOCML_SEARCH_PANEL = "search_panel";
const char* const DOCML_TOOLBAR = "toolbar";
const char* const DOCML_BROWSER_CONTENTS = "browser_contents";
const char* const DOCML_BROWSER = "browser";
-const char* const DOCML_LAYOUT_CATEGORY_ALL = "layout_category_all";
-const char* const DOCML_LAYOUT_CATEGORY_SEARCH = "layout_category_find";
-const char* const DOCML_LAYOUT_CATEGORY_SEARCH_NO_SRHPAL = "layout_category_find_no_searchpanel";
+const char* const DOCML_LAYOUT_SEARCH = "layout_find";
+const char* const DOCML_LAYOUT_SEARCH_NO_SRHPAL = "layout_find_no_searchpanel";
const char* const DOCML_GROUPBOX = "groupBox";
-const char* const DOCML_LAYOUT_CATEGORY_SEARCH_NO_MATCH = "layout_category_find_no_match";
-const char* const DOCML_LAYOUT_CATEGORY_SEARCH_NO_SRHPAL_NO_MATCH = "layout_category_find_no_searchpanel_no_match";
+const char* const DOCML_LAYOUT_SEARCH_NO_MATCH = "layout_find_no_match";
+const char* const DOCML_LAYOUT_SEARCH_NO_SRHPAL_NO_MATCH = "layout_find_no_searchpanel_no_match";
const char* const DOCML_NO_MATCH_LABEL = "no_match_label";
+const char* const DOCML_ACTION_EXPAND_COLLAPSE_ALL = "action_expand_collapse_all";
// enum
@@ -80,12 +86,15 @@
enum HelpViewName
{
HelpViewCategory = 0,
- HelpViewContents
+ HelpViewKeyword,
+ HelpViewContents,
+ PreviousView = 100
};
enum HelpItemRole
{
UidRole = Qt::UserRole + 1,
+ PriorityRole,
HrefRole,
KeywordRole
};
--- a/userguide/inc/HelpContentsView.h Mon May 03 12:24:47 2010 +0300
+++ b/userguide/inc/HelpContentsView.h Wed May 26 00:57:05 2010 +0300
@@ -20,14 +20,13 @@
#include <QUrl>
-#include <hbview.h>
+#include <HelpBaseView.h>
-#include "HelpCommon.h"
#include "HelpDocumentLoader.h"
class BrowserWrapper;
-class HelpContentsView : public HbView
+class HelpContentsView : public HelpBaseView
{
Q_OBJECT
@@ -40,18 +39,15 @@
private:
void initDocMl();
- void initBackAction();
-
-signals:
- void activateView(HelpViewName viewName);
-
+ void initBackAction();
+
private:
bool openApplication(const QUrl& url);
bool openExternalLink(const QUrl& url);
void openHelpContent(const QUrl& url=QUrl());
private slots: // handle system event
- void onCurrentViewChanged(HbView *view);
+ void onViewReady();
private slots: // handle button action
void onBackAction();
@@ -63,7 +59,6 @@
private:
BrowserWrapper* mBrowser;
HbAction* mSoftKeyAction;
- HelpUIBuilder mBuilder;
};
#endif //HELPCONTENTSVIEW_H
--- a/userguide/inc/HelpDataProvider.h Mon May 03 12:24:47 2010 +0300
+++ b/userguide/inc/HelpDataProvider.h Wed May 26 00:57:05 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;
};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/userguide/inc/HelpKeywordView.h Wed May 26 00:57:05 2010 +0300
@@ -0,0 +1,79 @@
+/*
+* 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 HELPKEYWORDVIEW_H
+#define HELPKEYWORDVIEW_H
+
+#include <HelpBaseView.h>
+
+#include "HelpDocumentLoader.h"
+
+class HbListView;
+class HbSearchPanel;
+class HbStaticVkbHost;
+class HbGroupBox;
+
+class HelpKeywordView : public HelpBaseView
+{
+ Q_OBJECT
+
+public:
+ HelpKeywordView();
+ ~HelpKeywordView();
+ void init();
+ void loadAllContent();
+
+private:
+ void initDocMl();
+ void initSearchList();
+ void initSearchPanel();
+ void initBackAction();
+ void initEmptyLabel();
+ void initVirtualKeyboard();
+
+private:
+ HbGroupBox* groupBox();
+
+private:
+ void updateVisibleItems(bool visible);
+ void ResetSearchPanel();
+
+private slots: // handle system event
+ void onViewReady();
+
+private slots: // handle button action
+ void onBackAction();
+
+private slots: // handle list event
+ void onSearchListActivated(const QModelIndex& index);
+
+private slots: // handle search panel event
+ void onSearchPanelExitClicked();
+ void onSearchPanelCriteriaChanged(const QString &criteria);
+
+private slots: // handle virtual keyboard event
+ void onHandleKeypadOpen();
+ void onHandleKeypadClose();
+
+private:
+ HbListView* mListSearch;
+ HbSearchPanel* mSearchPanel;
+ HbAction* mSoftKeyAction;
+ HbStaticVkbHost* mVirtualKeyboard;
+};
+
+#endif //HELPKEYWORDVIEW_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/userguide/resources/xml/baseView.docml Wed May 26 00:57:05 2010 +0300
@@ -0,0 +1,27 @@
+<?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="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="qtg_mono_online_support" />
+ </object>
+ </object>
+
+ <widget name="view_help" type="HbView">
+ <widget name="toolbar" type="HbToolBar" role="HbView:toolBar">
+ <ref object="action_all" role="HbToolBar:addAction" />
+ <ref object="action_find" role="HbToolBar:addAction" />
+ <ref object="action_online_support" role="HbToolBar:addAction" />
+ </widget>
+ </widget>
+
+ <connect sender="action_all" signal="triggered(bool)" receiver="view_help" slot="onToolbarAll()" />
+ <connect sender="action_find" signal="triggered(bool)" receiver="view_help" slot="onToolbarFind()" />
+ <connect sender="action_online_support" signal="triggered(bool)" receiver="view_help" slot="onToolbarOnlineSupport()" />
+
+</hbdocument>
\ No newline at end of file
--- a/userguide/rom/userguide.iby Mon May 03 12:24:47 2010 +0300
+++ b/userguide/rom/userguide.iby Wed May 26 00:57:05 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 Mon May 03 12:24:47 2010 +0300
+++ b/userguide/rom/userguide.pri Wed May 26 00:57:05 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 Mon May 03 12:24:47 2010 +0300
+++ b/userguide/src/BrowserWrapper.cpp Wed May 26 00:57:05 2010 +0300
@@ -36,6 +36,10 @@
mWebView = new QGraphicsWebView();
mWebView->setZoomFactor(1.5);
mWebView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
+ mWebView->settings()->setAttribute(QWebSettings::PluginsEnabled, true);
+ mWebView->settings()->setAttribute(QWebSettings::JavascriptEnabled, true);
+ mWebView->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
+ mWebView->settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, true);
connect(mWebView, SIGNAL(linkClicked(const QUrl&)), this, SIGNAL(linkClicked(const QUrl&)));
QGraphicsLinearLayout* vLayout = new QGraphicsLinearLayout(this);
@@ -45,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 Mon May 03 12:24:47 2010 +0300
+++ b/userguide/src/HelpContentsView.cpp Wed May 26 00:57:05 2010 +0300
@@ -46,27 +46,18 @@
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()
{
- // Create widget hierarchy
- setObjectName( DOCML_VIEW_CONTENTS );
-
- // List existing root elements - this allows us to refer to objects in the XML
- // which are created outside the document.
- QObjectList roots;
- roots.append( this );
-
- mBuilder.setObjectTree(roots);
-
+ initBaseDocMl();
mBuilder.load(QRC_DOCML_CONTENTS);
}
void HelpContentsView::initBackAction()
{
- mSoftKeyAction = new HbAction(Hb::BackAction);
+ mSoftKeyAction = new HbAction(Hb::BackNaviAction );
connect(mSoftKeyAction, SIGNAL(triggered()), this, SLOT(onBackAction()));
}
@@ -110,16 +101,16 @@
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())
{
setNavigationAction(mSoftKeyAction);
openHelpContent();
@@ -140,7 +131,7 @@
}
else
{
- emit activateView(HelpViewCategory);
+ emit activateView(PreviousView);
}
}
--- a/userguide/src/HelpDataProvider.cpp Mon May 03 12:24:47 2010 +0300
+++ b/userguide/src/HelpDataProvider.cpp Wed May 26 00:57:05 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,206 +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);
-// constructKeywordModel(uid);
- }
+ 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("Applications");
- }
- itemApp->appendRow(item);
-// constructKeywordModel(pathTemp);
- }
- 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;
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/userguide/src/HelpKeywordView.cpp Wed May 26 00:57:05 2010 +0300
@@ -0,0 +1,253 @@
+/*
+* 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:
+*
+*/
+
+#include <QStandardItemModel>
+#include <QDebug>
+
+#include <hbmainwindow.h>
+#include <hbapplication.h>
+#include <hbaction.h>
+#include <hbtoolbar.h>
+#include <hblabel.h>
+
+#include <hbtreeview.h>
+#include <hblistview.h>
+#include <hbsearchpanel.h>
+#include <hbscrollbar.h>
+#include <hblineedit.h>
+#include <hbmenu.h>
+#include <hbstaticvkbhost.h>
+#include <hbgroupbox.h>
+
+#include "HelpDataProvider.h"
+#include "HelpProxyModel.h"
+
+#include "HelpKeywordView.h"
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+
+HelpKeywordView::HelpKeywordView() :
+mListSearch(NULL),
+mSearchPanel(NULL)
+{
+}
+
+HelpKeywordView::~HelpKeywordView()
+{
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+
+void HelpKeywordView::init()
+{
+ initDocMl();
+ initBackAction();
+ initSearchList();
+ initSearchPanel();
+ initVirtualKeyboard();
+ initEmptyLabel();
+
+ connect(mainWindow(), SIGNAL(viewReady()), this, SLOT(onViewReady()));
+}
+
+void HelpKeywordView::initDocMl()
+{
+ initBaseDocMl();
+ mBuilder.load(QRC_DOCML_KEYWORD);
+}
+
+void HelpKeywordView::initBackAction()
+{
+ mSoftKeyAction = new HbAction(Hb::BackNaviAction);
+ connect(mSoftKeyAction, SIGNAL(triggered()), this, SLOT(onBackAction()));
+}
+
+void HelpKeywordView::initSearchList()
+{
+ mListSearch = mBuilder.findWidget<HbListView*>(DOCML_LIST_SEARCH);
+ mListSearch->setHorizontalScrollBarPolicy(HbScrollArea::ScrollBarAlwaysOff);
+ mListSearch->setModel(HelpDataProvider::instance()->getSearchData());
+ connect(mListSearch, SIGNAL(activated(const QModelIndex&)), this, SLOT(onSearchListActivated(const QModelIndex&)));
+}
+void HelpKeywordView::initSearchPanel()
+{
+ mSearchPanel = mBuilder.findWidget<HbSearchPanel*>(DOCML_SEARCH_PANEL);
+ connect(mSearchPanel, SIGNAL(exitClicked()), this, SLOT(onSearchPanelExitClicked()));
+ connect(mSearchPanel, SIGNAL(criteriaChanged(const QString&)), this, SLOT(onSearchPanelCriteriaChanged(const QString&)));
+}
+
+void HelpKeywordView::initVirtualKeyboard()
+{
+ mVirtualKeyboard = new HbStaticVkbHost(this);
+ connect(mVirtualKeyboard, SIGNAL(keypadOpened()), this, SLOT(onHandleKeypadOpen()));
+ connect(mVirtualKeyboard, SIGNAL(keypadClosed()), this, SLOT(onHandleKeypadClose()));
+}
+
+void HelpKeywordView::initEmptyLabel()
+{
+ HbLabel* label = mBuilder.findWidget<HbLabel*>(DOCML_NO_MATCH_LABEL);
+ label->setFontSpec(HbFontSpec(HbFontSpec::Primary));
+}
+
+void HelpKeywordView::loadAllContent()
+{
+ mBuilder.load(QRC_DOCML_KEYWORD, DOCML_LAYOUT_SEARCH);
+ ResetSearchPanel();
+ toolBar()->hide();
+}
+
+HbGroupBox* HelpKeywordView::groupBox()
+{
+ return mBuilder.findWidget<HbGroupBox*>(DOCML_GROUPBOX);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+
+void HelpKeywordView::updateVisibleItems(bool visible)
+{
+ static Hb::SceneItems items = Hb::TitleBarItem | Hb::StatusBarItem;
+ if(visible)
+ {
+ showItems(items);
+ }
+ else
+ {
+ hideItems(items);
+ }
+}
+
+void HelpKeywordView::ResetSearchPanel()
+{
+ foreach(QGraphicsItem *obj, mSearchPanel->childItems())
+ {
+ QGraphicsWidget *const widget = static_cast<QGraphicsWidget*>(obj);
+ if(widget != NULL)
+ {
+ HbLineEdit *const lineEdit = qobject_cast<HbLineEdit*>(widget);
+ if(lineEdit != NULL)
+ {
+ lineEdit->setText("");
+ lineEdit->setFocus();
+ break;
+ }
+ }
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+// handle system event
+
+void HelpKeywordView::onViewReady()
+{
+ if(isVisible())
+ {
+ setNavigationAction(mSoftKeyAction);
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////////////
+// handle button back action
+
+void HelpKeywordView::onBackAction()
+{
+ emit activateView(HelpViewCategory);
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+// handle list event
+
+void HelpKeywordView::onSearchListActivated(const QModelIndex& index)
+{
+ if(!index.isValid() || // invalid
+ index.child(0,0).isValid()) // this is a node
+ {
+ return;
+ }
+
+ QString uid = mListSearch->model()->data(index, UidRole).toString();
+ QString href = mListSearch->model()->data(index, HrefRole).toString();
+ HelpDataProvider::instance()->setHelpContentUrl(uid, href);
+ emit activateView(HelpViewContents);
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+// handle search panel event
+
+void HelpKeywordView::onSearchPanelExitClicked()
+{
+ if(mListSearch->model()->rowCount() == 0)
+ {
+ mBuilder.load(QRC_DOCML_KEYWORD, DOCML_LAYOUT_SEARCH_NO_SRHPAL_NO_MATCH);
+ }
+ else
+ {
+ mBuilder.load(QRC_DOCML_KEYWORD, DOCML_LAYOUT_SEARCH_NO_SRHPAL);
+ }
+ toolBar()->show();
+}
+
+void HelpKeywordView::onSearchPanelCriteriaChanged(const QString &criteria)
+{
+ HelpDataProvider::instance()->getSearchData(criteria);
+ if(mListSearch->model()->rowCount() == 0)
+ {
+ mBuilder.load(QRC_DOCML_KEYWORD, DOCML_LAYOUT_SEARCH_NO_MATCH);
+ }
+ else
+ {
+ 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);
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+// handle virtual keyboard event
+
+void HelpKeywordView::onHandleKeypadOpen()
+{
+ updateVisibleItems(false);
+ qreal heightToSet = mainWindow()->layoutRect().height() - mVirtualKeyboard->keyboardArea().height();
+ this->setMaximumHeight(heightToSet);
+}
+
+void HelpKeywordView::onHandleKeypadClose()
+{
+ updateVisibleItems(true);
+ qreal mainHeight = mainWindow()->layoutRect().height();
+ qreal toolbarHeight = toolBar()->size().height();
+ qreal height = mainHeight - (toolBar()->isVisible() ? toolbarHeight : 0);
+ this->setMaximumHeight(height);
+}
+
+// end of file