# HG changeset patch # User hgs # Date 1275993247 -28800 # Node ID 97d7f0705d0aa4e29f62b08b41e610bc537416fa # Parent 57d77d90783b57782baaed59cb38ce2ceaf5c94f 201023 diff -r 57d77d90783b -r 97d7f0705d0a userguide/Userguide.pro --- a/userguide/Userguide.pro Tue Jun 01 23:20:16 2010 +0300 +++ b/userguide/Userguide.pro Tue Jun 08 18:34:07 2010 +0800 @@ -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,13 +49,17 @@ 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 TARGET.CAPABILITY = CAP_APPLICATION TARGET.EPOCHEAPSIZE = 0x020000 0x1000000 + CONFIG += mobility + MOBILITY = systeminfo LIBS += -lezip -lxqservice -lxqserviceutil include(rom/userguide.pri) } diff -r 57d77d90783b -r 97d7f0705d0a userguide/inc/HelpBaseView.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/userguide/inc/HelpBaseView.h Tue Jun 08 18:34:07 2010 +0800 @@ -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(); + +protected slots: + virtual void onOrientationChanged(Qt::Orientation orientation); + +protected: + void initBaseDocMl(); + +protected: + HelpUIBuilder mBuilder; + HbToolBar* mToolBar; + +private: + void RefreshToolbarText(Qt::Orientation orientation); +}; + +#endif //HELPBATHVIEW_H diff -r 57d77d90783b -r 97d7f0705d0a userguide/inc/HelpDataProvider.h --- a/userguide/inc/HelpDataProvider.h Tue Jun 01 23:20:16 2010 +0300 +++ b/userguide/inc/HelpDataProvider.h Tue Jun 08 18:34:07 2010 +0800 @@ -61,7 +61,7 @@ //parse xml void parseCategoryIndexXml(const QString& path, QStringList& uidList, QStringList& titleList); void parseCategory2IndexXml(const QString& path, QStringList& hrefList, QStringList& titleList); - void parseBuiltInMetaxml(const QString& path, int& featureId, int& priority); + void parseBuiltInMetaxml(const QString& path, int& priority); void parseAppMetaxml(const QString& path, QString& title); private: diff -r 57d77d90783b -r 97d7f0705d0a userguide/inc/HelpKeywordView.h --- a/userguide/inc/HelpKeywordView.h Tue Jun 01 23:20:16 2010 +0300 +++ b/userguide/inc/HelpKeywordView.h Tue Jun 08 18:34:07 2010 +0800 @@ -25,7 +25,7 @@ class HbListView; class HbSearchPanel; class HbStaticVkbHost; -class HbGroupBox; +class HbLabel; class HelpKeywordView : public HelpBaseView { @@ -42,15 +42,18 @@ void initSearchList(); void initSearchPanel(); void initBackAction(); - void initEmptyLabel(); void initVirtualKeyboard(); - + private: - HbGroupBox* groupBox(); + void onOrientationChanged(Qt::Orientation orientation); + +private: + HbLabel* label(); private: void updateVisibleItems(bool visible); void ResetSearchPanel(); + void updateLabelPos(); private slots: // handle system event void onViewReady(); diff -r 57d77d90783b -r 97d7f0705d0a userguide/inc/HelpMainWindow.h --- a/userguide/inc/HelpMainWindow.h Tue Jun 01 23:20:16 2010 +0300 +++ b/userguide/inc/HelpMainWindow.h Tue Jun 08 18:34:07 2010 +0800 @@ -23,9 +23,10 @@ #include "HelpCommon.h" #include "HelpDocumentLoader.h" +class HelpBaseView; class HelpCategoryView; +class HelpKeywordView; class HelpContentsView; -class HbToolBar; class HelpMainWindow : public HbMainWindow { @@ -37,33 +38,25 @@ private slots: void onActivateView(HelpViewName viewName); + void saveActivity(); 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 57d77d90783b -r 97d7f0705d0a userguide/inc/HelpUtils.h --- a/userguide/inc/HelpUtils.h Tue Jun 01 23:20:16 2010 +0300 +++ b/userguide/inc/HelpUtils.h Tue Jun 08 18:34:07 2010 +0800 @@ -25,6 +25,7 @@ public: static void loadHtmlFromZipFile(const QString& path, const QString& htmlFile, QString& htmlContent); static int launchApplication(const QString& appUid); + static bool suppportFeatureID(int featureID); static QString rootPath(); static QString UILocaleFromQtToSymbian(); static Qt::Orientation defaultOrientation(); diff -r 57d77d90783b -r 97d7f0705d0a userguide/resources/xml/keywordView.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/userguide/resources/xml/keywordView.docml Tue Jun 08 18:34:07 2010 +0800 @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + +
+ + + + + + + + +
diff -r 57d77d90783b -r 97d7f0705d0a userguide/src/HelpDataProvider.cpp --- a/userguide/src/HelpDataProvider.cpp Tue Jun 01 23:20:16 2010 +0300 +++ b/userguide/src/HelpDataProvider.cpp Tue Jun 08 18:34:07 2010 +0800 @@ -255,9 +255,8 @@ void HelpDataProvider::constructBuiltInCategoryItem(const QString& uid, const QString& title) { - int featureId; int priority; - parseBuiltInMetaxml(uid, featureId, priority); + parseBuiltInMetaxml(uid, priority); HelpStandardItem* item = NULL; item = new HelpStandardItem(title); @@ -346,6 +345,33 @@ { return; } + + QStringList featureIdLst; + + query.setQuery("doc($inputdoc)/collections/collection/number(@FeatureId)"); + if(!query.isValid()) + { + return; + } + if(!query.evaluateTo(&featureIdLst)) + { + return; + } + + if(featureIdLst.count() != uidList.count()) + { + return; + } + + for(int i = featureIdLst.count() - 1; i <= 0; i--) + { + int featureID = featureIdLst.at(i).toInt(); + if(!HelpUtils::suppportFeatureID(featureID)) + { + uidList.removeAt(i); + titleList.removeAt(i); + } + } } void HelpDataProvider::parseCategory2IndexXml(const QString& path, QStringList& hrefList, QStringList& titleList) @@ -361,7 +387,6 @@ //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.setQuery("doc($inputdoc)/topics/topicref/xs:string(@href)"); @@ -383,15 +408,41 @@ { return; } + + QStringList featureIdLst; + + query.setQuery("doc($inputdoc)/topics/topicref/number(@FeatureId)"); + if(!query.isValid()) + { + return; + } + if(!query.evaluateTo(&featureIdLst)) + { + return; + } + + if(featureIdLst.count() != hrefList.count()) + { + return; + } + + for(int i = featureIdLst.count() - 1; i <= 0; i--) + { + int featureID = featureIdLst.at(i).toInt(); + if(!HelpUtils::suppportFeatureID(featureID)) + { + hrefList.removeAt(i); + titleList.removeAt(i); + } + } } -void HelpDataProvider::parseBuiltInMetaxml(const QString& path, int& featureId, int& priority) +void HelpDataProvider::parseBuiltInMetaxml(const QString& path, int& priority) { QString pathMetaxml(path); pathMetaxml.append(BACKSLASH); pathMetaxml.append(METAXML); - featureId = -1; priority = -1; QFile file(pathMetaxml); @@ -404,12 +455,6 @@ QString str; query.bindVariable("inputdoc", &file); - query.setQuery("doc($inputdoc)/meta/title/number(@FeatureId)"); - if(query.isValid() && query.evaluateTo(&str)) - { - featureId = str.toInt(); - } - query.setQuery("doc($inputdoc)/meta/number(priority)"); if(query.isValid() && query.evaluateTo(&str)) { diff -r 57d77d90783b -r 97d7f0705d0a userguide/src/HelpKeywordView.cpp --- a/userguide/src/HelpKeywordView.cpp Tue Jun 01 23:20:16 2010 +0300 +++ b/userguide/src/HelpKeywordView.cpp Tue Jun 08 18:34:07 2010 +0800 @@ -31,7 +31,6 @@ #include #include #include -#include #include "HelpDataProvider.h" #include "HelpProxyModel.h" @@ -61,7 +60,6 @@ initSearchList(); initSearchPanel(); initVirtualKeyboard(); - initEmptyLabel(); connect(mainWindow(), SIGNAL(viewReady()), this, SLOT(onViewReady())); } @@ -99,22 +97,17 @@ connect(mVirtualKeyboard, SIGNAL(keypadClosed()), this, SLOT(onHandleKeypadClose())); } -void HelpKeywordView::initEmptyLabel() +HbLabel* HelpKeywordView::label() { - HbLabel* label = mBuilder.findWidget(DOCML_NO_MATCH_LABEL); - label->setFontSpec(HbFontSpec(HbFontSpec::Primary)); + return mBuilder.findWidget(DOCML_NO_MATCH_LABEL); } void HelpKeywordView::loadAllContent() { + toolBar()->hide(); mBuilder.load(QRC_DOCML_KEYWORD, DOCML_LAYOUT_SEARCH); ResetSearchPanel(); - toolBar()->hide(); -} - -HbGroupBox* HelpKeywordView::groupBox() -{ - return mBuilder.findWidget(DOCML_GROUPBOX); + } //////////////////////////////////////////////////////////////////////////////////////////// @@ -150,6 +143,35 @@ } } +void HelpKeywordView::updateLabelPos() +{ + HbDeviceProfile profile = HbDeviceProfile::profile(mainWindow()); + qreal unValue = profile.unitValue(); + if(mainWindow()->orientation() == Qt::Vertical) + { + if(mVirtualKeyboard->keypadStatus() == HbVkbHost::HbVkbStatusClosed) + { + label()->setContentsMargins(0,30 * unValue,0,0); + } + else + { + label()->setContentsMargins(0,10 * unValue,0,0); + } + } + else + { + if(mVirtualKeyboard->keypadStatus() == HbVkbHost::HbVkbStatusClosed) + { + label()->setContentsMargins(0,10 * unValue,0,0); + } + else + { + label()->setContentsMargins(0,0,0,0); + label()->setAlignment(label()->alignment() | Qt::AlignVCenter); + } + } +} + //////////////////////////////////////////////////////////////////////////////////////////// // handle system event @@ -217,18 +239,6 @@ } 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); - } } //////////////////////////////////////////////////////////////////////////////////////////// @@ -239,6 +249,7 @@ updateVisibleItems(false); qreal heightToSet = mainWindow()->layoutRect().height() - mVirtualKeyboard->keyboardArea().height(); this->setMaximumHeight(heightToSet); + updateLabelPos(); } void HelpKeywordView::onHandleKeypadClose() @@ -248,6 +259,13 @@ qreal toolbarHeight = toolBar()->size().height(); qreal height = mainHeight - (toolBar()->isVisible() ? toolbarHeight : 0); this->setMaximumHeight(height); + updateLabelPos(); +} + +void HelpKeywordView::onOrientationChanged(Qt::Orientation orientation) +{ + HelpBaseView::onOrientationChanged(orientation); + updateLabelPos(); } // end of file diff -r 57d77d90783b -r 97d7f0705d0a userguide/src/HelpMainWindow.cpp --- a/userguide/src/HelpMainWindow.cpp Tue Jun 01 23:20:16 2010 +0300 +++ b/userguide/src/HelpMainWindow.cpp Tue Jun 08 18:34:07 2010 +0800 @@ -18,8 +18,12 @@ #include #include #include +#include +#include +#include "HelpBaseView.h" #include "HelpCategoryView.h" +#include "HelpKeywordView.h" #include "HelpContentsView.h" #include "HelpMainWindow.h" @@ -27,10 +31,10 @@ HelpMainWindow::HelpMainWindow() : mCategoryView(NULL), +mKeywordView(NULL), mContentsView(NULL) { - connect(this, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(onOrientationChanged(Qt::Orientation))); - initToolbar(); + QObject::connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(saveActivity())); activateCategoryView(); } @@ -39,20 +43,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 +50,17 @@ case HelpViewCategory: activateCategoryView(); break; - + case HelpViewKeyword: + activateKeywordView(); + break; case HelpViewContents: activateContentsView(); break; - + case PreviousView: + { + onActivateView(mPreviousViewName); + } + break; default: break; } @@ -77,74 +73,91 @@ 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::onShowFindList() +{ + activateKeywordView(); + mKeywordView->loadAllContent(); } -void HelpMainWindow::onToolbarOnlineSupport() -{ - HbNotificationDialog *notificationDialog = new HbNotificationDialog(); - notificationDialog->setParent(this); - notificationDialog->setTitle(URL_LINK_SUPPORT); - notificationDialog->show(); -} - -void HelpMainWindow::onOrientationChanged(Qt::Orientation orientation) +void HelpMainWindow::saveActivity() { - RefreshToolbarText(orientation); -} + HbActivityManager* activityManager = qobject_cast(qApp)->activityManager(); + + // clean up any previous versions of this activity from the activity manager. + bool ok = activityManager->removeActivity("UserGuideMainView"); + if ( !ok ) + { + //qFatal("Remove failed" ); + } -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()); + // get a screenshot for saving to the activity manager + QVariantHash metadata; + metadata.insert("screenshot", QPixmap::grabWidget(this, rect())); - tollbarAction = mBuilder.findObject(DOCML_ACTION_SEARCH); - tollbarAction->setText(isLandscape ? qtTrId(TXT_BUTTON_FIND) : QString()); + // save any data necessary to save the state + QByteArray serializedActivity; + QDataStream stream(&serializedActivity, QIODevice::WriteOnly | QIODevice::Append); + stream << "whatever data you need to save the state adequately"; - tollbarAction = mBuilder.findObject(DOCML_ACTION_LINK_NOKIA); - tollbarAction->setText(isLandscape ? qtTrId(TXT_BUTTON_LINK_SUPPORT) : QString()); + // add the activity to the activity manager + ok = activityManager->addActivity("UserGuideMainView", serializedActivity, metadata); + if ( !ok ) + { + qFatal("Add failed" ); + } } // end of file diff -r 57d77d90783b -r 97d7f0705d0a userguide/src/HelpUtils.cpp --- a/userguide/src/HelpUtils.cpp Tue Jun 01 23:20:16 2010 +0300 +++ b/userguide/src/HelpUtils.cpp Tue Jun 08 18:34:07 2010 +0800 @@ -28,8 +28,10 @@ #ifdef Q_OS_SYMBIAN +#include +#include + #include -#include #include #include @@ -230,6 +232,9 @@ QString uriStr("appto://"); uriStr.append(appUid); + /* uriStr.append("?"); + uriStr.append("activityname"); + uriStr.append("=MainView&key1=data1&key2=data2");*/ QUrl uri(uriStr); XQApplicationManager appmgr; @@ -249,6 +254,21 @@ return 0; } +bool HelpUtils::suppportFeatureID(int featureID) +{ +#ifdef Q_OS_SYMBIAN + if(featureID == -1) + { + return true; + } + QtMobility::QSystemInfo sysInfo; + return sysInfo.hasFeatureSupported((QtMobility::QSystemInfo::Feature)featureID); +#else + Q_UNUSED(featureID); + return true; +#endif +} + Qt::Orientation HelpUtils::defaultOrientation() { return Qt::Vertical;