userguide/src/HelpKeywordView.cpp
changeset 33 1038206aa0cb
parent 23 99b096216bc8
child 34 4533d75b8d4e
--- 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 <hblineedit.h>
 #include <hbmenu.h>
 #include <hbstaticvkbhost.h>
-#include <hbgroupbox.h>
 
 #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<HbLabel*>(DOCML_NO_MATCH_LABEL);
-	label->setFontSpec(HbFontSpec(HbFontSpec::Primary));
+	return mBuilder.findWidget<HbLabel*>(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<HbGroupBox*>(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