diff -r e70b37c1a9d5 -r 3ae60d69bf22 userguide/src/HelpKeywordView.cpp --- a/userguide/src/HelpKeywordView.cpp Fri Jun 11 16:23:42 2010 +0100 +++ b/userguide/src/HelpKeywordView.cpp Thu Jul 22 16:30:58 2010 +0100 @@ -31,7 +31,6 @@ #include #include #include -#include #include "HelpDataProvider.h" #include "HelpProxyModel.h" @@ -61,9 +60,8 @@ initSearchList(); initSearchPanel(); initVirtualKeyboard(); - initEmptyLabel(); - connect(mainWindow(), SIGNAL(currentViewChanged(HbView*)), this, SLOT(onCurrentViewChanged(HbView*))); + connect(mainWindow(), SIGNAL(viewReady()), this, SLOT(onViewReady())); } void HelpKeywordView::initDocMl() @@ -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() { + showToolBar(false); mBuilder.load(QRC_DOCML_KEYWORD, DOCML_LAYOUT_SEARCH); ResetSearchPanel(); - toolBar()->hide(); -} - -HbGroupBox* HelpKeywordView::groupBox() -{ - return mBuilder.findWidget(DOCML_GROUPBOX); + } //////////////////////////////////////////////////////////////////////////////////////////// @@ -143,20 +136,62 @@ if(lineEdit != NULL) { lineEdit->setText(""); + lineEdit->setFocus(); break; } } } } +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); + } + } +} + +void HelpKeywordView::showToolBar(bool visible) +{ + Hb::SceneItems items = Hb::ToolBarItem; + if(visible) + { + showItems(items); + } + else + { + hideItems(items); + } +} + //////////////////////////////////////////////////////////////////////////////////////////// // handle system event -void HelpKeywordView::onCurrentViewChanged(HbView *view) +void HelpKeywordView::onViewReady() { - if(this == view) - { - setVisible(true); + if(isVisible()) + { setNavigationAction(mSoftKeyAction); } } @@ -201,7 +236,7 @@ { mBuilder.load(QRC_DOCML_KEYWORD, DOCML_LAYOUT_SEARCH_NO_SRHPAL); } - toolBar()->show(); + showToolBar(true); } void HelpKeywordView::onSearchPanelCriteriaChanged(const QString &criteria) @@ -215,20 +250,7 @@ { 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); - } + showToolBar(false); } //////////////////////////////////////////////////////////////////////////////////////////// @@ -239,6 +261,7 @@ updateVisibleItems(false); qreal heightToSet = mainWindow()->layoutRect().height() - mVirtualKeyboard->keyboardArea().height(); this->setMaximumHeight(heightToSet); + updateLabelPos(); } void HelpKeywordView::onHandleKeypadClose() @@ -246,8 +269,15 @@ updateVisibleItems(true); qreal mainHeight = mainWindow()->layoutRect().height(); qreal toolbarHeight = toolBar()->size().height(); - qreal height = mainHeight - (toolBar()->isVisible() ? toolbarHeight : 0); + qreal height = mainHeight - ( toolBar()->isVisible() ? toolbarHeight : 0); this->setMaximumHeight(height); + updateLabelPos(); +} + +void HelpKeywordView::onOrientationChanged(Qt::Orientation orientation) +{ + Q_UNUSED(orientation); + updateLabelPos(); } // end of file