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 showToolBar(false); |
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) |
141 { |
134 { |
142 HbLineEdit *const lineEdit = qobject_cast<HbLineEdit*>(widget); |
135 HbLineEdit *const lineEdit = qobject_cast<HbLineEdit*>(widget); |
143 if(lineEdit != NULL) |
136 if(lineEdit != NULL) |
144 { |
137 { |
145 lineEdit->setText(""); |
138 lineEdit->setText(""); |
|
139 lineEdit->setFocus(); |
146 break; |
140 break; |
147 } |
141 } |
148 } |
142 } |
149 } |
143 } |
150 } |
144 } |
151 |
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 |
|
175 void HelpKeywordView::showToolBar(bool visible) |
|
176 { |
|
177 Hb::SceneItems items = Hb::ToolBarItem; |
|
178 if(visible) |
|
179 { |
|
180 showItems(items); |
|
181 } |
|
182 else |
|
183 { |
|
184 hideItems(items); |
|
185 } |
|
186 } |
|
187 |
152 //////////////////////////////////////////////////////////////////////////////////////////// |
188 //////////////////////////////////////////////////////////////////////////////////////////// |
153 // handle system event |
189 // handle system event |
154 |
190 |
155 void HelpKeywordView::onCurrentViewChanged(HbView *view) |
191 void HelpKeywordView::onViewReady() |
156 { |
192 { |
157 if(this == view) |
193 if(isVisible()) |
158 { |
194 { |
159 setVisible(true); |
|
160 setNavigationAction(mSoftKeyAction); |
195 setNavigationAction(mSoftKeyAction); |
161 } |
196 } |
162 } |
197 } |
163 |
198 |
164 /////////////////////////////////////////////////////////////////////////////////////// |
199 /////////////////////////////////////////////////////////////////////////////////////// |
213 } |
248 } |
214 else |
249 else |
215 { |
250 { |
216 mBuilder.load(QRC_DOCML_KEYWORD, DOCML_LAYOUT_SEARCH); |
251 mBuilder.load(QRC_DOCML_KEYWORD, DOCML_LAYOUT_SEARCH); |
217 } |
252 } |
218 |
253 showToolBar(false); |
219 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 } |
254 } |
233 |
255 |
234 //////////////////////////////////////////////////////////////////////////////////////////// |
256 //////////////////////////////////////////////////////////////////////////////////////////// |
235 // handle virtual keyboard event |
257 // handle virtual keyboard event |
236 |
258 |
237 void HelpKeywordView::onHandleKeypadOpen() |
259 void HelpKeywordView::onHandleKeypadOpen() |
238 { |
260 { |
239 updateVisibleItems(false); |
261 updateVisibleItems(false); |
240 qreal heightToSet = mainWindow()->layoutRect().height() - mVirtualKeyboard->keyboardArea().height(); |
262 qreal heightToSet = mainWindow()->layoutRect().height() - mVirtualKeyboard->keyboardArea().height(); |
241 this->setMaximumHeight(heightToSet); |
263 this->setMaximumHeight(heightToSet); |
|
264 updateLabelPos(); |
242 } |
265 } |
243 |
266 |
244 void HelpKeywordView::onHandleKeypadClose() |
267 void HelpKeywordView::onHandleKeypadClose() |
245 { |
268 { |
246 updateVisibleItems(true); |
269 updateVisibleItems(true); |
247 qreal mainHeight = mainWindow()->layoutRect().height(); |
270 qreal mainHeight = mainWindow()->layoutRect().height(); |
248 qreal toolbarHeight = toolBar()->size().height(); |
271 qreal toolbarHeight = toolBar()->size().height(); |
249 qreal height = mainHeight - (toolBar()->isVisible() ? toolbarHeight : 0); |
272 qreal height = mainHeight - ( toolBar()->isVisible() ? toolbarHeight : 0); |
250 this->setMaximumHeight(height); |
273 this->setMaximumHeight(height); |
|
274 updateLabelPos(); |
|
275 } |
|
276 |
|
277 void HelpKeywordView::onOrientationChanged(Qt::Orientation orientation) |
|
278 { |
|
279 Q_UNUSED(orientation); |
|
280 updateLabelPos(); |
251 } |
281 } |
252 |
282 |
253 // end of file |
283 // end of file |