29 #include <hbsearchpanel.h> |
29 #include <hbsearchpanel.h> |
30 #include <hbscrollbar.h> |
30 #include <hbscrollbar.h> |
31 #include <hblineedit.h> |
31 #include <hblineedit.h> |
32 #include <hbmenu.h> |
32 #include <hbmenu.h> |
33 #include <hbstaticvkbhost.h> |
33 #include <hbstaticvkbhost.h> |
34 #include <hbgroupbox.h> |
|
35 |
34 |
36 #include "HelpDataProvider.h" |
35 #include "HelpDataProvider.h" |
37 #include "HelpProxyModel.h" |
36 #include "HelpProxyModel.h" |
38 |
37 |
39 #include "HelpKeywordView.h" |
38 #include "HelpKeywordView.h" |
97 mVirtualKeyboard = new HbStaticVkbHost(this); |
95 mVirtualKeyboard = new HbStaticVkbHost(this); |
98 connect(mVirtualKeyboard, SIGNAL(keypadOpened()), this, SLOT(onHandleKeypadOpen())); |
96 connect(mVirtualKeyboard, SIGNAL(keypadOpened()), this, SLOT(onHandleKeypadOpen())); |
99 connect(mVirtualKeyboard, SIGNAL(keypadClosed()), this, SLOT(onHandleKeypadClose())); |
97 connect(mVirtualKeyboard, SIGNAL(keypadClosed()), this, SLOT(onHandleKeypadClose())); |
100 } |
98 } |
101 |
99 |
102 void HelpKeywordView::initEmptyLabel() |
100 HbLabel* HelpKeywordView::label() |
103 { |
101 { |
104 HbLabel* label = mBuilder.findWidget<HbLabel*>(DOCML_NO_MATCH_LABEL); |
102 return mBuilder.findWidget<HbLabel*>(DOCML_NO_MATCH_LABEL); |
105 label->setFontSpec(HbFontSpec(HbFontSpec::Primary)); |
|
106 } |
103 } |
107 |
104 |
108 void HelpKeywordView::loadAllContent() |
105 void HelpKeywordView::loadAllContent() |
109 { |
106 { |
|
107 toolBar()->hide(); |
110 mBuilder.load(QRC_DOCML_KEYWORD, DOCML_LAYOUT_SEARCH); |
108 mBuilder.load(QRC_DOCML_KEYWORD, DOCML_LAYOUT_SEARCH); |
111 ResetSearchPanel(); |
109 ResetSearchPanel(); |
112 toolBar()->hide(); |
110 |
113 } |
|
114 |
|
115 HbGroupBox* HelpKeywordView::groupBox() |
|
116 { |
|
117 return mBuilder.findWidget<HbGroupBox*>(DOCML_GROUPBOX); |
|
118 } |
111 } |
119 |
112 |
120 //////////////////////////////////////////////////////////////////////////////////////////// |
113 //////////////////////////////////////////////////////////////////////////////////////////// |
121 |
114 |
122 void HelpKeywordView::updateVisibleItems(bool visible) |
115 void HelpKeywordView::updateVisibleItems(bool visible) |
148 } |
141 } |
149 } |
142 } |
150 } |
143 } |
151 } |
144 } |
152 |
145 |
|
146 void HelpKeywordView::updateLabelPos() |
|
147 { |
|
148 HbDeviceProfile profile = HbDeviceProfile::profile(mainWindow()); |
|
149 qreal unValue = profile.unitValue(); |
|
150 if(mainWindow()->orientation() == Qt::Vertical) |
|
151 { |
|
152 if(mVirtualKeyboard->keypadStatus() == HbVkbHost::HbVkbStatusClosed) |
|
153 { |
|
154 label()->setContentsMargins(0,30 * unValue,0,0); |
|
155 } |
|
156 else |
|
157 { |
|
158 label()->setContentsMargins(0,10 * unValue,0,0); |
|
159 } |
|
160 } |
|
161 else |
|
162 { |
|
163 if(mVirtualKeyboard->keypadStatus() == HbVkbHost::HbVkbStatusClosed) |
|
164 { |
|
165 label()->setContentsMargins(0,10 * unValue,0,0); |
|
166 } |
|
167 else |
|
168 { |
|
169 label()->setContentsMargins(0,0,0,0); |
|
170 label()->setAlignment(label()->alignment() | Qt::AlignVCenter); |
|
171 } |
|
172 } |
|
173 } |
|
174 |
153 //////////////////////////////////////////////////////////////////////////////////////////// |
175 //////////////////////////////////////////////////////////////////////////////////////////// |
154 // handle system event |
176 // handle system event |
155 |
177 |
156 void HelpKeywordView::onViewReady() |
178 void HelpKeywordView::onViewReady() |
157 { |
179 { |
215 { |
237 { |
216 mBuilder.load(QRC_DOCML_KEYWORD, DOCML_LAYOUT_SEARCH); |
238 mBuilder.load(QRC_DOCML_KEYWORD, DOCML_LAYOUT_SEARCH); |
217 } |
239 } |
218 |
240 |
219 toolBar()->hide(); |
241 toolBar()->hide(); |
220 |
|
221 if(criteria.isEmpty()) |
|
222 { |
|
223 groupBox()->setHeading(hbTrId(TXT_SETLABEL_SEARCH)); |
|
224 } |
|
225 else |
|
226 { |
|
227 QString heading = qtTrId(TXT_SETLABEL_SEARCH_RESULTS); |
|
228 heading.append(COLON); |
|
229 heading.append(criteria); |
|
230 groupBox()->setHeading(heading); |
|
231 } |
|
232 } |
242 } |
233 |
243 |
234 //////////////////////////////////////////////////////////////////////////////////////////// |
244 //////////////////////////////////////////////////////////////////////////////////////////// |
235 // handle virtual keyboard event |
245 // handle virtual keyboard event |
236 |
246 |
237 void HelpKeywordView::onHandleKeypadOpen() |
247 void HelpKeywordView::onHandleKeypadOpen() |
238 { |
248 { |
239 updateVisibleItems(false); |
249 updateVisibleItems(false); |
240 qreal heightToSet = mainWindow()->layoutRect().height() - mVirtualKeyboard->keyboardArea().height(); |
250 qreal heightToSet = mainWindow()->layoutRect().height() - mVirtualKeyboard->keyboardArea().height(); |
241 this->setMaximumHeight(heightToSet); |
251 this->setMaximumHeight(heightToSet); |
|
252 updateLabelPos(); |
242 } |
253 } |
243 |
254 |
244 void HelpKeywordView::onHandleKeypadClose() |
255 void HelpKeywordView::onHandleKeypadClose() |
245 { |
256 { |
246 updateVisibleItems(true); |
257 updateVisibleItems(true); |
247 qreal mainHeight = mainWindow()->layoutRect().height(); |
258 qreal mainHeight = mainWindow()->layoutRect().height(); |
248 qreal toolbarHeight = toolBar()->size().height(); |
259 qreal toolbarHeight = toolBar()->size().height(); |
249 qreal height = mainHeight - (toolBar()->isVisible() ? toolbarHeight : 0); |
260 qreal height = mainHeight - (toolBar()->isVisible() ? toolbarHeight : 0); |
250 this->setMaximumHeight(height); |
261 this->setMaximumHeight(height); |
|
262 updateLabelPos(); |
|
263 } |
|
264 |
|
265 void HelpKeywordView::onOrientationChanged(Qt::Orientation orientation) |
|
266 { |
|
267 HelpBaseView::onOrientationChanged(orientation); |
|
268 updateLabelPos(); |
251 } |
269 } |
252 |
270 |
253 // end of file |
271 // end of file |