47 |
49 |
48 \sa HsAppLibraryState |
50 \sa HsAppLibraryState |
49 */ |
51 */ |
50 |
52 |
51 /*! |
53 /*! |
52 Constructor |
54 |
53 |
55 Retrieves UI objects for a requested context and sets up signals' connections. |
54 Builds UI objects |
|
55 Sets up signals connections. |
|
56 |
56 |
57 \param builder Menu View builder. |
57 \param builder Menu View builder. |
58 \param viewContext variable representing view context the view is to be prepared for. |
58 \param stateContext Variable representing view context the view is to be prepared for. |
59 */ |
59 \param mainWindow Object responsible for making a given view |
60 HsMenuView::HsMenuView(HsMenuViewBuilder &builder, HsViewContext viewContext): |
60 a currently displayed view. |
61 mViewContext(viewContext), |
61 */ |
|
62 HsMenuView::HsMenuView(HsMenuViewBuilder &builder, |
|
63 HsStateContext stateContext, |
|
64 HsMainWindow &mainWindow): |
62 mBuilder(builder), |
65 mBuilder(builder), |
63 mProxyModel(new QSortFilterProxyModel(this)), |
66 mStateContext(stateContext), |
64 mView(NULL), |
67 mOperationalContext(HsItemViewContext), |
65 mListView(NULL), |
68 mMainWindow(mainWindow), |
66 mViewLabel(NULL), |
69 mHsSearchView(new HsSearchView(mBuilder, mStateContext, mMainWindow)) |
67 mSearchListView(NULL), |
70 { |
68 mSearchPanel(NULL), |
71 synchronizeCache(); |
69 mVkbHost(NULL) |
|
70 { |
|
71 mBuilder.setOperationalContext(HsItemViewContext); |
|
72 mBuilder.setViewContext(mViewContext); |
|
73 mBuilder.build(); |
|
74 |
|
75 mView = mBuilder.currentView(); |
|
76 mListView = mBuilder.currentListView(); |
|
77 |
|
78 mViewLabel= mBuilder.currentViewLabel(); |
|
79 |
|
80 mCollectionButton = mBuilder.collectionButton(); |
|
81 |
|
82 mProxyModel->setFilterRole(CaItemModel::TextRole); |
|
83 mProxyModel->setFilterKeyColumn(1); |
|
84 mProxyModel->setSortRole(CaItemModel::TextRole); |
|
85 |
|
86 mVkbHost.reset(new HbShrinkingVkbHost(mView)); |
|
87 |
72 |
88 connect(mListView, |
73 connect(mListView, |
89 SIGNAL(activated(QModelIndex)), |
74 SIGNAL(activated(QModelIndex)), |
90 this, SIGNAL(activated(QModelIndex))); |
75 this, SIGNAL(activated(QModelIndex))); |
91 connect(mListView, |
76 connect(mListView, |
92 SIGNAL(longPressed(HbAbstractViewItem *, QPointF)), |
77 SIGNAL(longPressed(HbAbstractViewItem *, QPointF)), |
93 this, SIGNAL(longPressed(HbAbstractViewItem *, QPointF))); |
78 this, SIGNAL(longPressed(HbAbstractViewItem *, QPointF))); |
94 } |
79 |
95 |
80 connect(mHsSearchView.data(), SIGNAL(activated(QModelIndex)), |
96 /*! |
81 this, SIGNAL(activated(QModelIndex))); |
97 Destructor |
82 connect(mHsSearchView.data(), |
98 |
83 SIGNAL(longPressed(HbAbstractViewItem *, QPointF)), |
99 Disconnects signals. |
84 this, SIGNAL(longPressed(HbAbstractViewItem *, QPointF))); |
|
85 } |
|
86 |
|
87 /*! |
|
88 Empty. |
100 */ |
89 */ |
101 HsMenuView::~HsMenuView() |
90 HsMenuView::~HsMenuView() |
102 { |
91 { |
103 } |
92 } |
104 |
93 |
105 |
94 |
106 /*! |
95 /*! |
107 Sets model for item view. |
96 Sets model for list item view if available in current context otherwise |
|
97 ingores the request. |
108 |
98 |
109 \param model Model the view is to represent in HsItemViewMode. |
99 \param model Model the view is to represent in HsItemViewMode. |
110 */ |
100 */ |
111 void HsMenuView::setModel(HsMenuItemModel *model) |
101 void HsMenuView::setModel(HsMenuItemModel *model) |
112 { |
102 { |
113 HSMENUTEST_FUNC_ENTRY("HsMenuView::setModel"); |
103 HSMENUTEST_FUNC_ENTRY("HsMenuView::setModel"); |
114 |
104 |
115 if (mListView->model()) { |
105 if (mListView != NULL) { |
116 disconnect(mListView->model(), |
106 if (mListView->model()) { |
117 SIGNAL(scrollTo(int, QAbstractItemView::ScrollHint)), |
107 disconnect(mListView->model(), |
118 this, |
108 SIGNAL(scrollTo(int, QAbstractItemView::ScrollHint)), |
119 SLOT(scrollToRow(int, QAbstractItemView::ScrollHint))); |
109 this, |
120 } |
110 SLOT(scrollToRow(int, QAbstractItemView::ScrollHint))); |
121 mListView->setModel(model); |
111 disconnect(mListView->model(), SIGNAL(countChange()), |
122 mListView->setItemPrototype(new HsListViewItem()); |
112 this, |
123 if (mListView->model()) { |
113 SIGNAL(listViewChange())); |
124 connect(mListView->model(), |
114 } |
125 SIGNAL(scrollTo(int, QAbstractItemView::ScrollHint)), |
115 |
126 this, |
116 mListView->setModel(model, new HsListViewItem()); |
127 SLOT(scrollToRow(int, QAbstractItemView::ScrollHint))); |
117 |
128 } |
118 if (mListView->model()) { |
|
119 connect(mListView->model(), |
|
120 SIGNAL(scrollTo(int, QAbstractItemView::ScrollHint)), |
|
121 this, |
|
122 SLOT(scrollToRow(int, QAbstractItemView::ScrollHint))); |
|
123 connect(mListView->model(), SIGNAL(countChange()), |
|
124 this, |
|
125 SIGNAL(listViewChange())); |
|
126 } |
|
127 } |
|
128 |
129 HSMENUTEST_FUNC_EXIT("HsMenuView::setModel"); |
129 HSMENUTEST_FUNC_EXIT("HsMenuView::setModel"); |
130 } |
130 } |
131 |
131 |
132 |
132 |
133 /*! |
133 /*! |
|
134 \return View widget of the menu view. |
|
135 */ |
|
136 HbView *HsMenuView::view() const |
|
137 { |
|
138 return mView; |
|
139 } |
|
140 |
|
141 /*! |
|
142 \return List view widget of the menu view |
|
143 if available in the context or NULL otherwise. |
|
144 */ |
|
145 HbListView *HsMenuView::listView() const |
|
146 { |
|
147 return mListView; |
|
148 } |
|
149 |
|
150 /*! |
134 Returns label appropriate for the view. |
151 Returns label appropriate for the view. |
135 \return pointer to the label or NULL if the view has no label. |
152 \return Pointer to the label |
|
153 if available in the context or NULL otherwise. |
136 */ |
154 */ |
137 HbGroupBox *HsMenuView::viewLabel() const |
155 HbGroupBox *HsMenuView::viewLabel() const |
138 { |
156 { |
139 return mViewLabel; |
157 return mViewLabel; |
140 } |
158 } |
141 |
159 |
142 /*! |
160 /*! |
143 \return first visible item index if any or default QModelIndex otherwise. |
161 \return Collection button |
144 */ |
162 if available in the context or NULL otherwise. |
145 QModelIndex HsMenuView::firstVisibleItemIndex(const HbListView *view) const |
163 */ |
146 { |
164 HbPushButton *HsMenuView::contentButton() const |
147 QModelIndex result; |
165 { |
148 |
166 return mAddContentButton; |
149 const QList<HbAbstractViewItem *> array = |
|
150 view->visibleItems(); |
|
151 |
|
152 if (array.count() >= 1) { |
|
153 result = array[0]->modelIndex(); |
|
154 } |
|
155 return result; |
|
156 } |
|
157 |
|
158 /*! |
|
159 Makes the UI to show or hide view search panel. |
|
160 When search panel is shown the view toolbar and status pane |
|
161 are hidden until search panel is hidden. |
|
162 \param visible When true search panel will be shown, |
|
163 otherwise it will be hidden. |
|
164 */ |
|
165 void HsMenuView::setSearchPanelVisible(bool visible) |
|
166 { |
|
167 HSMENUTEST_FUNC_ENTRY("HsMenuView::setSearchPanelVisible"); |
|
168 |
|
169 if (visible) { |
|
170 |
|
171 mSearchViewInitialIndex = firstVisibleItemIndex(mListView); |
|
172 |
|
173 searchBegins(); |
|
174 |
|
175 connectSearchItemViewsSignals(); |
|
176 connectSearchPanelSignals(); |
|
177 |
|
178 } else if (mSearchListView != NULL) { |
|
179 |
|
180 mIndexToScrollAfterSearchDone = |
|
181 firstVisibleItemIndex(mSearchListView); |
|
182 |
|
183 disconnectSearchPanelSignals(); |
|
184 disconnectSearchItemViewsSignals(); |
|
185 |
|
186 searchFinished(); |
|
187 } |
|
188 HSMENUTEST_FUNC_EXIT("HsMenuView::setSearchPanelVisible"); |
|
189 } |
|
190 |
|
191 /*! |
|
192 Makes the UI to show or hide view add collection button |
|
193 \param visibility When true button will be shown, |
|
194 otherwise it will be hidden. |
|
195 */ |
|
196 void HsMenuView::setContext(HsViewContext viewContext, |
|
197 HsOperationalContext context) |
|
198 { |
|
199 mBuilder.setViewContext(viewContext); |
|
200 mBuilder.setOperationalContext(context); |
|
201 mBuilder.build(); |
|
202 } |
|
203 |
|
204 |
|
205 /*! |
|
206 \return View widget of the menu view. |
|
207 */ |
|
208 HbView *HsMenuView::view() const |
|
209 { |
|
210 return mView; |
|
211 } |
|
212 |
|
213 /*! |
|
214 \return List view widget of the menu view. |
|
215 */ |
|
216 HbListView *HsMenuView::listView() const |
|
217 { |
|
218 return mListView; |
|
219 } |
|
220 |
|
221 /*! |
|
222 \return Collection button |
|
223 */ |
|
224 HbPushButton *HsMenuView::collectionButton() const |
|
225 { |
|
226 return mCollectionButton; |
|
227 } |
167 } |
228 |
168 |
229 /*! |
169 /*! |
230 Makes search panel visible. |
170 Makes search panel visible. |
231 Equivalent to \a setSearchPanelVisible(true) |
171 Equivalent to \a setSearchPanelVisible(true) |
232 */ |
172 */ |
233 void HsMenuView::showSearchPanel() |
173 void HsMenuView::showSearchPanel() |
234 { |
174 { |
235 HSMENUTEST_FUNC_ENTRY("HsMenuView::showSearchPanel"); |
175 HSMENUTEST_FUNC_ENTRY("HsMenuView::showSearchPanel"); |
236 |
176 |
237 setSearchPanelVisible(true); |
177 mHsSearchView->setSearchPanelVisible(true); |
238 |
178 |
239 HSMENUTEST_FUNC_EXIT("HsMenuView::showSearchPanel"); |
179 HSMENUTEST_FUNC_EXIT("HsMenuView::showSearchPanel"); |
240 } |
180 } |
241 #ifdef COVERAGE_MEASUREMENT |
|
242 #pragma CTC SKIP |
|
243 #endif //COVERAGE_MEASUREMENT skipped: it doubles other method |
|
244 |
181 |
245 /*! |
182 /*! |
246 Makes search panel invisible. |
183 Makes search panel invisible. |
247 Equivalent to \a setSearchPanelVisible(false). |
184 Equivalent to \a setSearchPanelVisible(false). |
248 */ |
185 */ |
249 void HsMenuView::hideSearchPanel() |
186 void HsMenuView::hideSearchPanel() |
250 { |
187 { |
251 HSMENUTEST_FUNC_ENTRY("HsMenuView::hideSearchPanel"); |
188 HSMENUTEST_FUNC_ENTRY("HsMenuView::hideSearchPanel"); |
252 setSearchPanelVisible(false); |
189 |
|
190 mHsSearchView->setSearchPanelVisible(false); |
|
191 |
253 HSMENUTEST_FUNC_EXIT("HsMenuView::hideSearchPanel"); |
192 HSMENUTEST_FUNC_EXIT("HsMenuView::hideSearchPanel"); |
254 } |
193 } |
255 #ifdef COVERAGE_MEASUREMENT |
|
256 #pragma CTC ENDSKIP |
|
257 #endif //COVERAGE_MEASUREMENT |
|
258 |
194 |
259 /*! |
195 /*! |
260 Disable or enable search action button. |
196 Disable or enable search action button. |
261 \param disable If true action is disabled. |
197 \param disable If true action gets disabled. |
262 */ |
198 */ |
263 void HsMenuView::disableSearch(bool disable) |
199 void HsMenuView::disableSearch(bool disable) |
264 { |
200 { |
265 mBuilder.searchAction()->setDisabled(disable); |
201 mBuilder.searchAction()->setDisabled(disable); |
266 } |
202 } |
267 |
203 |
268 /*! |
204 /*! |
269 Scrolls item view to requested row. |
205 Scrolls list item view to requested row. |
270 \param row The row which is to get at the position pointed by \a hint. |
206 \param row The row which is to get at the position pointed by \a hint. |
271 \param hint Position in the view the row should be scrolled to. |
207 \param hint Position in the view the row should be scrolled to. |
272 */ |
208 */ |
273 void HsMenuView::scrollToRow(int row, QAbstractItemView::ScrollHint hint) |
209 void HsMenuView::scrollToRow(int row, QAbstractItemView::ScrollHint hint) |
274 { |
210 { |
275 HSMENUTEST_FUNC_ENTRY("HsMenuView::scrollToRow"); |
211 HSMENUTEST_FUNC_ENTRY("HsMenuView::scrollToRow"); |
276 |
212 |
277 mListView->scrollTo(mListView->model()->index(row, 0), |
213 if (mListView != NULL) { |
278 convertScrollHint(hint)); |
214 mListView->scrollTo( |
|
215 mListView->model()->index(row, 0), convertScrollHint(hint)); |
|
216 } |
279 |
217 |
280 HSMENUTEST_FUNC_EXIT("HsMenuView::scrollToRow"); |
218 HSMENUTEST_FUNC_EXIT("HsMenuView::scrollToRow"); |
281 } |
219 } |
282 |
220 |
283 /*! |
221 /*! |
299 default: |
237 default: |
300 return HbAbstractItemView::PositionAtCenter; |
238 return HbAbstractItemView::PositionAtCenter; |
301 } |
239 } |
302 } |
240 } |
303 |
241 |
304 /* |
242 /*! |
305 Connects \a activated and \a longPressed signals coming from search list |
243 Add the view to main window and connect search action with \a showSearchPanel |
306 view to emit corresponding signal of this object with translated model index |
|
307 */ |
|
308 void HsMenuView::connectSearchItemViewsSignals() |
|
309 { |
|
310 connect(mSearchListView, SIGNAL(activated(QModelIndex)), |
|
311 this, SLOT(activatedProxySlot(QModelIndex))); |
|
312 connect(mSearchListView, SIGNAL(longPressed(HbAbstractViewItem *, QPointF)), |
|
313 this, SLOT(longPressedProxySlot(HbAbstractViewItem *, QPointF))); |
|
314 |
|
315 } |
|
316 |
|
317 /*! |
|
318 Disconnects \a activated and \a longPressed signals coming from list |
|
319 view from to emit corresponding signal |
|
320 of this object with translated model index. |
|
321 */ |
|
322 void HsMenuView::disconnectSearchItemViewsSignals() |
|
323 { |
|
324 disconnect(mSearchListView, SIGNAL(activated(QModelIndex)), |
|
325 this, SLOT(activatedProxySlot(QModelIndex))); |
|
326 disconnect(mSearchListView, SIGNAL(longPressed(HbAbstractViewItem *, QPointF)), |
|
327 this, |
|
328 SLOT(longPressedProxySlot(HbAbstractViewItem *, QPointF))); |
|
329 } |
|
330 |
|
331 |
|
332 /*! |
|
333 Connects signals \a exitClicked and \a criteriaChanged emitted |
|
334 by search panel with handling slots of the object or its members. |
|
335 */ |
|
336 void HsMenuView::connectSearchPanelSignals() |
|
337 { |
|
338 connect(mSearchPanel, SIGNAL(exitClicked()), |
|
339 this, SLOT(hideSearchPanel())); |
|
340 connect(mSearchPanel, SIGNAL(criteriaChanged(QString)), |
|
341 this, SLOT(findItem(QString))); |
|
342 |
|
343 |
|
344 } |
|
345 |
|
346 /*! |
|
347 Disconnects signals \a exitClicked and \a criteriaChanged emitted |
|
348 by search panel from handling slots of the object or its members |
|
349 Scrolls view to state before connections. |
|
350 */ |
|
351 void HsMenuView::disconnectSearchPanelSignals() |
|
352 { |
|
353 disconnect(mSearchPanel, SIGNAL(exitClicked()), |
|
354 this, SLOT(hideSearchPanel())); |
|
355 |
|
356 disconnect(mSearchPanel, SIGNAL(criteriaChanged(QString)), |
|
357 this, SLOT(findItem(QString))); |
|
358 |
|
359 } |
|
360 |
|
361 |
|
362 /*! |
|
363 Looks up for item and if found scrolls to it. |
|
364 \param criteriaStr The item name to find. |
|
365 */ |
|
366 void HsMenuView::findItem(QString criteriaStr) |
|
367 { |
|
368 qDebug() << QString("hsmenuview::findItem: %1").arg(criteriaStr); |
|
369 HSMENUTEST_FUNC_ENTRY("hsmenuview::findItem"); |
|
370 |
|
371 mProxyModel->invalidate(); |
|
372 mProxyModel->setSourceModel(mListView->model()); |
|
373 mProxyModel->setFilterRegExp(QRegExp( |
|
374 QString("(^|\\b)%1").arg(criteriaStr), Qt::CaseInsensitive)); |
|
375 |
|
376 mSearchListView->scrollTo(mProxyModel->index(0,0), |
|
377 HbAbstractItemView::PositionAtTop); |
|
378 |
|
379 HSMENUTEST_FUNC_EXIT("hsmenuview::findItem"); |
|
380 } |
|
381 |
|
382 /*! |
|
383 Makes the view display search panel with view representing search results. |
|
384 */ |
|
385 void HsMenuView::searchBegins() |
|
386 { |
|
387 HSMENUTEST_FUNC_ENTRY("hsmenuview::searchBegins"); |
|
388 |
|
389 |
|
390 mBuilder.setViewContext(mViewContext); |
|
391 mBuilder.setOperationalContext(HsSearchContext); |
|
392 mBuilder.build(); |
|
393 mSearchListView = mBuilder.currentListView(); |
|
394 mSearchPanel = mBuilder.currentSearchPanel(); |
|
395 |
|
396 mView->hideItems(Hb::AllItems); |
|
397 |
|
398 mProxyModel->invalidate(); |
|
399 mProxyModel->setSourceModel(mListView->model()); |
|
400 mProxyModel->setFilterRegExp(QRegExp(QString(".*"), Qt::CaseInsensitive, |
|
401 QRegExp::RegExp)); |
|
402 mSearchListView->setModel(mProxyModel); |
|
403 mSearchListView->setItemPrototype(new HsListViewItem()); |
|
404 |
|
405 mSearchListView->scrollTo( |
|
406 mProxyModel->mapFromSource(mSearchViewInitialIndex), |
|
407 HbAbstractItemView::PositionAtTop); |
|
408 HSMENUTEST_FUNC_EXIT("hsmenuview::searchBegins"); |
|
409 } |
|
410 |
|
411 /*! |
|
412 Ensures view does not contain search related elements and is scrolled |
|
413 to item chosen in search mode. |
|
414 */ |
|
415 void HsMenuView::searchFinished() |
|
416 { |
|
417 HSMENUTEST_FUNC_ENTRY("hsmenuview::searchFinished"); |
|
418 |
|
419 mBuilder.setViewContext(mViewContext); |
|
420 mBuilder.setOperationalContext(HsItemViewContext); |
|
421 mBuilder.build(); |
|
422 mView->showItems(Hb::AllItems); |
|
423 |
|
424 const QModelIndex indexToScroll = |
|
425 mProxyModel->mapToSource(mIndexToScrollAfterSearchDone); |
|
426 |
|
427 mListView->scrollTo(indexToScroll, HbAbstractItemView::PositionAtTop); |
|
428 |
|
429 mSearchListView = NULL; |
|
430 mSearchPanel = NULL; |
|
431 HSMENUTEST_FUNC_EXIT("hsmenuview::searchFinished"); |
|
432 } |
|
433 |
|
434 /*! |
|
435 Slot used to translate activated signal from proxy model to normal model. |
|
436 \param index representing an item activated in search list view. |
|
437 */ |
|
438 void HsMenuView::activatedProxySlot(const QModelIndex &index) |
|
439 { |
|
440 emit activated(mProxyModel->mapToSource(index)); |
|
441 } |
|
442 |
|
443 /*! |
|
444 Slot used to forward 'long pressed' signal with item description transladed |
|
445 from search view context to context of the view search was requested from. |
|
446 */ |
|
447 void HsMenuView::longPressedProxySlot(HbAbstractViewItem *item, |
|
448 const QPointF &coords) |
|
449 { |
|
450 /* |
|
451 this is a kind of hack, introduced for reasons: |
|
452 item object should be reusable later, but orbit (or qt) prevents setting |
|
453 its index model to previous state |
|
454 */ |
|
455 mSearchViewLongPressedIndex = |
|
456 mProxyModel->mapToSource(item->modelIndex()); |
|
457 QScopedPointer<HbAbstractViewItem> itemNew(item->createItem()); |
|
458 itemNew->setModelIndex(mSearchViewLongPressedIndex); |
|
459 emit longPressed(itemNew.data(), coords); |
|
460 } |
|
461 |
|
462 /*! |
|
463 Add the view to main window and search action with \a showSearchPanel |
|
464 slot of the window. |
244 slot of the window. |
465 */ |
245 */ |
466 void HsMenuView::activate() |
246 void HsMenuView::activate() |
467 { |
247 { |
|
248 mMainWindow.setCurrentView(mView); |
468 connect(mBuilder.searchAction(), SIGNAL(triggered()), |
249 connect(mBuilder.searchAction(), SIGNAL(triggered()), |
469 this, SLOT(showSearchPanel())); |
250 this, SLOT(showSearchPanel()), Qt::UniqueConnection); |
470 } |
251 } |
471 |
252 |
472 /*! |
253 /*! |
473 Disconnecs search action and \a showSearchPanel slot of the window. |
254 Disconnects search action and disconnects \a showSearchPanel slot from the window. |
474 */ |
255 */ |
475 void HsMenuView::inactivate() |
256 void HsMenuView::inactivate() |
476 { |
257 { |
477 // handle app key event |
258 // handle app key event |
478 mBuilder.toolBarExtension()->close(); |
259 mBuilder.toolBarExtension()->close(); |
479 |
260 |
480 disconnect(mBuilder.searchAction(), SIGNAL(triggered()), |
261 disconnect(mBuilder.searchAction(), SIGNAL(triggered()), |
481 this, SLOT(showSearchPanel())); |
262 this, SLOT(showSearchPanel())); |
482 } |
263 } |
|
264 |
|
265 /*! |
|
266 Makes a new view to be activated. Ensure navigation action and view label |
|
267 heading are preserved after reset. |
|
268 \param operationalContext Context indicating which view to activate. |
|
269 */ |
|
270 void HsMenuView::reset(HsOperationalContext operationalContext) |
|
271 { |
|
272 QString viewLabelHeading; |
|
273 |
|
274 // before changing context read current view label heading ... |
|
275 synchronizeCache(); |
|
276 |
|
277 if (mBuilder.currentViewLabel() != 0) { |
|
278 viewLabelHeading = mBuilder.currentViewLabel()->heading(); |
|
279 } |
|
280 // ... and back-key action |
|
281 HbAction *const backKeyAction(mView->navigationAction()); |
|
282 |
|
283 // now we can switch the context |
|
284 |
|
285 if (operationalContext != HsSearchContext) { |
|
286 |
|
287 mOperationalContext = operationalContext; |
|
288 synchronizeCache(); |
|
289 |
|
290 if (mBuilder.currentViewLabel() != 0) { |
|
291 mBuilder.currentViewLabel()->setHeading(viewLabelHeading); |
|
292 } |
|
293 |
|
294 mView->setNavigationAction(backKeyAction); |
|
295 |
|
296 } else { |
|
297 showSearchPanel(); |
|
298 } |
|
299 } |
|
300 |
|
301 /*! |
|
302 Builder can be shared between many instances of HsMenuView |
|
303 being in different contexts. Before using builder make sure |
|
304 it is in context matching the current HsMenuView. |
|
305 */ |
|
306 |
|
307 void HsMenuView::switchBuilderContext() { |
|
308 mBuilder.setStateContext(mStateContext); |
|
309 mBuilder.setOperationalContext(mOperationalContext); |
|
310 } |
|
311 |
|
312 /*! |
|
313 Updates internal data references to widgets. |
|
314 */ |
|
315 void HsMenuView::synchronizeCache() |
|
316 { |
|
317 switchBuilderContext(); |
|
318 |
|
319 mView = mBuilder.currentView(); |
|
320 mListView = mBuilder.currentListView(); |
|
321 mViewLabel = mBuilder.currentViewLabel(); |
|
322 mAddContentButton = mBuilder.currentAddContentButton(); |
|
323 } |