# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1273840972 -10800 # Node ID 3752719124563d43b538d7e0e2596ab71c130683 # Parent c0dfc135a46c7018557db5f05296b5fa119911a4 Revision: 201017 Kit: 201019 diff -r c0dfc135a46c -r 375271912456 userguide/Userguide.pro --- a/userguide/Userguide.pro Mon May 03 12:24:47 2010 +0300 +++ b/userguide/Userguide.pro Fri May 14 15:42:52 2010 +0300 @@ -36,7 +36,9 @@ inc/HelpDataProvider.h \ inc/HelpUtils.h \ inc/HelpProxyModel.h \ - inc/HelpStandardItem.h + inc/HelpStandardItem.h \ + inc/HelpKeywordView.h \ + inc/HelpBaseView.h SOURCES += src/main.cpp \ src/HelpMainWindow.cpp \ @@ -47,7 +49,9 @@ src/HelpDataProvider.cpp \ src/HelpUtils.cpp \ src/HelpProxyModel.cpp \ - src/HelpStandardItem.cpp + src/HelpStandardItem.cpp \ + src/HelpKeywordView.cpp \ + src/HelpBaseView.cpp symbian { TARGET.UID3 = 0x10005234 diff -r c0dfc135a46c -r 375271912456 userguide/inc/HelpBaseView.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/userguide/inc/HelpBaseView.h Fri May 14 15:42:52 2010 +0300 @@ -0,0 +1,62 @@ +/* +* 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 HELPBATHVIEW_H +#define HELPBATHVIEW_H + +#include + +#include "HelpCommon.h" +#include "HelpDocumentLoader.h" + +class HbToolBar; + +class HelpBaseView : public HbView +{ + Q_OBJECT + +public: + HelpBaseView(); + ~HelpBaseView(); + +signals: + void activateView(HelpViewName viewName); + +signals: // from tollbar event + void showAllList(); + void showFindList(); + +private slots: // handle tollbar event + void onToolbarAll() { emit showAllList(); }; + void onToolbarFind() { emit showFindList(); }; + void onToolbarOnlineSupport(); + +private slots: + void onOrientationChanged(Qt::Orientation orientation); + +protected: + void initBaseDocMl(); + +protected: + HelpUIBuilder mBuilder; + HbToolBar* mToolBar; + +private: + void RefreshToolbarText(Qt::Orientation orientation); +}; + +#endif //HELPBATHVIEW_H diff -r c0dfc135a46c -r 375271912456 userguide/inc/HelpCategoryView.h --- a/userguide/inc/HelpCategoryView.h Mon May 03 12:24:47 2010 +0300 +++ b/userguide/inc/HelpCategoryView.h Fri May 14 15:42:52 2010 +0300 @@ -18,19 +18,14 @@ #ifndef HELPCATEGORYVIEW_H #define HELPCATEGORYVIEW_H -#include +#include -#include "HelpCommon.h" #include "HelpDocumentLoader.h" class HbTreeView; -class HbListView; -class HbSearchPanel; class QStandardItem; -class HbStaticVkbHost; -class HbGroupBox; -class HelpCategoryView : public HbView +class HelpCategoryView : public HelpBaseView { Q_OBJECT @@ -42,64 +37,20 @@ private: void initDocMl(); void initAllList(); - void initSearchList(); - void initSearchPanel(); - void initBackAction(); - void initEmptyLabel(); - void initVirtualKeyboard(); - -private: - HbGroupBox* groupBox(); - -public: - enum ViewMode - { - ViewModeNull = 0, - ViewModeAll, - ViewModeSearch - }; - void switchViewMode(ViewMode viewMode); - -signals: - void activateView(HelpViewName viewName); - -private: - void updateVisibleItems(bool visible); - void ResetSearchPanel(); private: void expandCollapseAllList(QStandardItem* item, bool expand); - -private slots: // handle system event - void onCurrentViewChanged(HbView *view); - -private slots: // handle button action - void onBackAction(); + void updateExpandCollapseAction(bool expand); 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 slots: - void onExpandAll(); - void onCollapseAll(); - -private slots: // handle virtual keyboard event - void onHandleKeypadOpen(); - void onHandleKeypadClose(); +private slots: // handle menu event + void onExpandOrCollapseAll(); private: - ViewMode mViewMode; - HbTreeView* mListAll; - HbListView* mListSearch; - HbSearchPanel* mSearchPanel; - HbAction* mSoftKeyAction; - HbStaticVkbHost* mVirtualKeyboard; - HelpUIBuilder mBuilder; + HbTreeView* mListAll; + int mExpandCount; }; #endif //HELPCATEGORYVIEW_H diff -r c0dfc135a46c -r 375271912456 userguide/inc/HelpCommon.h --- a/userguide/inc/HelpCommon.h Mon May 03 12:24:47 2010 +0300 +++ b/userguide/inc/HelpCommon.h Fri May 14 15:42:52 2010 +0300 @@ -50,29 +50,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,7 +84,9 @@ enum HelpViewName { HelpViewCategory = 0, - HelpViewContents + HelpViewKeyword, + HelpViewContents, + PreviousView = 100 }; enum HelpItemRole diff -r c0dfc135a46c -r 375271912456 userguide/inc/HelpContentsView.h --- a/userguide/inc/HelpContentsView.h Mon May 03 12:24:47 2010 +0300 +++ b/userguide/inc/HelpContentsView.h Fri May 14 15:42:52 2010 +0300 @@ -20,14 +20,13 @@ #include -#include +#include -#include "HelpCommon.h" #include "HelpDocumentLoader.h" class BrowserWrapper; -class HelpContentsView : public HbView +class HelpContentsView : public HelpBaseView { Q_OBJECT @@ -40,11 +39,8 @@ private: void initDocMl(); - void initBackAction(); - -signals: - void activateView(HelpViewName viewName); - + void initBackAction(); + private: bool openApplication(const QUrl& url); bool openExternalLink(const QUrl& url); @@ -63,7 +59,6 @@ private: BrowserWrapper* mBrowser; HbAction* mSoftKeyAction; - HelpUIBuilder mBuilder; }; #endif //HELPCONTENTSVIEW_H diff -r c0dfc135a46c -r 375271912456 userguide/inc/HelpKeywordView.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/userguide/inc/HelpKeywordView.h Fri May 14 15:42:52 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 + +#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 onCurrentViewChanged(HbView *view); + +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 diff -r c0dfc135a46c -r 375271912456 userguide/inc/HelpMainWindow.h --- a/userguide/inc/HelpMainWindow.h Mon May 03 12:24:47 2010 +0300 +++ b/userguide/inc/HelpMainWindow.h Fri May 14 15:42:52 2010 +0300 @@ -23,9 +23,10 @@ #include "HelpCommon.h" #include "HelpDocumentLoader.h" +class HelpBaseView; class HelpCategoryView; +class HelpKeywordView; class HelpContentsView; -class HbToolBar; class HelpMainWindow : public HbMainWindow { @@ -40,30 +41,21 @@ private: // activate views void activateCategoryView(); + void activateKeywordView(); void activateContentsView(); - void initToolbar(); - void RefreshToolbarText(Qt::Orientation orientation); private: - void connectViewSignal(const QObject *object); + void connectViewSignal(const HelpBaseView *view); -signals: - void backActionSignal(); - -private slots: // handle tollbar event - void onToolbarAll(); - void onToolbarFind(); - void onToolbarOnlineSupport(); - -private slots: - void onOrientationChanged(Qt::Orientation orientation); +private slots: // handle view event + void onShowAllList(); + void onShowFindList(); private: HelpCategoryView* mCategoryView; + HelpKeywordView* mKeywordView; HelpContentsView* mContentsView; - HbToolBar* mToolBar; - HelpUIBuilder mBuilder; - + HelpViewName mPreviousViewName; }; #endif //HELPMAINWINDOW_H diff -r c0dfc135a46c -r 375271912456 userguide/resources/Userguide.qrc --- a/userguide/resources/Userguide.qrc Mon May 03 12:24:47 2010 +0300 +++ b/userguide/resources/Userguide.qrc Fri May 14 15:42:52 2010 +0300 @@ -2,8 +2,9 @@ xml/categoryView.docml + xml/keywordView.docml xml/contentsView.docml - xml/toolbar.docml + xml/baseView.docml diff -r c0dfc135a46c -r 375271912456 userguide/resources/xml/baseView.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/userguide/resources/xml/baseView.docml Fri May 14 15:42:52 2010 +0300 @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r c0dfc135a46c -r 375271912456 userguide/resources/xml/categoryView.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/userguide/resources/xml/categoryView.docml Fri May 14 15:42:52 2010 +0300 @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r c0dfc135a46c -r 375271912456 userguide/resources/xml/contentsView.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/userguide/resources/xml/contentsView.docml Fri May 14 15:42:52 2010 +0300 @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff -r c0dfc135a46c -r 375271912456 userguide/resources/xml/keywordView.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/userguide/resources/xml/keywordView.docml Fri May 14 15:42:52 2010 +0300 @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
diff -r c0dfc135a46c -r 375271912456 userguide/resources/xml/toolbar.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/userguide/resources/xml/toolbar.docml Fri May 14 15:42:52 2010 +0300 @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r c0dfc135a46c -r 375271912456 userguide/src/BrowserWrapper.cpp --- a/userguide/src/BrowserWrapper.cpp Mon May 03 12:24:47 2010 +0300 +++ b/userguide/src/BrowserWrapper.cpp Fri May 14 15:42:52 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); diff -r c0dfc135a46c -r 375271912456 userguide/src/HelpBaseView.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/userguide/src/HelpBaseView.cpp Fri May 14 15:42:52 2010 +0300 @@ -0,0 +1,78 @@ +/* +* 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 +#include +#include + +#include "HelpBaseView.h" + +////////////////////////////////////////////////////////////////////////////////////////////// + +HelpBaseView::HelpBaseView() +{ +} + +HelpBaseView::~HelpBaseView() +{ +} + + +//////////////////////////////////////////////////////////////////////////////////////////// + +void HelpBaseView::initBaseDocMl() +{ + // Create widget hierarchy + setObjectName( DOCML_VIEW_NAME ); + + // 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); + + mBuilder.load(QRC_DOCML_BASE); +} + +void HelpBaseView::onToolbarOnlineSupport() +{ + HbNotificationDialog *notificationDialog = new HbNotificationDialog(); + notificationDialog->setParent(this); + notificationDialog->setTitle(URL_LINK_SUPPORT); + notificationDialog->show(); +} + +void HelpBaseView::onOrientationChanged(Qt::Orientation orientation) +{ + RefreshToolbarText(orientation); +} + +void HelpBaseView::RefreshToolbarText(Qt::Orientation orientation) +{ + bool isLandscape = (Qt::Horizontal==orientation); + HbAction* tollbarAction = mBuilder.findObject(DOCML_ACTION_ALL); + tollbarAction->setText(isLandscape ? qtTrId(TXT_BUTTON_ALL) : QString()); + + tollbarAction = mBuilder.findObject(DOCML_ACTION_SEARCH); + tollbarAction->setText(isLandscape ? qtTrId(TXT_BUTTON_FIND) : QString()); + + tollbarAction = mBuilder.findObject(DOCML_ACTION_LINK_NOKIA); + tollbarAction->setText(isLandscape ? qtTrId(TXT_BUTTON_LINK_SUPPORT) : QString()); +} + +// end of file diff -r c0dfc135a46c -r 375271912456 userguide/src/HelpCategoryView.cpp --- a/userguide/src/HelpCategoryView.cpp Mon May 03 12:24:47 2010 +0300 +++ b/userguide/src/HelpCategoryView.cpp Fri May 14 15:42:52 2010 +0300 @@ -21,20 +21,12 @@ #include #include #include -#include -#include #include -#include -#include #include -#include #include -#include -#include #include "HelpDataProvider.h" -#include "HelpProxyModel.h" #include "HelpCategoryView.h" @@ -42,10 +34,8 @@ ////////////////////////////////////////////////////////////////////////////////////////////// HelpCategoryView::HelpCategoryView() : -mViewMode(ViewModeNull), -mListAll(NULL), -mListSearch(NULL), -mSearchPanel(NULL) +mListAll(NULL), +mExpandCount(0) { } @@ -59,39 +49,15 @@ void HelpCategoryView::init() { initDocMl(); - initBackAction(); initAllList(); - initSearchList(); - initSearchPanel(); - initVirtualKeyboard(); - initEmptyLabel(); - - switchViewMode(ViewModeAll); - - connect(mainWindow(), SIGNAL(currentViewChanged(HbView*)), this, SLOT(onCurrentViewChanged(HbView*))); } void HelpCategoryView::initDocMl() { - // Create widget hierarchy - setObjectName( DOCML_VIEW_CATEGORY ); - - // 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_CATEGORY); } -void HelpCategoryView::initBackAction() -{ - mSoftKeyAction = new HbAction(Hb::BackAction); - connect(mSoftKeyAction, SIGNAL(triggered()), this, SLOT(onBackAction())); -} - void HelpCategoryView::initAllList() { mListAll = mBuilder.findWidget(DOCML_LIST_CATEGORY_ALL); @@ -100,57 +66,6 @@ connect(mListAll, SIGNAL(activated(const QModelIndex&)), this, SLOT(onAllListActivated(const QModelIndex&))); } -void HelpCategoryView::initSearchList() -{ - mListSearch = mBuilder.findWidget(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 = mBuilder.findWidget(DOCML_SEARCH_PANEL_CATEGORY); - connect(mSearchPanel, SIGNAL(exitClicked()), this, SLOT(onSearchPanelExitClicked())); - connect(mSearchPanel, SIGNAL(criteriaChanged(const QString&)), this, SLOT(onSearchPanelCriteriaChanged(const QString&))); -} - -void HelpCategoryView::initVirtualKeyboard() -{ - mVirtualKeyboard = new HbStaticVkbHost(this); - connect(mVirtualKeyboard, SIGNAL(keypadOpened()), this, SLOT(onHandleKeypadOpen())); - connect(mVirtualKeyboard, SIGNAL(keypadClosed()), this, SLOT(onHandleKeypadClose())); -} - -void HelpCategoryView::initEmptyLabel() -{ - HbLabel* label = mBuilder.findWidget(DOCML_NO_MATCH_LABEL); - label->setFontSpec(HbFontSpec(HbFontSpec::Primary)); -} - -HbGroupBox* HelpCategoryView::groupBox() -{ - return mBuilder.findWidget(DOCML_GROUPBOX); -} - -//////////////////////////////////////////////////////////////////////////////////////////// - -void HelpCategoryView::switchViewMode(ViewMode viewMode) -{ - if(ViewModeNull == viewMode) return; - - mViewMode = viewMode; - if(ViewModeAll == viewMode) - { - mBuilder.load(QRC_DOCML_CATEGORY, DOCML_LAYOUT_CATEGORY_ALL); - toolBar()->show(); - } - else if(ViewModeSearch == viewMode) - { -// mBuilder.load(QRC_DOCML_CATEGORY, DOCML_LAYOUT_CATEGORY_SEARCH); - ResetSearchPanel(); - } -} - //////////////////////////////////////////////////////////////////////////////////////////// void HelpCategoryView::expandCollapseAllList(QStandardItem* item, bool expand) @@ -166,66 +81,13 @@ } } -//////////////////////////////////////////////////////////////////////////////////////////// - -void HelpCategoryView::updateVisibleItems(bool visible) -{ - static Hb::SceneItems items = Hb::TitleBarItem | Hb::StatusBarItem; - if(visible) - { - showItems(items); - } - else - { - hideItems(items); - } -} - -void HelpCategoryView::ResetSearchPanel() +void HelpCategoryView::updateExpandCollapseAction(bool expand) { - foreach(QGraphicsItem *obj, mSearchPanel->childItems()) - { - QGraphicsWidget *const widget = static_cast(obj); - if(widget != NULL) - { - HbLineEdit *const lineEdit = qobject_cast(widget); - if(lineEdit != NULL) - { - lineEdit->setText(""); - break; - } - } - } + HbAction* allAction = mBuilder.findObject(DOCML_ACTION_EXPAND_COLLAPSE_ALL); + allAction->setText(expand ? hbTrId(TXT_EXPAND_ALL) : hbTrId(TXT_COLLAPSE_ALL)); } //////////////////////////////////////////////////////////////////////////////////////////// -// handle system event - -void HelpCategoryView::onCurrentViewChanged(HbView *view) -{ - if(this == view) - { - setNavigationAction(mSoftKeyAction); - } -} - -/////////////////////////////////////////////////////////////////////////////////////// -// handle button back action - -void HelpCategoryView::onBackAction() -{ - if(ViewModeSearch == mViewMode) - { - switchViewMode(ViewModeAll); - } - else - { - HbApplication::exit(); - } -} - - -//////////////////////////////////////////////////////////////////////////////////////////// // handle list event void HelpCategoryView::onAllListActivated(const QModelIndex& index) @@ -233,6 +95,20 @@ if(!index.isValid() || // invalid index.child(0,0).isValid()) // this is a node { + if(index.parent().isValid()) + { + return; + } + + if(mListAll->isExpanded(index)) + { + mExpandCount++; + } + else + { + mExpandCount--; + } + updateExpandCollapseAction(mExpandCount == 0); return; } @@ -242,96 +118,15 @@ emit activateView(HelpViewContents); } -void HelpCategoryView::onSearchListActivated(const QModelIndex& index) +//////////////////////////////////////////////////////////////////////////////////////////// +// handle menu event +void HelpCategoryView::onExpandOrCollapseAll() { - 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() -{ - if(mListSearch->model()->rowCount() == 0) - { - mBuilder.load(QRC_DOCML_CATEGORY, DOCML_LAYOUT_CATEGORY_SEARCH_NO_SRHPAL_NO_MATCH); - } - else - { - mBuilder.load(QRC_DOCML_CATEGORY, DOCML_LAYOUT_CATEGORY_SEARCH_NO_SRHPAL); - } - toolBar()->show(); + bool needExpand = (mExpandCount == 0); + QStandardItemModel* model = (QStandardItemModel*)(mListAll->model()); + expandCollapseAllList(model->invisibleRootItem(),needExpand); + mExpandCount = needExpand ? model->invisibleRootItem()->rowCount() : 0; + updateExpandCollapseAction(mExpandCount == 0); } -void HelpCategoryView::onSearchPanelCriteriaChanged(const QString &criteria) -{ - HelpDataProvider::instance()->getSearchData(criteria); - if(mListSearch->model()->rowCount() == 0) - { - mBuilder.load(QRC_DOCML_CATEGORY, DOCML_LAYOUT_CATEGORY_SEARCH_NO_MATCH); - } - else - { - mBuilder.load(QRC_DOCML_CATEGORY, DOCML_LAYOUT_CATEGORY_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 HelpCategoryView::onHandleKeypadOpen() -{ - updateVisibleItems(false); - qreal heightToSet = mainWindow()->layoutRect().height() - mVirtualKeyboard->keyboardArea().height(); - this->setMaximumHeight(heightToSet); -} - -void HelpCategoryView::onHandleKeypadClose() -{ - updateVisibleItems(true); - qreal mainHeight = mainWindow()->layoutRect().height(); - qreal toolbarHeight = toolBar()->size().height(); - qreal height = mainHeight - (toolBar()->isVisible() ? toolbarHeight : 0); - this->setMaximumHeight(height); -} - -//////////////////////////////////////////////////////////////////////////////////////////// -// handle menu event -void HelpCategoryView::onExpandAll() -{ - QStandardItemModel* model = (QStandardItemModel*)(mListAll->model()); - expandCollapseAllList(model->invisibleRootItem(),true); -} - -void HelpCategoryView::onCollapseAll() -{ - QStandardItemModel* model = (QStandardItemModel*)(mListAll->model()); - expandCollapseAllList(model->invisibleRootItem(),false); -} - - // end of file diff -r c0dfc135a46c -r 375271912456 userguide/src/HelpContentsView.cpp --- a/userguide/src/HelpContentsView.cpp Mon May 03 12:24:47 2010 +0300 +++ b/userguide/src/HelpContentsView.cpp Fri May 14 15:42:52 2010 +0300 @@ -51,22 +51,13 @@ 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())); } @@ -112,7 +103,7 @@ QString html; QString baseUrl = url.toString(); HelpDataProvider::instance()->getHelpContentData(html, baseUrl); - mBrowser->setHtml(html, baseUrl); + mBrowser->setHtml(html, baseUrl); } //////////////////////////////////////////////////////////////////////////////////////////// @@ -121,6 +112,7 @@ { if(this == view) { + setVisible(true); setNavigationAction(mSoftKeyAction); openHelpContent(); } @@ -140,7 +132,7 @@ } else { - emit activateView(HelpViewCategory); + emit activateView(PreviousView); } } diff -r c0dfc135a46c -r 375271912456 userguide/src/HelpDataProvider.cpp --- a/userguide/src/HelpDataProvider.cpp Mon May 03 12:24:47 2010 +0300 +++ b/userguide/src/HelpDataProvider.cpp Fri May 14 15:42:52 2010 +0300 @@ -217,7 +217,6 @@ if(item) { mHelpModel->appendRow(item); -// constructKeywordModel(uid); } } file.close(); @@ -322,10 +321,9 @@ { if(!itemApp) { - itemApp = new HelpStandardItem("Applications"); + itemApp = new HelpStandardItem(qtTrId(TXT_APPLICATIONS)); } itemApp->appendRow(item); -// constructKeywordModel(pathTemp); } file.close(); } diff -r c0dfc135a46c -r 375271912456 userguide/src/HelpDocumentLoader.cpp --- a/userguide/src/HelpDocumentLoader.cpp Mon May 03 12:24:47 2010 +0300 +++ b/userguide/src/HelpDocumentLoader.cpp Fri May 14 15:42:52 2010 +0300 @@ -32,7 +32,7 @@ object->setObjectName(name); return object; } - + return HbDocumentLoader::createObject(type, name); } diff -r c0dfc135a46c -r 375271912456 userguide/src/HelpKeywordView.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/userguide/src/HelpKeywordView.cpp Fri May 14 15:42:52 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 +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#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(currentViewChanged(HbView*)), this, SLOT(onCurrentViewChanged(HbView*))); +} + +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(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(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(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(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(obj); + if(widget != NULL) + { + HbLineEdit *const lineEdit = qobject_cast(widget); + if(lineEdit != NULL) + { + lineEdit->setText(""); + break; + } + } + } +} + +//////////////////////////////////////////////////////////////////////////////////////////// +// handle system event + +void HelpKeywordView::onCurrentViewChanged(HbView *view) +{ + if(this == view) + { + setVisible(true); + 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 diff -r c0dfc135a46c -r 375271912456 userguide/src/HelpMainWindow.cpp --- a/userguide/src/HelpMainWindow.cpp Mon May 03 12:24:47 2010 +0300 +++ b/userguide/src/HelpMainWindow.cpp Fri May 14 15:42:52 2010 +0300 @@ -19,7 +19,9 @@ #include #include +#include "HelpBaseView.h" #include "HelpCategoryView.h" +#include "HelpKeywordView.h" #include "HelpContentsView.h" #include "HelpMainWindow.h" @@ -27,10 +29,9 @@ HelpMainWindow::HelpMainWindow() : mCategoryView(NULL), +mKeywordView(NULL), mContentsView(NULL) { - connect(this, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(onOrientationChanged(Qt::Orientation))); - initToolbar(); activateCategoryView(); } @@ -39,20 +40,6 @@ HelpDataProvider::destroyInstance(); } -void HelpMainWindow::initToolbar() -{ - mBuilder.load(QRC_DOCML_TOOLBAR); - mToolBar = mBuilder.findWidget(DOCML_TOOLBAR); - - HbAction* allAction = mBuilder.findObject(DOCML_ACTION_ALL); - HbAction* findAction = mBuilder.findObject(DOCML_ACTION_SEARCH); - HbAction* onLineSupportAction = mBuilder.findObject(DOCML_ACTION_LINK_NOKIA); - - connect(allAction, SIGNAL(triggered()), this, SLOT(onToolbarAll())); - connect(findAction, SIGNAL(triggered()), this, SLOT(onToolbarFind())); - connect(onLineSupportAction, SIGNAL(triggered()), this, SLOT(onToolbarOnlineSupport())); -} - void HelpMainWindow::onActivateView(HelpViewName viewName) { switch(viewName) @@ -60,11 +47,17 @@ case HelpViewCategory: activateCategoryView(); break; - + case HelpViewKeyword: + activateKeywordView(); + break; case HelpViewContents: activateContentsView(); break; - + case PreviousView: + { + onActivateView(mPreviousViewName); + } + break; default: break; } @@ -77,74 +70,63 @@ mCategoryView = new HelpCategoryView(); addView(mCategoryView); mCategoryView->init(); - mCategoryView->setToolBar(mToolBar); emit currentViewChanged(mCategoryView); connectViewSignal(mCategoryView); } + mPreviousViewName = HelpViewCategory; setCurrentView(mCategoryView); } +void HelpMainWindow::activateKeywordView() +{ + if(!mKeywordView) + { + mKeywordView = new HelpKeywordView(); + addView(mKeywordView); + mKeywordView->init(); + connectViewSignal(mKeywordView); + } + + mPreviousViewName = HelpViewKeyword; + setCurrentView(mKeywordView); +} + void HelpMainWindow::activateContentsView() { if(!mContentsView) { mContentsView = new HelpContentsView(); - addView(mContentsView); + addView(mContentsView); mContentsView->init(); - mContentsView->setToolBar(mToolBar); connectViewSignal(mContentsView); } - setCurrentView(mContentsView); } -void HelpMainWindow::connectViewSignal(const QObject *object) +void HelpMainWindow::connectViewSignal(const HelpBaseView *view) { - connect(object, SIGNAL(activateView(HelpViewName)), this, SLOT(onActivateView(HelpViewName))); + connect(this, SIGNAL(orientationChanged(Qt::Orientation)), view, SLOT(onOrientationChanged(Qt::Orientation))); + connect(view, SIGNAL(activateView(HelpViewName)), this, SLOT(onActivateView(HelpViewName))); + + connect(view, SIGNAL(showAllList()), this, SLOT(onShowAllList())); + connect(view, SIGNAL(showFindList()), this, SLOT(onShowFindList())); } //////////////////////////////////////////////////////////////////////////////////// // handle view event -void HelpMainWindow::onToolbarAll() +void HelpMainWindow::onShowAllList() { activateCategoryView(); - mCategoryView->switchViewMode(HelpCategoryView::ViewModeAll); -} - -void HelpMainWindow::onToolbarFind() -{ - activateCategoryView(); - mCategoryView->switchViewMode(HelpCategoryView::ViewModeSearch); } -void HelpMainWindow::onToolbarOnlineSupport() -{ - HbNotificationDialog *notificationDialog = new HbNotificationDialog(); - notificationDialog->setParent(this); - notificationDialog->setTitle(URL_LINK_SUPPORT); - notificationDialog->show(); -} - -void HelpMainWindow::onOrientationChanged(Qt::Orientation orientation) -{ - RefreshToolbarText(orientation); -} - -void HelpMainWindow::RefreshToolbarText(Qt::Orientation orientation) -{ - bool isLandscape = (Qt::Horizontal==orientation); - HbAction* tollbarAction = mBuilder.findObject(DOCML_ACTION_ALL); - tollbarAction->setText(isLandscape ? qtTrId(TXT_BUTTON_ALL) : QString()); - - tollbarAction = mBuilder.findObject(DOCML_ACTION_SEARCH); - tollbarAction->setText(isLandscape ? qtTrId(TXT_BUTTON_FIND) : QString()); - - tollbarAction = mBuilder.findObject(DOCML_ACTION_LINK_NOKIA); - tollbarAction->setText(isLandscape ? qtTrId(TXT_BUTTON_LINK_SUPPORT) : QString()); +void HelpMainWindow::onShowFindList() +{ + activateKeywordView(); + mKeywordView->loadAllContent(); } // end of file