121 |
121 |
122 QState *initialState = new QState(this); |
122 QState *initialState = new QState(this); |
123 setInitialState(initialState); |
123 setInitialState(initialState); |
124 |
124 |
125 mHistoryTransaction = new HsMenuModeTransition( |
125 mHistoryTransaction = new HsMenuModeTransition( |
126 mMenuMode, NormalHsMenuMode, mAllAppsState); |
126 mMenuMode, Hs::NormalHsMenuMode, mAllAppsState); |
127 |
127 |
128 initialState->addTransition(mHistoryTransaction); |
128 initialState->addTransition(mHistoryTransaction); |
129 initialState->addTransition(new HsMenuModeTransition( |
129 initialState->addTransition(new HsMenuModeTransition( |
130 mMenuMode, AddHsMenuMode, mAllAppsState)); |
130 mMenuMode, Hs::AddHsMenuMode, mAllAppsState)); |
131 |
131 |
132 mCollectionState = new HsCollectionState(mMenuViewBuilder, |
132 mCollectionState = new HsCollectionState(mMenuViewBuilder, |
133 mMenuMode, |
133 mMenuMode, |
134 mMainWindow, |
134 mMainWindow, |
135 this); |
135 this); |
195 { |
195 { |
196 qDebug("HsCollectionState::onEntry()"); |
196 qDebug("HsCollectionState::onEntry()"); |
197 HSMENUTEST_FUNC_ENTRY("HsAppLibraryState::onEntry"); |
197 HSMENUTEST_FUNC_ENTRY("HsAppLibraryState::onEntry"); |
198 QState::onEntry(event); |
198 QState::onEntry(event); |
199 |
199 |
200 if (static_cast<HsMenuEvent *>(event)->operation() != |
|
201 HsMenuEvent::OpenCollectionFromAppLibrary) |
|
202 { |
|
203 // we are back from HS, scroll those views to top |
|
204 mAllAppsState->scrollToBeginning(); |
|
205 mAllCollectionsState->scrollToBeginning(); |
|
206 } |
|
207 |
|
208 if (event->type() == HsMenuEvent::eventType()) { |
200 if (event->type() == HsMenuEvent::eventType()) { |
209 HsMenuEvent *menuEvent = static_cast<HsMenuEvent *>(event); |
201 HsMenuEvent *menuEvent = static_cast<HsMenuEvent *>(event); |
210 QVariantMap data = menuEvent->data(); |
202 QVariantMap data = menuEvent->data(); |
211 mMenuMode.setHsMenuMode( |
203 mMenuMode.setHsMenuMode( |
212 static_cast<HsMenuMode>(data.value(menuModeType()).toInt()), |
204 static_cast<Hs::HsMenuMode>(data.value(Hs::menuModeType).toInt()), |
213 data.value(HOMESCREENDATA)); |
205 data.value(Hs::homescreenData)); |
214 } else { |
206 } else { |
215 mMenuMode.setHsMenuMode(NormalHsMenuMode); |
207 mMenuMode.setHsMenuMode(Hs::NormalHsMenuMode); |
|
208 } |
|
209 |
|
210 if (event->type() != HsMenuEvent::eventType() || |
|
211 static_cast<HsMenuEvent *>(event)->operation() != |
|
212 HsMenuEvent::OpenCollectionFromAppLibrary) { |
|
213 // we are back from HS, scroll those views to top |
|
214 mAllAppsState->setModel(mMenuMode.getHsMenuMode()); |
|
215 mAllAppsState->scrollToBeginning(); |
|
216 mAllCollectionsState->scrollToBeginning(); |
216 } |
217 } |
217 |
218 |
218 HSMENUTEST_FUNC_EXIT("HsAppLibraryState::onEntry"); |
219 HSMENUTEST_FUNC_EXIT("HsAppLibraryState::onEntry"); |
219 } |
220 } |
220 |
221 |
249 HbAction *const operatorAction( |
250 HbAction *const operatorAction( |
250 operatorHandler->prepareOperatorStoreAction( |
251 operatorHandler->prepareOperatorStoreAction( |
251 mMenuViewBuilder.operatorAction())); |
252 mMenuViewBuilder.operatorAction())); |
252 operatorAction->setText(hbTrId(operatorHandler->text().toLatin1())); |
253 operatorAction->setText(hbTrId(operatorHandler->text().toLatin1())); |
253 |
254 |
254 //TODO: no locstring for ovi store currently |
255 mMenuViewBuilder.oviStoreAction()->setText(hbTrId("txt_applib_grid_ovi_store")); |
255 mMenuViewBuilder.oviStoreAction()->setText("Ovi Store"); |
|
256 if (operatorHandler->operatorStoreFirst()) { |
256 if (operatorHandler->operatorStoreFirst()) { |
257 extension->addAction(operatorAction); |
257 extension->addAction(operatorAction); |
258 extension->addAction(mMenuViewBuilder.oviStoreAction()); |
258 extension->addAction(mMenuViewBuilder.oviStoreAction()); |
259 } else { |
259 } else { |
260 extension->addAction(mMenuViewBuilder.oviStoreAction()); |
260 extension->addAction(mMenuViewBuilder.oviStoreAction()); |
312 int HsAppLibraryState::oviStoreAction() |
312 int HsAppLibraryState::oviStoreAction() |
313 { |
313 { |
314 HSMENUTEST_FUNC_ENTRY("HsAppLibraryState::oviStoreAction"); |
314 HSMENUTEST_FUNC_ENTRY("HsAppLibraryState::oviStoreAction"); |
315 |
315 |
316 CaEntry oviEntry; |
316 CaEntry oviEntry; |
317 oviEntry.setEntryTypeName(applicationTypeName()); |
317 oviEntry.setEntryTypeName(Hs::applicationTypeName); |
318 oviEntry.setAttribute( applicationUidEntryKey(), |
318 oviEntry.setAttribute( Hs::applicationUidEntryKey, |
319 QString::number(oviLauncherApplicationUid)); |
319 QString::number(Hs::oviLauncherApplicationUid)); |
320 |
320 |
321 int result = CaService::instance()->executeCommand(oviEntry); |
321 int result = CaService::instance()->executeCommand(oviEntry); |
322 if (result) { |
322 if (result) { |
323 oviEntry.setEntryTypeName(urlTypeName()); |
323 oviEntry.setEntryTypeName(Hs::urlTypeName); |
324 oviEntry.setAttribute(urlEntryKey(), |
324 oviEntry.setAttribute(Hs::urlEntryKey, |
325 QString("https://store.ovi.com/applications/")); |
325 QString("https://store.ovi.com/applications/")); |
326 result = CaService::instance()->executeCommand(oviEntry); |
326 result = CaService::instance()->executeCommand(oviEntry); |
327 } |
327 } |
328 |
328 |
329 HSMENUTEST_FUNC_EXIT("HsAppLibraryState::oviStoreAction"); |
329 HSMENUTEST_FUNC_EXIT("HsAppLibraryState::oviStoreAction"); |
333 /*! |
333 /*! |
334 All apps stete entered. |
334 All apps stete entered. |
335 */ |
335 */ |
336 void HsAppLibraryState::allAppsStateEntered() |
336 void HsAppLibraryState::allAppsStateEntered() |
337 { |
337 { |
338 if (mMenuMode.getHsMenuMode() == NormalHsMenuMode) { |
338 if (mMenuMode.getHsMenuMode() == Hs::NormalHsMenuMode) { |
339 mHistoryTransaction->setTargetState(mAllAppsState); |
339 mHistoryTransaction->setTargetState(mAllAppsState); |
340 } |
340 } |
341 } |
341 } |
342 |
342 |
343 /*! |
343 /*! |
344 All collections state entered. |
344 All collections state entered. |
345 */ |
345 */ |
346 void HsAppLibraryState::allCollectionsStateEntered() |
346 void HsAppLibraryState::allCollectionsStateEntered() |
347 { |
347 { |
348 if (mMenuMode.getHsMenuMode() == NormalHsMenuMode) { |
348 if (mMenuMode.getHsMenuMode() == Hs::NormalHsMenuMode) { |
349 mHistoryTransaction->setTargetState(mAllCollectionsState); |
349 mHistoryTransaction->setTargetState(mAllCollectionsState); |
350 } |
350 } |
351 } |
351 } |
352 |
352 |
353 |
353 |