--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/layers.sysdef.xml Fri Apr 16 14:53:45 2010 +0300
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<!DOCTYPE SystemDefinition SYSTEM "sysdef_1_5_1.dtd" [
+ <!ENTITY layer_real_source_path "sf/app/helps" >
+]>
+
+<SystemDefinition name="helps" schema="1.5.1">
+ <systemModel>
+ <layer name="app_layer">
+ <module name="helps">
+ <unit name="helps" unitID="abs.helps" bldFile="&layer_real_source_path;/userguide" mrp="" proFile="Userguide.pro" />
+ </module>
+ </layer>
+ </systemModel>
+</SystemDefinition>
Binary file symhelp/helpmodel/TestData/Source/ER5Help/General/Symbols page.mbm has changed
Binary file symhelp/helpmodel/documentation/HLPMODEL test code.rtf has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysdef_1_5_1.dtd Fri Apr 16 14:53:45 2010 +0300
@@ -0,0 +1,88 @@
+ <!ELEMENT SystemDefinition (systemModel?, build?)>
+ <!ATTLIST SystemDefinition
+ name CDATA #REQUIRED
+ schema CDATA #REQUIRED>
+ <!ELEMENT systemModel (layer+)>
+ <!ELEMENT layer (logicalset* | module*)*>
+ <!ATTLIST layer
+ name CDATA #REQUIRED
+ levels CDATA #IMPLIED
+ span CDATA #IMPLIED>
+ <!ELEMENT logicalset (logicalsubset* | module* | unit* | package* | prebuilt*)*>
+ <!ATTLIST logicalset name CDATA #REQUIRED>
+ <!ELEMENT logicalsubset (module* | unit* | package* | prebuilt*)*>
+ <!ATTLIST logicalsubset name CDATA #REQUIRED>
+ <!ELEMENT module (component* | unit* | package* | prebuilt*)*>
+ <!ATTLIST module
+ name CDATA #REQUIRED
+ level CDATA #IMPLIED>
+ <!ELEMENT component (unit* | package* | prebuilt*)*>
+ <!ATTLIST component name CDATA #REQUIRED>
+ <!ELEMENT unit EMPTY>
+ <!ATTLIST unit
+ unitID ID #REQUIRED
+ name CDATA #REQUIRED
+ mrp CDATA #REQUIRED
+ filter CDATA #IMPLIED
+ bldFile CDATA #REQUIRED
+ priority CDATA #IMPLIED
+ contract CDATA #IMPLIED
+ proFile CDATA #IMPLIED
+ qmakeArgs CDATA #IMPLIED>
+ <!ELEMENT package EMPTY>
+ <!ATTLIST package
+ name CDATA #REQUIRED
+ mrp CDATA #REQUIRED
+ filter CDATA #IMPLIED
+ contract CDATA #IMPLIED>
+ <!ELEMENT prebuilt EMPTY>
+ <!ATTLIST prebuilt
+ name CDATA #REQUIRED
+ version CDATA #REQUIRED
+ late (Y|N) #IMPLIED
+ filter CDATA #IMPLIED
+ contract CDATA #IMPLIED>
+ <!ELEMENT build (option* | target+ | targetList+ | unitList+ | configuration+)*>
+ <!ELEMENT unitList (unitRef+)>
+ <!ATTLIST unitList
+ name ID #REQUIRED
+ description CDATA #REQUIRED>
+ <!ELEMENT unitRef EMPTY>
+ <!ATTLIST unitRef unit IDREF #REQUIRED>
+ <!ELEMENT targetList EMPTY>
+ <!ATTLIST targetList
+ name ID #REQUIRED
+ description CDATA #REQUIRED
+ target IDREFS #REQUIRED>
+ <!ELEMENT target EMPTY>
+ <!ATTLIST target
+ name ID #REQUIRED
+ abldTarget CDATA #REQUIRED
+ description CDATA #REQUIRED>
+ <!ELEMENT option EMPTY>
+ <!ATTLIST option
+ name ID #REQUIRED
+ abldOption CDATA #REQUIRED
+ description CDATA #REQUIRED
+ enable (Y | N | y | n) #REQUIRED>
+ <!ELEMENT configuration (unitListRef+ | layerRef+ | task+)*>
+ <!ATTLIST configuration
+ name ID #REQUIRED
+ description CDATA #REQUIRED
+ filter CDATA #REQUIRED>
+ <!ELEMENT task ( unitListRef* , (buildLayer | specialInstructions))>
+ <!ELEMENT unitListRef EMPTY>
+ <!ATTLIST unitListRef unitList IDREF #REQUIRED>
+ <!ELEMENT layerRef EMPTY>
+ <!ATTLIST layerRef layerName CDATA #REQUIRED>
+ <!ELEMENT buildLayer EMPTY>
+ <!ATTLIST buildLayer
+ command CDATA #REQUIRED
+ targetList IDREFS #IMPLIED
+ unitParallel (Y | N | y | n) #REQUIRED
+ targetParallel (Y | N | y | n) #IMPLIED>
+ <!ELEMENT specialInstructions EMPTY>
+ <!ATTLIST specialInstructions
+ name CDATA #REQUIRED
+ cwd CDATA #REQUIRED
+ command CDATA #REQUIRED>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/userguide/Userguide.pro Fri Apr 16 14:53:45 2010 +0300
@@ -0,0 +1,68 @@
+#
+# 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:
+#
+
+TEMPLATE = app
+QT += webkit xmlpatterns
+CONFIG += hb
+TRANSLATIONS = userguide.ts common.ts
+#add "precompile_header" to CONFIG
+
+TARGET = Userguide
+DEPENDPATH += .
+INCLUDEPATH += ./inc
+
+# PRECOMPILED_HEADER = pch.h
+
+# Input
+HEADERS += inc/HelpMainWindow.h \
+ inc/BrowserWrapper.h \
+ inc/HelpContentsView.h \
+ inc/HelpCategoryView.h \
+ inc/HelpDocumentLoader.h \
+ inc/HelpCommon.h \
+ inc/HelpDataProvider.h \
+ inc/HelpUtils.h \
+ inc/HelpProxyModel.h \
+ inc/HelpStandardItem.h
+
+SOURCES += src/main.cpp \
+ src/HelpMainWindow.cpp \
+ src/BrowserWrapper.cpp \
+ src/HelpContentsView.cpp \
+ src/HelpCategoryView.cpp \
+ src/HelpDocumentLoader.cpp \
+ src/HelpDataProvider.cpp \
+ src/HelpUtils.cpp \
+ src/HelpProxyModel.cpp \
+ src/HelpStandardItem.cpp
+
+win32 {
+ SOURCES += src/HelpUtils_win.cpp
+}
+
+symbian {
+ TARGET.UID3 = 0x10005234
+ TARGET.CAPABILITY = CAP_APPLICATION
+ TARGET.EPOCHEAPSIZE = 0x020000 0x1000000
+
+ LIBS += -lezip -lxqservice -lxqserviceutil
+ include(rom/userguide.pri)
+}
+
+RESOURCES += resources/Userguide.qrc
+
+debug: DESTDIR = ./debug
+release: DESTDIR = ./release
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/userguide/inc/BrowserWrapper.h Fri Apr 16 14:53:45 2010 +0300
@@ -0,0 +1,53 @@
+/*
+* 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 BROWSERWRAPPER_H
+#define BROWSERWRAPPER_H
+
+#include <QStack>
+#include <QGraphicsWebView>
+
+#include <hbwidget.h>
+
+class BrowserWrapper : public HbWidget
+{
+ Q_OBJECT
+
+public:
+ BrowserWrapper();
+ ~BrowserWrapper();
+
+public:
+ void init();
+
+public:
+ void setHtml(const QString& html, const QUrl& baseUrl);
+ void clearHistory();
+ bool canGoBack();
+ void back();
+
+signals:
+ void linkClicked(const QUrl &url);
+ void urlChanged(const QUrl&);
+
+private:
+ QGraphicsWebView* mWebView;
+ QStack<QUrl> mHistory;
+
+};
+
+#endif //MYTEXTBROWSER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/userguide/inc/HelpCategoryView.h Fri Apr 16 14:53:45 2010 +0300
@@ -0,0 +1,96 @@
+/*
+* 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 HELPCATEGORYVIEW_H
+#define HELPCATEGORYVIEW_H
+
+#include <hbview.h>
+
+#include "HelpCommon.h"
+
+class HbTreeView;
+class HbToolBar;
+class HbSearchPanel;
+
+class HelpCategoryView : public HbView
+{
+ Q_OBJECT
+
+public:
+ HelpCategoryView();
+ ~HelpCategoryView();
+ void init();
+
+private:
+ void initAllList();
+ void initSearchList();
+ void initSearchPanel();
+ void initToolbar();
+ void initBackAction();
+
+public:
+ enum ViewMode
+ {
+ ViewModeNull = 0,
+ ViewModeAll,
+ ViewModeSearch
+ };
+ void switchViewMode(ViewMode viewMode);
+
+signals:
+ void activateView(HelpViewName viewName);
+
+signals: // from tollbar event
+ void showAllList();
+ void showFindList();
+ void showOnlineSupport();
+
+private:
+ void RefreshToolbarText(bool isLandscape);
+ void RefreshTitlebarVisibility();
+ void ResetSearchPanel();
+
+private slots: // handle system event
+ void onCurrentViewChanged(HbView *view);
+ void onOrientationChanged(Qt::Orientation orientation);
+
+private slots: // handle button action
+ void onBackAction();
+
+private slots: // handle tollbar event
+ void onToolbarAll() { emit showAllList(); };
+ void onToolbarFind() { emit showFindList(); };
+ void onToolbarOnlineSupport() { emit showOnlineSupport(); };
+
+private slots: // handle list event
+ void onAllListActivated(const QModelIndex& index);
+ void onSearchListActivated(const QModelIndex& index);
+
+private slots: // handle search panel event
+ void onSearchPanelExitClicked();
+ void onSearchPanelCriteriaChanged(const QString &criteria);
+
+private:
+ ViewMode mViewMode;
+ HbTreeView* mListAll;
+ HbTreeView* mListSearch;
+ HbSearchPanel* mSearchPanel;
+ HbToolBar* mToolBar;
+ HbAction* mSoftKeyAction;
+};
+
+#endif //HELPCATEGORYVIEW_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/userguide/inc/HelpCommon.h Fri Apr 16 14:53:45 2010 +0300
@@ -0,0 +1,88 @@
+/*
+* 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 HELPCOMMON_H
+#define HELPCOMMON_H
+
+#include <Qt>
+
+// words
+const char* const BACKSLASH = "/";
+const char* const SPECIALCHAR = "+";
+const char* const HASHMARK = "#";
+
+// help content file name
+const char* const XHTMLPATH = "resource/xhtml/";
+const char* const CONTENTSZIP = "contents.zip";
+const char* const INDEXXML = "index.xml";
+const char* const KEYWORDXML = "keywords.xml";
+const char* const METAXML = "meta.xml";
+
+// path
+const char* const PATH_ROOT = "z:/";
+const char* const PATH_TRANSLATIONS = "Z:/resource/qt/translations/";
+
+// URL
+const char* const URL_HEADER_APP = "app://";
+const char* const URL_HEADER_HTTP = "http://";
+const char* const URL_HEADER_HTTPS = "https://";
+const char* const URL_HEADER_FTP = "ftp://";
+const char* const URL_HEADER_LOCAL = "file:///";
+const char* const URL_LINK_SUPPORT= "Link to Nokia.com/support";
+
+// text
+const char* const TXT_TITLE = "txt_user_guide_title_user_guide";
+const char* const TXT_BUTTON_ALL = "txt_common_button_all";
+const char* const TXT_BUTTON_FIND = "txt_common_button_find";
+const char* const TXT_BUTTON_LINK_SUPPORT = "txt_user_guide_button_link_to_nokiacomsupport";
+
+// docml
+const char* const QRC_DOCML_CATEGORY = ":/xml/categoryView.docml";
+const char* const QRC_DOCML_CONTENTS = ":/xml/contentsView.docml";
+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_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";
+
+
+// enum
+
+enum HelpViewName
+{
+ HelpViewCategory = 0,
+ HelpViewContents
+};
+
+enum HelpItemRole
+{
+ UidRole = Qt::UserRole + 1,
+ HrefRole,
+ KeywordRole
+};
+
+#endif //HELPCOMMON_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/userguide/inc/HelpContentsView.h Fri Apr 16 14:53:45 2010 +0300
@@ -0,0 +1,76 @@
+/*
+* 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 HELPCONTENTSVIEW_H
+#define HELPCONTENTSVIEW_H
+
+#include <QUrl.h>
+
+#include <hbview.h>
+
+#include "HelpCommon.h"
+
+class BrowserWrapper;
+
+class HelpContentsView : public HbView
+{
+ Q_OBJECT
+
+public:
+ HelpContentsView();
+ ~HelpContentsView();
+
+public:
+ void init();
+
+private:
+ void initBackAction();
+
+signals:
+ void activateView(HelpViewName viewName);
+
+signals: // from tollbar event
+ void showAllList();
+ void showFindList();
+ void showOnlineSupport();
+
+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);
+
+private slots: // handle button action
+ void onBackAction();
+
+private slots: // handle tollbar event
+ void onToolbarAll() { emit showAllList(); };
+ void onToolbarFind() { emit showFindList(); };
+ void onToolbarOnlineSupport() { emit showOnlineSupport(); };
+
+private slots: // handle browser event
+ void onLinkClicked(const QUrl& url);
+ void onUrlChanged(const QUrl& url);
+
+private:
+ BrowserWrapper* mBrowser;
+ HbAction* mSoftKeyAction;
+};
+
+#endif //HELPCONTENTSVIEW_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/userguide/inc/HelpDataProvider.h Fri Apr 16 14:53:45 2010 +0300
@@ -0,0 +1,60 @@
+/*
+* 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 HELPDATAPROVIDER_H
+#define HELPDATAPROVIDER_H
+
+class HelpModel;
+class HelpItems;
+class HelpProxyModel;
+class QStandardItemModel;
+class HelpStandardItem;
+
+class HelpDataProvider
+{
+private:
+ HelpDataProvider();
+ ~HelpDataProvider();
+
+public:
+ static HelpDataProvider* instance();
+ static void destroyInstance();
+
+public:
+ 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);
+ void constructKeywordModel(const QString& path);
+ HelpStandardItem* constructCategory2(const QString& title, const QString& uid);
+ HelpStandardItem* findItemWithHref(HelpStandardItem* itemParent, const QString& href);
+
+private:
+ QStandardItemModel* mHelpModel; //category tree model
+ QStandardItemModel* mKeywordModel; //keyword list model
+ HelpProxyModel* mSearhResultModel; //search result proxy model of keyword model
+
+ QString mHelpContentRoot;
+
+};
+
+#endif //HELPDATAPROVIDER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/userguide/inc/HelpDocumentLoader.h Fri Apr 16 14:53:45 2010 +0300
@@ -0,0 +1,41 @@
+/*
+* 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 HELPDOCUMENTLOADER_H
+#define HELPDOCUMENTLOADER_H
+
+#include <hbdocumentloader.h>
+
+class HelpUIBuilder
+{
+public:
+ static void destroyInstance();
+ static QObjectList load(const QString& fileName);
+ static QObjectList load(const QString& fileName, const QString& section);
+ static QGraphicsWidget* findWidget(const QString& name);
+ static QObject* findObject(const QString& name);
+
+public:
+ template<class T> static T findWidget(const QString& name) { return qobject_cast<T>(findWidget(name)); }
+ template<class T> static T findObject(const QString& name) { return qobject_cast<T>(findObject(name)); }
+
+private:
+ static HbDocumentLoader* instance();
+};
+
+
+#endif //HELPDOCUMENTLOADER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/userguide/inc/HelpMainWindow.h Fri Apr 16 14:53:45 2010 +0300
@@ -0,0 +1,61 @@
+/*
+* 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 HELPMAINWINDOW_H
+#define HELPMAINWINDOW_H
+
+#include <hbmainwindow.h>
+
+#include "HelpCommon.h"
+
+class HelpCategoryView;
+class HelpContentsView;
+
+class HelpMainWindow : public HbMainWindow
+{
+ Q_OBJECT
+
+public:
+ HelpMainWindow();
+ ~HelpMainWindow();
+
+private slots:
+ void onActivateView(HelpViewName viewName);
+
+private: // activate views
+ void activateCategoryView();
+ void activateContentsView();
+ void initBackAction();
+
+private:
+ void connectViewSignal(const QObject *object);
+
+signals:
+ void backActionSignal();
+
+private slots: // handle view event
+ void onShowAllList();
+ void onShowFindList();
+ void onShowOnlineSupport();
+
+private:
+ HelpCategoryView* mCategoryView;
+ HelpContentsView* mContentsView;
+
+};
+
+#endif //HELPMAINWINDOW_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/userguide/inc/HelpProxyModel.h Fri Apr 16 14:53:45 2010 +0300
@@ -0,0 +1,34 @@
+/*
+* 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 HELPPROXYMODEL_H
+#define HELPPROXYMODEL_H
+
+#include <QSortFilterProxyModel>
+
+class HelpProxyModel : public QSortFilterProxyModel
+{
+ Q_OBJECT
+public:
+ HelpProxyModel(QObject * parent = 0);
+ ~HelpProxyModel();
+
+protected:
+ bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
+};
+
+#endif //HELPPROXYMODEL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/userguide/inc/HelpStandardItem.h Fri Apr 16 14:53:45 2010 +0300
@@ -0,0 +1,32 @@
+/*
+* 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 HELPSTANDARDITEM_H
+#define HELPSTANDARDITEM_H
+
+#include <QStandardItem>
+
+class HelpStandardItem : public QStandardItem
+{
+public:
+ HelpStandardItem(const QString& text);
+ ~HelpStandardItem();
+ bool operator<(const QStandardItem & other) const;
+};
+
+#endif //HELPSTANDARDITEM_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/userguide/inc/HelpUtils.h Fri Apr 16 14:53:45 2010 +0300
@@ -0,0 +1,34 @@
+/*
+* 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 HELPUTILS_H
+#define HELPUTILS_H
+
+#include <QString>
+
+class HelpUtils
+{
+public:
+ static void loadHtmlFromZipFile(const QString& path, const QString& htmlFile, QString& htmlContent);
+ static int launchApplication(const QString& appUid);
+ static QString rootPath();
+ static QString UILocaleFromQtToSymbian();
+ static Qt::Orientation defaultOrientation();
+ static Qt::SortOrder sortOrder();
+};
+
+#endif //HELPUTILS_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/userguide/resources/Userguide.qrc Fri Apr 16 14:53:45 2010 +0300
@@ -0,0 +1,14 @@
+<RCC>
+
+ <qresource prefix="/xml">
+ <file alias="categoryView.docml">xml/categoryView.docml</file>
+ <file alias="contentsView.docml">xml/contentsView.docml</file>
+ </qresource>
+
+ <qresource prefix= "/images">
+ <file alias="show_all.svg">images/qtg_mono_show_all.svg</file>
+ <file alias="search.svg">images/qtg_mono_search.svg</file>
+ <file alias="link_nokia.svg">images/qtg_mono_link_nokia.svg</file>
+ </qresource>
+
+</RCC>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/userguide/resources/images/qtg_mono_link_nokia.svg Fri Apr 16 14:53:45 2010 +0300
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 14.0.0, SVG Export Plug-In -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+ <!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
+]>
+<svg version="1.1"
+ xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
+ x="0px" y="0px" width="30px" height="30px" viewBox="0 0 30 30" enable-background="new 0 0 30 30" xml:space="preserve">
+<defs>
+</defs>
+<path d="M15,5c5.514,0,10,4.486,10,10s-4.486,10-10,10S5,20.514,5,15S9.486,5,15,5 M15,2C7.821,2,2,7.821,2,15s5.821,13,13,13
+ s13-5.821,13-13S22.179,2,15,2L15,2z"/>
+<path d="M16.851,23h-3.315v-9.857h-1.139v-1.888h4.454V23z M15.192,10.036c-0.539,0-0.974-0.135-1.303-0.404
+ c-0.33-0.27-0.495-0.642-0.495-1.113c0-0.467,0.162-0.836,0.484-1.109C14.202,7.137,14.641,7,15.192,7
+ c0.526,0,0.959,0.138,1.299,0.414C16.83,7.691,17,8.059,17,8.519c0,0.472-0.164,0.844-0.494,1.113
+ C16.177,9.901,15.739,10.036,15.192,10.036z"/>
+<rect fill="none" width="30" height="30"/>
+</svg>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/userguide/resources/images/qtg_mono_search.svg Fri Apr 16 14:53:45 2010 +0300
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" height="40px" version="1.1" viewBox="0 0 40 40" width="40px" x="0px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" y="0px">
+<rect fill="none" fill-opacity="0.5" height="40" stroke-opacity="0.5" width="40"/>
+<rect height="2" transform="matrix(-0.7071 -0.7071 0.7071 -0.7071 -15.7259 63.0843)" width="6" x="2.201" y="33.799"/>
+<path d="M34.192,5.807c-5.077-5.076-13.308-5.076-18.385,0c-4.594,4.595-5.016,11.766-1.294,16.851l-2.241,2.24l-0.707-0.707 l-6.364,6.364l4.243,4.243l6.364-6.364l-0.707-0.707l2.241-2.241c5.085,3.721,12.256,3.299,16.851-1.295 C39.27,19.115,39.269,10.883,34.192,5.807z M31.364,21.363c-3.51,3.508-9.22,3.509-12.728,0C16.937,19.664,16,17.403,16,15 c0-2.405,0.937-4.665,2.636-6.365c3.508-3.508,9.219-3.508,12.728,0C34.873,12.145,34.873,17.854,31.364,21.363z"/>
+</svg>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/userguide/resources/images/qtg_mono_show_all.svg Fri Apr 16 14:53:45 2010 +0300
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 14.0.0, SVG Export Plug-In -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+ <!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
+]>
+<svg version="1.1"
+ xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
+ x="0px" y="0px" width="30px" height="30px" viewBox="0 0 30 30" enable-background="new 0 0 30 30" xml:space="preserve">
+<defs>
+</defs>
+<rect x="8" y="11" width="2" height="2"/>
+<rect x="11.059" y="11" width="8.941" height="2"/>
+<rect x="8" y="6" width="2" height="2"/>
+<rect x="11.059" y="6" width="8.941" height="2"/>
+<polygon points="8,25 5,25 5,3 23,3 23,13 26,13 26,0 2,0 2,28 8,28 "/>
+<path d="M26,17v11H12V17H26 M28,15H10v15h18V15L28,15z"/>
+<rect x="14" y="19" width="10" height="1"/>
+<rect x="14" y="22" width="10" height="1"/>
+<rect x="14" y="25" width="10" height="1"/>
+<rect fill="none" width="30" height="30"/>
+</svg>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/userguide/rom/userguide.iby Fri Apr 16 14:53:45 2010 +0300
@@ -0,0 +1,31 @@
+# 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
+#
+
+#ifndef __HELP_IBY__
+#define __HELP_IBY__
+
+#include <bldprivate.hrh>
+
+#define HB_UPGRADABLE_APP_REG_RSC(NAME) data=DATAZ_\PRIVATE\10003A3F\IMPORT\APPS\ ## NAME ## _reg.rsc Private\10003a3f\import\apps\ ## NAME ## _reg.rsc
+
+file=ABI_DIR\BUILD_DIR\Userguide.exe SHARED_LIB_DIR\Userguide.exe
+
+HB_UPGRADABLE_APP_REG_RSC(Userguide)
+S60_APP_RESOURCE(Userguide)
+
+#endif
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/userguide/rom/userguide.pri Fri Apr 16 14:53:45 2010 +0300
@@ -0,0 +1,29 @@
+# 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
+#
+
+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 += "$$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)"
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/userguide/rom/userguide_resources.iby Fri Apr 16 14:53:45 2010 +0300
@@ -0,0 +1,28 @@
+/*
+* 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 USERGUIDE_RESOURCES
+#define USERGUIDE_RESOURCES
+
+
+#include <data_caging_paths_for_iby.hrh>
+
+data=DATAZ_\QT_TRANSLATIONS_DIR\userguide.qm QT_TRANSLATIONS_DIR\userguide.qm
+data=DATAZ_\APP_RESOURCE_DIR\Userguide.RSC APP_RESOURCE_DIR\Userguide.rsc
+
+
+#endif // USERGUIDE_RESOURCES
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/userguide/src/BrowserWrapper.cpp Fri Apr 16 14:53:45 2010 +0300
@@ -0,0 +1,80 @@
+/*
+* 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 <QGraphicsScene>
+#include <QGraphicsProxyWidget>
+#include <QGraphicsLinearLayout>
+
+#include "HelpDocumentLoader.h"
+#include "HelpCommon.h"
+#include "BrowserWrapper.h"
+
+BrowserWrapper::BrowserWrapper()
+{
+}
+
+BrowserWrapper::~BrowserWrapper()
+{
+}
+
+void BrowserWrapper::init()
+{
+ mWebView = new QGraphicsWebView();
+ mWebView->setZoomFactor(1.5);
+ mWebView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
+ connect(mWebView, SIGNAL(linkClicked(const QUrl&)), this, SIGNAL(linkClicked(const QUrl&)));
+
+ QGraphicsLinearLayout* vLayout = new QGraphicsLinearLayout(this);
+ vLayout->setOrientation(Qt::Vertical);
+ vLayout->addItem(mWebView);
+ vLayout->setContentsMargins(0,0,0,0);
+ setLayout(vLayout);
+}
+
+void BrowserWrapper::setHtml(const QString& html, const QUrl& baseUrl)
+{
+ mWebView->setHtml(html, baseUrl);
+
+ if(!mHistory.count() || mHistory.top()!=baseUrl)
+ {
+ mHistory.append(baseUrl);
+ }
+}
+
+void BrowserWrapper::clearHistory()
+{
+ mHistory.clear();
+}
+
+bool BrowserWrapper::canGoBack()
+{
+ return (mHistory.count() > 1);
+}
+
+void BrowserWrapper::back()
+{
+ if(canGoBack())
+ {
+ mHistory.pop();
+ QUrl url = mHistory.top();
+ emit urlChanged(url);
+ }
+}
+
+
+// end of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/userguide/src/HelpCategoryView.cpp Fri Apr 16 14:53:45 2010 +0300
@@ -0,0 +1,245 @@
+/*
+* 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 <hbtreeview.h>
+#include <hbtoolbar.h>
+#include <hbsearchpanel.h>
+#include <hbscrollbar.h>
+#include <hblineedit.h>
+#include <hbmenu.h>
+
+#include "HelpDocumentLoader.h"
+#include "HelpDataProvider.h"
+#include "HelpProxyModel.h"
+
+#include "HelpCategoryView.h"
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+
+HelpCategoryView::HelpCategoryView() :
+mViewMode(ViewModeNull),
+mListAll(NULL),
+mListSearch(NULL),
+mSearchPanel(NULL),
+mToolBar(NULL)
+{
+}
+
+HelpCategoryView::~HelpCategoryView()
+{
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+
+void HelpCategoryView::init()
+{
+ initBackAction();
+ initAllList();
+ initSearchList();
+ initSearchPanel();
+ initToolbar();
+
+ switchViewMode(ViewModeAll);
+
+ connect(mainWindow(), SIGNAL(currentViewChanged(HbView*)), this, SLOT(onCurrentViewChanged(HbView*)));
+ connect(mainWindow(), SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(onOrientationChanged(Qt::Orientation)));
+}
+
+void HelpCategoryView::initBackAction()
+{
+ mSoftKeyAction = new HbAction(Hb::BackAction);
+ connect(mSoftKeyAction, SIGNAL(triggered()), this, SLOT(onBackAction()));
+}
+
+void HelpCategoryView::initAllList()
+{
+ mListAll = HelpUIBuilder::findWidget<HbTreeView*>(DOCML_LIST_CATEGORY_ALL);
+ mListAll->setHorizontalScrollBarPolicy(HbScrollArea::ScrollBarAlwaysOff);
+ mListAll->setModel(HelpDataProvider::instance()->getCategoryData());
+ connect(mListAll, SIGNAL(activated(const QModelIndex&)), this, SLOT(onAllListActivated(const QModelIndex&)));
+}
+
+void HelpCategoryView::initSearchList()
+{
+ mListSearch = HelpUIBuilder::findWidget<HbTreeView*>(DOCML_LIST_CATEGORY_SEARCH);
+ mListSearch->setHorizontalScrollBarPolicy(HbScrollArea::ScrollBarAlwaysOff);
+ mListSearch->setModel(HelpDataProvider::instance()->getSearchData());
+ connect(mListSearch, SIGNAL(activated(const QModelIndex&)), this, SLOT(onSearchListActivated(const QModelIndex&)));
+}
+void HelpCategoryView::initSearchPanel()
+{
+ mSearchPanel = HelpUIBuilder::findWidget<HbSearchPanel*>(DOCML_SEARCH_PANEL_CATEGORY);
+ connect(mSearchPanel, SIGNAL(exitClicked()), this, SLOT(onSearchPanelExitClicked()));
+ connect(mSearchPanel, SIGNAL(criteriaChanged(const QString&)), this, SLOT(onSearchPanelCriteriaChanged(const QString&)));
+}
+
+void HelpCategoryView::initToolbar()
+{
+ mToolBar = HelpUIBuilder::findWidget<HbToolBar*>(DOCML_TOOLBAR);
+
+ HbAction* allAction = HelpUIBuilder::findObject<HbAction*>(DOCML_ACTION_ALL);
+ HbAction* findAction = HelpUIBuilder::findObject<HbAction*>(DOCML_ACTION_SEARCH);
+ QActionGroup* toolBarActionGroup = new QActionGroup(mToolBar);
+ allAction->setActionGroup(toolBarActionGroup);
+ findAction->setActionGroup(toolBarActionGroup);
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+
+void HelpCategoryView::switchViewMode(ViewMode viewMode)
+{
+ if(ViewModeNull == viewMode) return;
+
+ mViewMode = viewMode;
+ if(ViewModeAll == viewMode)
+ {
+ HelpUIBuilder::load(QRC_DOCML_CATEGORY, DOCML_LAYOUT_CATEGORY_ALL);
+ }
+ else if(ViewModeSearch == viewMode)
+ {
+ HelpUIBuilder::load(QRC_DOCML_CATEGORY, DOCML_LAYOUT_CATEGORY_SEARCH);
+ }
+
+ RefreshTitlebarVisibility();
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+
+void HelpCategoryView::RefreshToolbarText(bool isLandscape)
+{
+ HbAction* tollbarAction = HelpUIBuilder::findObject<HbAction*>(DOCML_ACTION_ALL);
+ tollbarAction->setText(isLandscape ? qtTrId(TXT_BUTTON_ALL) : QString());
+
+ tollbarAction = HelpUIBuilder::findObject<HbAction*>(DOCML_ACTION_SEARCH);
+ tollbarAction->setText(isLandscape ? qtTrId(TXT_BUTTON_FIND) : QString());
+
+ tollbarAction = HelpUIBuilder::findObject<HbAction*>(DOCML_ACTION_LINK_NOKIA);
+ tollbarAction->setText(isLandscape ? qtTrId(TXT_BUTTON_LINK_SUPPORT) : QString());
+}
+
+void HelpCategoryView::RefreshTitlebarVisibility()
+{
+ setTitleBarVisible(!(mSearchPanel->isVisible()));
+}
+
+void HelpCategoryView::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("");
+ break;
+ }
+ }
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+// handle system event
+
+void HelpCategoryView::onCurrentViewChanged(HbView *view)
+{
+ if(this == view)
+ {
+ setNavigationAction(mSoftKeyAction);
+ }
+}
+
+void HelpCategoryView::onOrientationChanged(Qt::Orientation orientation)
+{
+ bool isLandscape = (Qt::Horizontal==orientation);
+ RefreshToolbarText(isLandscape);
+}
+
+
+///////////////////////////////////////////////////////////////////////////////////////
+// handle button back action
+
+void HelpCategoryView::onBackAction()
+{
+ if(this == mainWindow()->currentView())
+ {
+ HbApplication::exit();
+ }
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+// handle list event
+
+void HelpCategoryView::onAllListActivated(const QModelIndex& index)
+{
+ if(!index.isValid() || // invalid
+ index.child(0,0).isValid()) // this is a node
+ {
+ return;
+ }
+
+ QString uid = mListAll->model()->data(index.parent(), UidRole).toString();
+ QString href = mListAll->model()->data(index, HrefRole).toString();
+ HelpDataProvider::instance()->setHelpContentUrl(uid, href);
+ emit activateView(HelpViewContents);
+}
+
+void HelpCategoryView::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 HelpCategoryView::onSearchPanelExitClicked()
+{
+ setTitleBarVisible(true);
+ HelpUIBuilder::load(QRC_DOCML_CATEGORY, DOCML_LAYOUT_CATEGORY_SEARCH_NO_SRHPAL);
+}
+
+void HelpCategoryView::onSearchPanelCriteriaChanged(const QString &criteria)
+{
+ mListSearch->setModel(HelpDataProvider::instance()->getSearchData(criteria));
+ mListSearch->update();
+}
+
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/userguide/src/HelpContentsView.cpp Fri Apr 16 14:53:45 2010 +0300
@@ -0,0 +1,164 @@
+/*
+* 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 <QUrl>
+#include <QProcess>
+#include <QLatin1String>
+#include <QDebug>
+
+#include <hbaction.h>
+#include <hbmainwindow.h>
+#include <hbmenu.h>
+
+#include "BrowserWrapper.h"
+#include "HelpDocumentLoader.h"
+#include "HelpDataProvider.h"
+#include "HelpUtils.h"
+#include "HelpContentsView.h"
+
+HelpContentsView::HelpContentsView() : mBrowser(NULL)
+{
+}
+
+HelpContentsView::~HelpContentsView()
+{
+}
+
+void HelpContentsView::init()
+{
+ initBackAction();
+ mBrowser = HelpUIBuilder::findWidget<BrowserWrapper*>(DOCML_BROWSER_CONTENTS);
+ mBrowser->init();
+
+ 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*)));
+}
+
+void HelpContentsView::initBackAction()
+{
+ mSoftKeyAction = new HbAction(Hb::BackAction);
+ connect(mSoftKeyAction, SIGNAL(triggered()), this, SLOT(onBackAction()));
+}
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+bool HelpContentsView::openApplication(const QUrl& url)
+{
+ QString str = url.toString();
+ if(str.startsWith(URL_HEADER_APP))
+ {
+ //app://cmd@localhost/APP_NAME/APP_UID
+ QString appUid = str.section(BACKSLASH, -1,-1);
+ if(appUid.contains("0x", Qt::CaseInsensitive))
+ {
+ appUid.remove(0,2);
+ }
+ int error = HelpUtils::launchApplication(appUid);
+ if(error != 0)
+ {
+ qDebug() << "AIW-ERROR: AppMgrClient:test: Send failed" << error;
+ }
+ return true;
+ }
+
+ return false;
+}
+
+bool HelpContentsView::openExternalLink(const QUrl& url)
+{
+ QString str = url.toString();
+ if(str.startsWith(URL_HEADER_HTTP) ||
+ str.startsWith(URL_HEADER_HTTPS) ||
+ str.startsWith(URL_HEADER_FTP))
+ {
+ return true;
+ }
+
+ return false;
+}
+
+void HelpContentsView::openHelpContent(const QUrl& url)
+{
+ QString html;
+ QString baseUrl = url.toString();
+ HelpDataProvider::instance()->getHelpContentData(html, baseUrl);
+ mBrowser->setHtml(html, baseUrl);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+
+void HelpContentsView::onCurrentViewChanged(HbView *view)
+{
+ if(this == view)
+ {
+ setNavigationAction(mSoftKeyAction);
+ openHelpContent();
+ }
+ else
+ {
+ mBrowser->clearHistory();
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+void HelpContentsView::onBackAction()
+{
+ if(this == mainWindow()->currentView())
+ {
+ if(mBrowser->canGoBack())
+ {
+ mBrowser->back();
+ }
+ else
+ {
+ emit activateView(HelpViewCategory);
+ }
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+void HelpContentsView::onLinkClicked(const QUrl& url)
+{
+ // try to open as application
+ if(openApplication(url))
+ {
+ return;
+ }
+
+ // try to open as remote link
+ if(openExternalLink(url))
+ {
+ return;
+ }
+
+ // try to open as local link
+ {
+ openHelpContent(url);
+ return;
+ }
+}
+
+void HelpContentsView::onUrlChanged(const QUrl& url)
+{
+ openHelpContent(url);
+}
+
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/userguide/src/HelpDataProvider.cpp Fri Apr 16 14:53:45 2010 +0300
@@ -0,0 +1,383 @@
+/*
+* 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 <QXmlQuery>
+#include <QFile>
+#include <QXmlStreamReader>
+#include <QDebug>
+#include <QDir>
+
+#include "HelpUtils.h"
+#include "HelpCommon.h"
+#include "HelpProxyModel.h"
+#include "HelpStandardItem.h"
+
+#include "HelpDataProvider.h"
+
+
+HelpDataProvider::HelpDataProvider()
+{
+ mHelpModel = new QStandardItemModel();
+ mKeywordModel = new QStandardItemModel();
+ mSearhResultModel = NULL;
+}
+
+HelpDataProvider::~HelpDataProvider()
+{
+ delete mHelpModel;
+ delete mSearhResultModel;
+ delete mKeywordModel;
+}
+
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+HelpDataProvider* gHelpDataProviderInstance = NULL;
+
+HelpDataProvider* HelpDataProvider::instance()
+{
+ if(!gHelpDataProviderInstance)
+ {
+ gHelpDataProviderInstance = new HelpDataProvider();
+ }
+
+ return gHelpDataProviderInstance;
+}
+
+void HelpDataProvider::destroyInstance()
+{
+ delete gHelpDataProviderInstance;
+ gHelpDataProviderInstance = NULL;
+}
+
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+QAbstractItemModel* HelpDataProvider::getCategoryData()
+{
+ if(!mHelpModel->rowCount())
+ {
+ createHelpCategory();
+ }
+
+ return mHelpModel;
+}
+
+QAbstractItemModel* HelpDataProvider::getSearchData(const QString& key)
+{
+ delete mSearhResultModel;
+ mSearhResultModel = NULL;
+
+ mSearhResultModel = new HelpProxyModel();;
+ mSearhResultModel->setSourceModel(mKeywordModel);
+ mSearhResultModel->setFilterRole(KeywordRole);
+ mSearhResultModel->setFilterRegExp(key);
+
+ return mSearhResultModel;
+}
+
+void HelpDataProvider::setHelpContentUrl(const QString& uid, const QString& href)
+{
+ QUrl url = QUrl::fromLocalFile(uid+BACKSLASH+href);
+ mHelpContentRoot = url.toString();
+}
+
+void HelpDataProvider::getHelpContentData(QString& content, QString& url)
+{
+ // url
+ if(url.isEmpty())
+ {
+ url = mHelpContentRoot;
+ }
+ url.remove(URL_HEADER_LOCAL);
+
+ // uid
+ QString uid = url.section(BACKSLASH, 0, -3);
+ uid.append(BACKSLASH + url.section(BACKSLASH, -2,-2));
+
+ // href
+ QString href = url.section(BACKSLASH, -1,-1);
+ int anchorPos = href.indexOf(HASHMARK);
+ if(anchorPos != -1)
+ {
+ href = href.section(HASHMARK, 0, 0);
+ }
+
+ QString path(uid);
+ path.append(BACKSLASH);
+ path.append(CONTENTSZIP);
+ HelpUtils::loadHtmlFromZipFile(path , href, content);
+}
+
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+void HelpDataProvider::createHelpCategory()
+{
+ QFileInfoList driveList = QDir::drives();
+ QDir dir;
+ QString lang = HelpUtils::UILocaleFromQtToSymbian();
+
+ QString path(HelpUtils::rootPath());
+ path.append(XHTMLPATH);
+ path.append(lang);
+
+ //construct help in rom
+ createBuiltInCategory(path);
+
+ //scan other root path and construct 3rd party help
+ foreach(QFileInfo fi, driveList)
+ {
+ path.clear();
+ path.append(fi.absolutePath());
+ path.append(XHTMLPATH);
+ path.append(lang);
+ dir.setPath(path);
+ if(dir.exists())
+ {
+ if(QString::compare(fi.absolutePath(), HelpUtils::rootPath(), Qt::CaseInsensitive) == 0)
+ {
+ continue;
+ }
+ constructAppHelp(path);
+ }
+ }
+}
+
+void HelpDataProvider::createBuiltInCategory(const QString& path)
+{
+ QString pathIndex(path);
+ pathIndex.append(BACKSLASH);
+ pathIndex.append(INDEXXML);
+
+ QFile file(pathIndex);
+ if (!file.open(QIODevice::ReadOnly)) {
+ return;
+ }
+
+ //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)");
+
+ if(!query.isValid())
+ {
+ return;
+ }
+ QStringList strLst;
+ if(!query.evaluateTo(&strLst))
+ {
+ return;
+ }
+
+ foreach(QString str, strLst)
+ {
+ 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);
+ }
+ }
+ file.close();
+ mHelpModel->sort(0, HelpUtils::sortOrder());
+}
+
+HelpStandardItem* HelpDataProvider::constructCategory2(const QString& title, const QString& uid)
+{
+ QString pathIndex(uid);
+ pathIndex.append(BACKSLASH);
+ pathIndex.append(INDEXXML);
+
+ QFile file(pathIndex);
+ if (!file.open(QIODevice::ReadOnly)) {
+ return NULL;
+ }
+
+ //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)");
+ if(!query.isValid())
+ {
+ return NULL;
+ }
+
+ QStringList strLst;
+ if(!query.evaluateTo(&strLst))
+ {
+ return NULL;
+ }
+ if(strLst.count() <= 0)
+ {
+ return NULL;
+ }
+
+ HelpStandardItem* itemParent = NULL;
+ itemParent = new HelpStandardItem(title);
+ itemParent->setData(uid, UidRole);
+ foreach(QString str, strLst)
+ {
+ QStringList temp;
+ temp = str.split(SPECIALCHAR);
+ HelpStandardItem* item = new HelpStandardItem(temp[1]);
+ item->setData(temp[0], HrefRole);
+ itemParent->appendRow(item);
+ }
+
+ file.close();
+ itemParent->sortChildren(0, HelpUtils::sortOrder());
+ return itemParent;
+}
+
+void HelpDataProvider::constructAppHelp(const QString& path)
+{
+ QDir dir(path);
+ if(!dir.exists())
+ {
+ 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;
+ }
+
+ //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();
+ }
+
+ if(itemApp)
+ {
+ itemApp->sortChildren(0, HelpUtils::sortOrder());
+ mHelpModel->appendRow(itemApp);
+ }
+}
+
+void HelpDataProvider::constructKeywordModel(const QString& path)
+{
+ QString pathKeyword(path);
+ pathKeyword.append(BACKSLASH);
+ pathKeyword.append(KEYWORDXML);
+
+ QFile file(pathKeyword);
+ if (!file.open(QIODevice::ReadOnly)) {
+ return;
+ }
+
+ //construct keyword model, title and keyword is one to more
+ QXmlStreamReader reader(&file);
+ QString keyword;
+ QString title;
+
+ while (!reader.atEnd()) {
+ if (!reader.readNextStartElement())
+ {
+ continue;
+ }
+ if (reader.name() == "text")
+ {
+ keyword = reader.readElementText();
+ }
+ else if (reader.name() == "target")
+ {
+ QString href = reader.attributes().value("href").toString();
+ HelpStandardItem* item = findItemWithHref((HelpStandardItem *)(mKeywordModel->invisibleRootItem()), href);
+ QStringList keywordLst;
+ if(item)
+ {
+ keywordLst = item->data(KeywordRole).toStringList();
+ keywordLst.append(keyword);
+ item->setData(keywordLst,KeywordRole);
+ }
+ else
+ {
+ item = new HelpStandardItem(reader.readElementText());
+ item->setData(path, UidRole);
+ item->setData(href, HrefRole);
+
+ keywordLst.append(keyword);
+ item->setData(keywordLst,KeywordRole);
+ mKeywordModel->appendRow(item);
+ }
+ }
+ }
+ file.close();
+ mKeywordModel->sort(0, HelpUtils::sortOrder());
+}
+
+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/HelpDocumentLoader.cpp Fri Apr 16 14:53:45 2010 +0300
@@ -0,0 +1,109 @@
+/*
+* 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 "HelpCategoryView.h"
+#include "HelpContentsView.h"
+#include "BrowserWrapper.h"
+
+#include "HelpDocumentLoader.h"
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+
+class HelpDocumentLoader : public HbDocumentLoader
+{
+private:
+ virtual QObject* createObject(const QString& type, const QString& name);
+};
+
+QObject* HelpDocumentLoader::createObject(const QString& type, const QString& name)
+{
+ if(type == HelpCategoryView::staticMetaObject.className())
+ {
+ QObject* object = new HelpCategoryView;
+ object->setObjectName(name);
+ return object;
+ }
+
+ if(type == HelpContentsView::staticMetaObject.className())
+ {
+ QObject* object = new HelpContentsView;
+ object->setObjectName(name);
+ return object;
+ }
+
+ if(type == BrowserWrapper::staticMetaObject.className())
+ {
+ QObject* object = new BrowserWrapper;
+ object->setObjectName(name);
+ return object;
+ }
+
+ return HbDocumentLoader::createObject(type, name);
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
+
+HbDocumentLoader* gHelpUIBuilderInstance = NULL;
+
+HbDocumentLoader* HelpUIBuilder::instance()
+{
+ if(!gHelpUIBuilderInstance)
+ {
+ gHelpUIBuilderInstance = new HelpDocumentLoader();
+ }
+
+ return gHelpUIBuilderInstance;
+}
+
+void HelpUIBuilder::destroyInstance()
+{
+ delete gHelpUIBuilderInstance;
+ gHelpUIBuilderInstance = NULL;
+}
+
+QObjectList HelpUIBuilder::load(const QString& fileName)
+{
+ bool ok = false;
+ QObjectList list = instance()->load(fileName, &ok);
+ Q_ASSERT_X(ok, "Help", "HelpUIBuilder load file");
+ return list;
+}
+
+QObjectList HelpUIBuilder::load(const QString& fileName, const QString& section)
+{
+ bool ok = false;
+ QObjectList list = instance()->load(fileName, section, &ok);
+ Q_ASSERT_X(ok, "Help", "HelpUIBuilder load section");
+ return list;
+}
+
+QGraphicsWidget* HelpUIBuilder::findWidget(const QString& name)
+{
+ return instance()->findWidget(name);
+}
+
+QObject* HelpUIBuilder::findObject(const QString& name)
+{
+ return instance()->findObject(name);
+}
+
+
+
+// end of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/userguide/src/HelpMainWindow.cpp Fri Apr 16 14:53:45 2010 +0300
@@ -0,0 +1,122 @@
+/*
+* 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 <hbnotificationdialog.h>
+#include <hbaction.h>
+
+#include "HelpCategoryView.h"
+#include "HelpContentsView.h"
+
+#include "HelpMainWindow.h"
+#include "HelpDocumentLoader.h"
+#include "HelpDataProvider.h"
+
+HelpMainWindow::HelpMainWindow() :
+mCategoryView(NULL),
+mContentsView(NULL)
+{
+ activateCategoryView();
+}
+
+HelpMainWindow::~HelpMainWindow()
+{
+ HelpUIBuilder::destroyInstance();
+ HelpDataProvider::destroyInstance();
+}
+
+void HelpMainWindow::onActivateView(HelpViewName viewName)
+{
+ switch(viewName)
+ {
+ case HelpViewCategory:
+ activateCategoryView();
+ break;
+
+ case HelpViewContents:
+ activateContentsView();
+ break;
+
+ default:
+ break;
+ }
+}
+
+void HelpMainWindow::activateCategoryView()
+{
+ if(!mCategoryView)
+ {
+ HelpUIBuilder::load(QRC_DOCML_CATEGORY);
+ mCategoryView = HelpUIBuilder::findWidget<HelpCategoryView*>(DOCML_VIEW_CATEGORY);
+ addView(mCategoryView);
+ mCategoryView->init();
+ emit currentViewChanged(mCategoryView);
+ connectViewSignal(mCategoryView);
+ }
+
+ setCurrentView(mCategoryView);
+}
+
+void HelpMainWindow::activateContentsView()
+{
+ if(!mContentsView)
+ {
+ HelpUIBuilder::load(QRC_DOCML_CONTENTS);
+ mContentsView = HelpUIBuilder::findWidget<HelpContentsView*>(DOCML_VIEW_CONTENTS);
+ addView(mContentsView);
+ mContentsView->init();
+
+ connectViewSignal(mContentsView);
+ }
+
+ setCurrentView(mContentsView);
+}
+
+void HelpMainWindow::connectViewSignal(const QObject *object)
+{
+ connect(object, SIGNAL(activateView(HelpViewName)), this, SLOT(onActivateView(HelpViewName)));
+
+ connect(object, SIGNAL(showAllList()), this, SLOT(onShowAllList()));
+ connect(object, SIGNAL(showFindList()), this, SLOT(onShowFindList()));
+ connect(object, SIGNAL(showOnlineSupport()), this, SLOT(onShowOnlineSupport()));
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////
+// handle view event
+
+void HelpMainWindow::onShowAllList()
+{
+ activateCategoryView();
+ mCategoryView->switchViewMode(HelpCategoryView::ViewModeAll);
+}
+
+void HelpMainWindow::onShowFindList()
+{
+ activateCategoryView();
+ mCategoryView->switchViewMode(HelpCategoryView::ViewModeSearch);
+}
+
+void HelpMainWindow::onShowOnlineSupport()
+{
+ HbNotificationDialog *notificationDialog = new HbNotificationDialog();
+ notificationDialog->setParent(this);
+ notificationDialog->setTitle(URL_LINK_SUPPORT);
+ notificationDialog->show();
+}
+
+// end of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/userguide/src/HelpProxyModel.cpp Fri Apr 16 14:53:45 2010 +0300
@@ -0,0 +1,57 @@
+/*
+* 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 <QStringList>
+#include <QDebug>
+
+#include <hbstringutil.h>
+
+#include "HelpCommon.h"
+#include "HelpProxyModel.h"
+
+HelpProxyModel::HelpProxyModel(QObject * parent):QSortFilterProxyModel(parent)
+{
+}
+
+HelpProxyModel::~HelpProxyModel()
+{
+}
+
+bool HelpProxyModel::filterAcceptsRow(int sourceRow,
+ const QModelIndex &sourceParent) const
+{
+ QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent);
+
+ switch(filterRole())
+ {
+ case KeywordRole:
+ {
+ QStringList keywordLst = sourceModel()->data(index, KeywordRole).toStringList();
+
+ foreach(QString str, keywordLst)
+ {
+ if(HbStringUtil::findC(str, filterRegExp().pattern()) != -1)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+ default:
+ return QSortFilterProxyModel::filterAcceptsRow(sourceRow, sourceParent);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/userguide/src/HelpStandardItem.cpp Fri Apr 16 14:53:45 2010 +0300
@@ -0,0 +1,49 @@
+/*
+* 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 <hbstringutil.h>
+
+#include "HelpCommon.h"
+#include "HelpStandardItem.h"
+
+HelpStandardItem::HelpStandardItem(const QString& text) : QStandardItem(text)
+{
+}
+
+HelpStandardItem::~HelpStandardItem()
+{
+}
+
+bool HelpStandardItem::operator<(const QStandardItem & other) const
+{
+ const int role = model() ? model()->sortRole() : Qt::DisplayRole;
+ switch(role)
+ {
+ case Qt::DisplayRole:
+ if(HbStringUtil::compareC(text(), other.text()) < 0)
+ {
+ return true;
+ }
+ break;
+ case UidRole:
+ case HrefRole:
+ case KeywordRole:
+ default:
+ return QStandardItem::operator<(other);
+ }
+ return false;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/userguide/src/HelpUtils.cpp Fri Apr 16 14:53:45 2010 +0300
@@ -0,0 +1,251 @@
+/*
+* 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 <QFile>
+#include <QMap>
+#include <QLocale>
+
+#include "HelpUtils.h"
+
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifdef Q_OS_SYMBIAN
+
+#include <e32const.h>
+#include <xqappmgr.h>
+#include <EikEnv.h>
+#include <zipfile.h>
+
+void LoadFileFromZipL(const TDesC& aZipName, const TDesC& aFileName, QString& desBuffer)
+ {
+
+ // open the zip file
+ RFs& fs = CEikonEnv::Static()->FsSession();
+ CZipFile* zipFile = CZipFile::NewL(fs, aZipName);
+ CleanupStack::PushL(zipFile);
+ TInt err = zipFile->OpenL();
+
+ if(err == KErrNone)
+ {
+ CZipFileMember* member = zipFile->MemberL(aFileName);
+ if(member) // member exist
+ {
+ CleanupStack::PushL(member);
+
+ RZipFileMemberReaderStream* stream;
+ zipFile->GetInputStreamL(member, stream);
+ CleanupStack::PushL(stream);
+
+ HBufC8* buffer = HBufC8::NewLC(member->UncompressedSize());
+ TPtr8 ptr(buffer->Des());
+ User::LeaveIfError(stream->Read(ptr, member->UncompressedSize()));
+
+ QByteArray byteArray((const char*)buffer->Ptr(), buffer->Length());
+ desBuffer.append(byteArray);
+
+ CleanupStack::PopAndDestroy(buffer);
+ CleanupStack::PopAndDestroy(stream);
+ CleanupStack::PopAndDestroy(member);
+ }
+ }
+
+ zipFile->Close();
+ CleanupStack::PopAndDestroy(zipFile);
+
+ }
+
+void FixPathSlash(TDes& aPath)
+ {
+ for(TInt i=0; i<aPath.Length(); i++)
+ {
+ if(aPath[i] == '/') aPath[i] = '\\';
+ }
+ }
+
+void HelpUtils::loadHtmlFromZipFile(const QString& path, const QString& htmlFile, QString& htmlContent)
+ {
+ TFileName zipNameDes(TPtrC(path.utf16(), path.length()));
+ TFileName subFileDes(TPtrC(htmlFile.utf16(), htmlFile.length()));
+ FixPathSlash(zipNameDes);
+ FixPathSlash(subFileDes);
+
+ htmlContent.clear(); // clear all data
+
+ QT_TRAP_THROWING(LoadFileFromZipL(zipNameDes, subFileDes, htmlContent));
+ }
+
+#endif
+
+QString HelpUtils::rootPath()
+{
+ return QString("z:/");
+}
+
+QString HelpUtils::UILocaleFromQtToSymbian()
+{
+#ifdef Q_OS_SYMBIAN
+
+ static QMap<QString, int> iso_to_symbian_map;
+ iso_to_symbian_map.insert("en_GB" ,ELangEnglish);
+ iso_to_symbian_map.insert("fr_FR" ,ELangFrench);
+ iso_to_symbian_map.insert("de_DE" ,ELangGerman);
+ iso_to_symbian_map.insert("es_ES" ,ELangSpanish);
+ iso_to_symbian_map.insert("it_IT" ,ELangItalian);
+ iso_to_symbian_map.insert("sv_SE" ,ELangSwedish);
+ iso_to_symbian_map.insert("da_DK" ,ELangDanish);
+ iso_to_symbian_map.insert("no_NO" ,ELangNorwegian);
+ iso_to_symbian_map.insert("fi_FI" ,ELangFinnish);
+ iso_to_symbian_map.insert("en_US" ,ELangAmerican);
+ iso_to_symbian_map.insert("fr_CH" ,ELangSwissFrench);
+ iso_to_symbian_map.insert("de_CH" ,ELangSwissGerman);
+ iso_to_symbian_map.insert("pt_PT" ,ELangPortuguese);
+ iso_to_symbian_map.insert("tr_TR" ,ELangTurkish);
+ iso_to_symbian_map.insert("is_IS" ,ELangIcelandic);
+ iso_to_symbian_map.insert("ru_RU" ,ELangRussian);
+ iso_to_symbian_map.insert("hu_HU" ,ELangHungarian);
+ iso_to_symbian_map.insert("nl_NL" ,ELangDutch);
+ iso_to_symbian_map.insert("nl_BE" ,ELangBelgianFlemish);
+ iso_to_symbian_map.insert("en_AU" ,ELangAustralian);
+ iso_to_symbian_map.insert("fr_BE" ,ELangBelgianFrench);
+ iso_to_symbian_map.insert("de_AT" ,ELangAustrian);
+ iso_to_symbian_map.insert("en_NZ" ,ELangNewZealand);
+ iso_to_symbian_map.insert("fr" ,ELangInternationalFrench);
+ iso_to_symbian_map.insert("cs_CZ" ,ELangCzech);
+ iso_to_symbian_map.insert("sk_SK" ,ELangSlovak);
+ iso_to_symbian_map.insert("pl_PL" ,ELangPolish);
+ iso_to_symbian_map.insert("sl_SI" ,ELangSlovenian);
+ iso_to_symbian_map.insert("zh_TW" ,ELangTaiwanChinese);
+ iso_to_symbian_map.insert("zh_HK" ,ELangHongKongChinese);
+ iso_to_symbian_map.insert("zh_CN" ,ELangPrcChinese);
+ iso_to_symbian_map.insert("ja_JP" ,ELangJapanese);
+ iso_to_symbian_map.insert("th_TH" ,ELangThai);
+ iso_to_symbian_map.insert("af" ,ELangAfrikaans);
+ iso_to_symbian_map.insert("sq_AL" ,ELangAlbanian);
+ iso_to_symbian_map.insert("am_ET" ,ELangAmharic);
+ iso_to_symbian_map.insert("ar_AE" ,ELangArabic);
+ iso_to_symbian_map.insert("hy_AM" ,ELangArmenian);
+ iso_to_symbian_map.insert("tl_PH" ,ELangTagalog);
+ iso_to_symbian_map.insert("be_BY" ,ELangBelarussian);
+ iso_to_symbian_map.insert("bn" ,ELangBengali);
+ iso_to_symbian_map.insert("bg_BG" ,ELangBulgarian);
+ iso_to_symbian_map.insert("my_MM" ,ELangBurmese);
+ iso_to_symbian_map.insert("ca_ES" ,ELangCatalan);
+ iso_to_symbian_map.insert("hr_HR" ,ELangCroatian);
+ iso_to_symbian_map.insert("en_CA" ,ELangCanadianEnglish);
+ iso_to_symbian_map.insert( "en" ,ELangInternationalEnglish);
+ iso_to_symbian_map.insert("en_ZA" ,ELangSouthAfricanEnglish);
+ iso_to_symbian_map.insert("et_EE" ,ELangEstonian);
+ iso_to_symbian_map.insert("fa_IR" ,ELangFarsi);
+ iso_to_symbian_map.insert("fr_CA" ,ELangCanadianFrench);
+ iso_to_symbian_map.insert("gd_GB" ,ELangScotsGaelic);
+ iso_to_symbian_map.insert("ka_GE" ,ELangGeorgian);
+ iso_to_symbian_map.insert("el_GR" ,ELangGreek);
+ iso_to_symbian_map.insert("el_GR" ,ELangCyprusGreek);
+ iso_to_symbian_map.insert("gu_IN" ,ELangGujarati);
+ iso_to_symbian_map.insert("he_IL" ,ELangHebrew);
+ iso_to_symbian_map.insert("hi_IN" ,ELangHindi);
+ iso_to_symbian_map.insert("id_ID" ,ELangIndonesian);
+ iso_to_symbian_map.insert("ga_IE" ,ELangIrish);
+ iso_to_symbian_map.insert("it_CH" ,ELangSwissItalian);
+ iso_to_symbian_map.insert("kn_IN" ,ELangKannada);
+ iso_to_symbian_map.insert("kk_KZ" ,ELangKazakh);
+ iso_to_symbian_map.insert("km_KH" ,ELangKhmer);
+ iso_to_symbian_map.insert("ko_KR" ,ELangKorean);
+ iso_to_symbian_map.insert("lo_LA" ,ELangLao);
+ iso_to_symbian_map.insert("lv_LV" ,ELangLatvian);
+ iso_to_symbian_map.insert("lt_LT" ,ELangLithuanian);
+ iso_to_symbian_map.insert("mk_MK" ,ELangMacedonian);
+ iso_to_symbian_map.insert("ms_MY" ,ELangMalay);
+ iso_to_symbian_map.insert("ml_IN" ,ELangMalayalam);
+ iso_to_symbian_map.insert("mr_IN" ,ELangMarathi);
+ iso_to_symbian_map.insert("mo_MD" ,ELangMoldavian);
+ iso_to_symbian_map.insert("mn_MN" ,ELangMongolian);
+ iso_to_symbian_map.insert("nn_NO" ,ELangNorwegianNynorsk);
+ iso_to_symbian_map.insert("pt_BR" ,ELangBrazilianPortuguese);
+ iso_to_symbian_map.insert("pa" ,ELangPunjabi);
+ iso_to_symbian_map.insert("ro_RO" ,ELangRomanian);
+ iso_to_symbian_map.insert("sr_YU" ,ELangSerbian);
+ iso_to_symbian_map.insert("si_LK" ,ELangSinhalese);
+ iso_to_symbian_map.insert("so_SO" ,ELangSomali);
+ iso_to_symbian_map.insert( "es" ,ELangInternationalSpanish);
+ iso_to_symbian_map.insert( "es" ,ELangLatinAmericanSpanish);
+ iso_to_symbian_map.insert("sw" ,ELangSwahili);
+ iso_to_symbian_map.insert("sv_FI" ,ELangFinlandSwedish);
+ iso_to_symbian_map.insert("ta_IN" ,ELangTamil);
+ iso_to_symbian_map.insert("te_IN" ,ELangTelugu);
+ iso_to_symbian_map.insert("bo_CN" ,ELangTibetan);
+ iso_to_symbian_map.insert("ti_ER" ,ELangTigrinya);
+ iso_to_symbian_map.insert("tr_GR" ,ELangCyprusTurkish);
+ iso_to_symbian_map.insert("tk_TM" ,ELangTurkmen);
+ iso_to_symbian_map.insert("uk_UA" ,ELangUkrainian);
+ iso_to_symbian_map.insert("ur_PK" ,ELangUrdu);
+ iso_to_symbian_map.insert("vi_VN" ,ELangVietnamese);
+ iso_to_symbian_map.insert("cy_GB" ,ELangWelsh);
+ iso_to_symbian_map.insert("zu_ZA" ,ELangZulu);
+ iso_to_symbian_map.insert("st_LS" ,ELangSouthSotho);
+ iso_to_symbian_map.insert("eu_ES" ,ELangBasque);
+ iso_to_symbian_map.insert("gl_ES" ,ELangGalician);
+ iso_to_symbian_map.insert("en" ,ELangEnglish_Apac);
+ iso_to_symbian_map.insert("en_TW" ,ELangEnglish_Taiwan);
+ iso_to_symbian_map.insert("en_HK" ,ELangEnglish_HongKong);
+ iso_to_symbian_map.insert("en_CN" ,ELangEnglish_Prc);
+ iso_to_symbian_map.insert("en_JP" ,ELangEnglish_Japan);
+ iso_to_symbian_map.insert("en_TH" ,ELangEnglish_Thailand);
+ iso_to_symbian_map.insert("ms" ,ELangMalay_Apac);
+
+ QString langName = QLocale::system().name();
+ return QString("%1").arg(iso_to_symbian_map.value(langName),2,10,QChar('0'));
+#else
+ return QString("%1").arg(1,2,10,QChar('0'));
+#endif
+}
+
+int HelpUtils::launchApplication(const QString& appUid)
+{
+#ifdef Q_OS_SYMBIAN
+
+ QString uriStr("appto://");
+ uriStr.append(appUid);
+ QUrl uri(uriStr);
+
+ XQApplicationManager appmgr;
+ XQAiwRequest* req5 = appmgr.create(uri, false);
+
+ QList<QVariant> args;
+ args << uri.encodedQuery();
+ req5->setArguments(args);
+
+ if (!req5->send())
+ {
+ return req5->lastError();
+ }
+#endif
+ return 0;
+}
+
+Qt::Orientation HelpUtils::defaultOrientation()
+{
+ return Qt::Vertical;
+}
+
+Qt::SortOrder HelpUtils::sortOrder()
+{
+ return Qt::AscendingOrder;
+}
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/userguide/src/HelpUtils_win.cpp Fri Apr 16 14:53:45 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* 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 "HelpUtils.h"
+
+void HelpUtils::loadHtmlFromZipFile(const QString& path, const QString& htmlFile, QString& htmlContent)
+{
+ Q_UNUSED(path);
+ Q_UNUSED(htmlFile);
+ Q_UNUSED(htmlContent);
+ return;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/userguide/src/main.cpp Fri Apr 16 14:53:45 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* 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 <QTranslator>
+#include <QtGlobal>
+#include <qlocale.h>
+
+#include <hbapplication.h>
+
+#include "HelpCommon.h"
+#include "HelpMainWindow.h"
+
+int main(int argc, char *argv[])
+{
+ HbApplication app(argc, argv);
+
+ QString lang = QLocale::system().name();
+
+ // init translator with current system language
+ QTranslator* translatorCommon = new QTranslator();
+ translatorCommon->load("common_"+lang, PATH_TRANSLATIONS);
+ qApp->installTranslator(translatorCommon);
+
+ QTranslator* translatorSelf = new QTranslator();
+ translatorSelf->load("userguide_"+lang, PATH_TRANSLATIONS);
+ qApp->installTranslator(translatorSelf);
+
+ app.setApplicationName(hbTrId(TXT_TITLE));
+
+ HelpMainWindow mainWindow;
+ mainWindow.show();
+
+ return app.exec();
+}
+
+// end of file