327 { |
327 { |
328 Hs::HsContextAction command = |
328 Hs::HsContextAction command = |
329 static_cast<Hs::HsContextAction>(action->data().toInt()); |
329 static_cast<Hs::HsContextAction>(action->data().toInt()); |
330 |
330 |
331 const int itemId = mContextModelIndex.data(CaItemModel::IdRole).toInt(); |
331 const int itemId = mContextModelIndex.data(CaItemModel::IdRole).toInt(); |
332 |
|
333 switch (command) { |
|
334 case Hs::AddToHomeScreenContextAction: |
|
335 addToHomeScreen(itemId); |
|
336 break; |
|
337 case Hs::AddToCollectionFromApplicationsViewContextAction: |
|
338 // Addding a specific application to |
|
339 // an existing collection via item specific menu. |
|
340 machine()->postEvent( |
|
341 HsMenuEventFactory::createAddAppsFromApplicationsViewEvent( |
|
342 Hs::NoHsSortAttribute, itemId)); |
|
343 break; |
|
344 case Hs::AddToCollectionFromCollectionViewContextAction: |
|
345 machine()->postEvent( |
|
346 HsMenuEventFactory::createAddAppsFromCollectionViewEvent( |
|
347 -1, itemId)); |
|
348 break; |
|
349 case Hs::UninstallContextAction: |
|
350 machine()->postEvent( |
|
351 HsMenuEventFactory::createUninstallApplicationEvent( |
|
352 itemId)); |
|
353 break; |
|
354 case Hs::AppSettingContextAction: |
|
355 machine()->postEvent( |
|
356 HsMenuEventFactory::createAppSettingsViewEvent(itemId)); |
|
357 break; |
|
358 case Hs::AppDetailsContextAction: |
|
359 machine()->postEvent( |
|
360 HsMenuEventFactory::createAppDetailsViewEvent(itemId)); |
|
361 break; |
|
362 case Hs::OpenAppContextAction: |
|
363 launchItem(mContextModelIndex); |
|
364 break; |
|
365 case Hs::RenameCollectionContextAction: |
|
366 machine()->postEvent( |
|
367 HsMenuEventFactory::createRenameCollectionEvent(itemId)); |
|
368 break; |
|
369 case Hs::DeleteCollectionContextAction: |
|
370 machine()->postEvent( |
|
371 HsMenuEventFactory::createDeleteCollectionEvent(itemId)); |
|
372 break; |
|
373 case Hs::OpenCollectionContextAction: |
|
374 openCollection(mContextModelIndex); |
|
375 break; |
|
376 default: |
|
377 break; |
|
378 } |
|
379 |
332 |
380 HsMenuService::touch(itemId); |
333 if (itemId > 0) { |
|
334 switch (command) { |
|
335 case Hs::AddToHomeScreenContextAction: |
|
336 addToHomeScreen(itemId); |
|
337 break; |
|
338 case Hs::AddToCollectionFromApplicationsViewContextAction: |
|
339 // Addding a specific application to |
|
340 // an existing collection via item specific menu. |
|
341 machine()->postEvent( |
|
342 HsMenuEventFactory::createAddAppsFromApplicationsViewEvent( |
|
343 Hs::NoHsSortAttribute, itemId)); |
|
344 break; |
|
345 case Hs::AddToCollectionFromCollectionViewContextAction: |
|
346 machine()->postEvent( |
|
347 HsMenuEventFactory::createAddAppsFromCollectionViewEvent( |
|
348 -1, itemId)); |
|
349 break; |
|
350 case Hs::UninstallContextAction: |
|
351 machine()->postEvent( |
|
352 HsMenuEventFactory::createUninstallApplicationEvent( |
|
353 itemId)); |
|
354 break; |
|
355 case Hs::AppSettingContextAction: |
|
356 machine()->postEvent( |
|
357 HsMenuEventFactory::createAppSettingsViewEvent(itemId)); |
|
358 break; |
|
359 case Hs::AppDetailsContextAction: |
|
360 machine()->postEvent( |
|
361 HsMenuEventFactory::createAppDetailsViewEvent(itemId)); |
|
362 break; |
|
363 case Hs::OpenAppContextAction: |
|
364 launchItem(mContextModelIndex); |
|
365 break; |
|
366 case Hs::RenameCollectionContextAction: |
|
367 machine()->postEvent( |
|
368 HsMenuEventFactory::createRenameCollectionEvent(itemId)); |
|
369 break; |
|
370 case Hs::DeleteCollectionContextAction: |
|
371 machine()->postEvent( |
|
372 HsMenuEventFactory::createDeleteCollectionEvent(itemId)); |
|
373 break; |
|
374 case Hs::OpenCollectionContextAction: |
|
375 openCollection(mContextModelIndex); |
|
376 break; |
|
377 default: |
|
378 break; |
|
379 } |
|
380 HsMenuService::touch(itemId); |
|
381 } else { |
|
382 closeContextMenu(); |
|
383 } |
381 } |
384 } |
382 |
385 |
383 /*! |
386 /*! |
384 Slot connected to List widget in add mode. |
387 Slot connected to List widget in add mode. |
385 \param index Model index of the activated item. |
388 \param index Model index of the activated item. |
459 *mMenuMode, Hs::NormalHsMenuMode, normalModeState)); |
462 *mMenuMode, Hs::NormalHsMenuMode, normalModeState)); |
460 initialState->addTransition(new HsMenuModeTransition( |
463 initialState->addTransition(new HsMenuModeTransition( |
461 *mMenuMode, Hs::AddHsMenuMode, addModeState)); |
464 *mMenuMode, Hs::AddHsMenuMode, addModeState)); |
462 } |
465 } |
463 |
466 |
|
467 /*! |
|
468 Triggers event so that an installed applications state is entered. |
|
469 */ |
|
470 #ifdef COVERAGE_MEASUREMENT |
|
471 #pragma CTC SKIP |
|
472 #endif //COVERAGE_MEASUREMENT |
|
473 void HsBaseViewState::openInstalledView() |
|
474 { |
|
475 machine()->postEvent(HsMenuEventFactory::createOpenInstalledViewEvent()); |
|
476 } |
|
477 #ifdef COVERAGE_MEASUREMENT |
|
478 #pragma CTC ENDSKIP |
|
479 #endif //COVERAGE_MEASUREMENT |