# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1277305400 -10800 # Node ID 1038206aa0cb0f59746d75549bfe567ba00db9de # Parent 99b096216bc8685ead0facdfc850d7ffd1a29c22 Revision: 201023 Kit: 2010125 diff -r 99b096216bc8 -r 1038206aa0cb userguide/Userguide.pro --- a/userguide/Userguide.pro Fri Jun 11 13:29:58 2010 +0300 +++ b/userguide/Userguide.pro Wed Jun 23 18:03:20 2010 +0300 @@ -58,6 +58,8 @@ TARGET.CAPABILITY = CAP_APPLICATION TARGET.EPOCHEAPSIZE = 0x020000 0x1000000 + CONFIG += mobility + MOBILITY = systeminfo LIBS += -lezip -lxqservice -lxqserviceutil include(rom/userguide.pri) } diff -r 99b096216bc8 -r 1038206aa0cb userguide/inc/HelpBaseView.h --- a/userguide/inc/HelpBaseView.h Fri Jun 11 13:29:58 2010 +0300 +++ b/userguide/inc/HelpBaseView.h Wed Jun 23 18:03:20 2010 +0300 @@ -45,8 +45,8 @@ void onToolbarFind() { emit showFindList(); }; void onToolbarOnlineSupport(); -private slots: - void onOrientationChanged(Qt::Orientation orientation); +protected slots: + virtual void onOrientationChanged(Qt::Orientation orientation); protected: void initBaseDocMl(); diff -r 99b096216bc8 -r 1038206aa0cb userguide/inc/HelpDataProvider.h --- a/userguide/inc/HelpDataProvider.h Fri Jun 11 13:29:58 2010 +0300 +++ b/userguide/inc/HelpDataProvider.h Wed Jun 23 18:03:20 2010 +0300 @@ -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 99b096216bc8 -r 1038206aa0cb userguide/inc/HelpKeywordView.h --- a/userguide/inc/HelpKeywordView.h Fri Jun 11 13:29:58 2010 +0300 +++ b/userguide/inc/HelpKeywordView.h Wed Jun 23 18:03:20 2010 +0300 @@ -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 99b096216bc8 -r 1038206aa0cb userguide/inc/HelpMainWindow.h --- a/userguide/inc/HelpMainWindow.h Fri Jun 11 13:29:58 2010 +0300 +++ b/userguide/inc/HelpMainWindow.h Wed Jun 23 18:03:20 2010 +0300 @@ -38,6 +38,7 @@ private slots: void onActivateView(HelpViewName viewName); + void saveActivity(); private: // activate views void activateCategoryView(); diff -r 99b096216bc8 -r 1038206aa0cb userguide/inc/HelpUtils.h --- a/userguide/inc/HelpUtils.h Fri Jun 11 13:29:58 2010 +0300 +++ b/userguide/inc/HelpUtils.h Wed Jun 23 18:03:20 2010 +0300 @@ -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 99b096216bc8 -r 1038206aa0cb userguide/resources/xml/keywordView.docml --- a/userguide/resources/xml/keywordView.docml Fri Jun 11 13:29:58 2010 +0300 +++ b/userguide/resources/xml/keywordView.docml Wed Jun 23 18:03:20 2010 +0300 @@ -1,126 +1,99 @@ - - + - - - - - - - - - - + + + - + + + + + + + + + + + -
- - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + +
-
- - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + +
-
- - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + +
-
- - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + +
- + + + + + + + +
diff -r 99b096216bc8 -r 1038206aa0cb userguide/src/HelpDataProvider.cpp --- a/userguide/src/HelpDataProvider.cpp Fri Jun 11 13:29:58 2010 +0300 +++ b/userguide/src/HelpDataProvider.cpp Wed Jun 23 18:03:20 2010 +0300 @@ -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 99b096216bc8 -r 1038206aa0cb userguide/src/HelpKeywordView.cpp --- a/userguide/src/HelpKeywordView.cpp Fri Jun 11 13:29:58 2010 +0300 +++ b/userguide/src/HelpKeywordView.cpp Wed Jun 23 18:03:20 2010 +0300 @@ -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 99b096216bc8 -r 1038206aa0cb userguide/src/HelpMainWindow.cpp --- a/userguide/src/HelpMainWindow.cpp Fri Jun 11 13:29:58 2010 +0300 +++ b/userguide/src/HelpMainWindow.cpp Wed Jun 23 18:03:20 2010 +0300 @@ -18,6 +18,8 @@ #include #include #include +#include +#include #include "HelpBaseView.h" #include "HelpCategoryView.h" @@ -32,6 +34,7 @@ mKeywordView(NULL), mContentsView(NULL) { + QObject::connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(saveActivity())); activateCategoryView(); } @@ -129,5 +132,33 @@ mKeywordView->loadAllContent(); } +void HelpMainWindow::saveActivity() +{ + HbActivityManager* activityManager = qobject_cast(qApp)->activityManager(); + + // clean up any previous versions of this activity from the activity manager. + bool ok = activityManager->removeActivity("UserGuideMainView"); + if ( !ok ) + { + //qFatal("Remove failed" ); + } + + // get a screenshot for saving to the activity manager + QVariantHash metadata; + metadata.insert("screenshot", QPixmap::grabWidget(this, rect())); + + // save any data necessary to save the state + QByteArray serializedActivity; + QDataStream stream(&serializedActivity, QIODevice::WriteOnly | QIODevice::Append); + stream << "whatever data you need to save the state adequately"; + + // add the activity to the activity manager + ok = activityManager->addActivity("UserGuideMainView", serializedActivity, metadata); + if ( !ok ) + { + qFatal("Add failed" ); + } +} + // end of file diff -r 99b096216bc8 -r 1038206aa0cb userguide/src/HelpUtils.cpp --- a/userguide/src/HelpUtils.cpp Fri Jun 11 13:29:58 2010 +0300 +++ b/userguide/src/HelpUtils.cpp Wed Jun 23 18:03:20 2010 +0300 @@ -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;