34 #include "hsmenumodewrapper.h" |
34 #include "hsmenumodewrapper.h" |
35 #include "hsmenuviewbuilder.h" |
35 #include "hsmenuviewbuilder.h" |
36 #include "hsmenumodetransition.h" |
36 #include "hsmenumodetransition.h" |
37 #include "caentry.h" |
37 #include "caentry.h" |
38 #include "caservice.h" |
38 #include "caservice.h" |
|
39 #include "hsmainwindow.h" |
39 |
40 |
40 /*! |
41 /*! |
41 \class HsAllAppsState |
42 \class HsAllAppsState |
42 \ingroup group_hsmenustateplugin |
43 \ingroup group_hsmenustateplugin |
43 \brief All Applications State. |
44 \brief All Applications State. |
73 \param menuMode reference to object representing menu mode (add mode on/add mode off). |
74 \param menuMode reference to object representing menu mode (add mode on/add mode off). |
74 \param parent Owner. |
75 \param parent Owner. |
75 */ |
76 */ |
76 HsAllAppsState::HsAllAppsState(HsMenuViewBuilder &menuViewBuilder, |
77 HsAllAppsState::HsAllAppsState(HsMenuViewBuilder &menuViewBuilder, |
77 HsMenuModeWrapper &menuMode, |
78 HsMenuModeWrapper &menuMode, |
|
79 HsMainWindow &mainWindow, |
78 QState *parent) : |
80 QState *parent) : |
79 QState(parent), mSortAttribute(AscendingNameHsSortAttribute), |
81 QState(parent), mSortAttribute(AscendingNameHsSortAttribute), |
80 mCollectionsSortAttribute(LatestOnTopHsSortAttribute), |
82 mCollectionsSortAttribute(LatestOnTopHsSortAttribute), |
81 mMenuView(menuViewBuilder, HsAllAppsContext), |
83 mMenuView(menuViewBuilder, HsAllAppsContext), |
82 mMenuMode(menuMode), |
84 mMenuMode(menuMode), |
83 mAllAppsModel(0), mContextModelIndex(), mContextMenu(0) |
85 mAllAppsModel(0), |
|
86 mMainWindow(mainWindow), |
|
87 mContextModelIndex(), mContextMenu(0) |
84 { |
88 { |
85 construct(); |
89 construct(); |
86 } |
90 } |
87 |
91 |
88 /*! |
92 /*! |
205 void HsAllAppsState::stateEntered() |
209 void HsAllAppsState::stateEntered() |
206 { |
210 { |
207 qDebug("AllAppsState::stateEntered()"); |
211 qDebug("AllAppsState::stateEntered()"); |
208 HSMENUTEST_FUNC_ENTRY("HsAllAppsState::stateEntered"); |
212 HSMENUTEST_FUNC_ENTRY("HsAllAppsState::stateEntered"); |
209 |
213 |
|
214 mMainWindow.setCurrentView(mMenuView); |
210 mMenuView.activate(); |
215 mMenuView.activate(); |
211 |
216 |
212 HSMENUTEST_FUNC_EXIT("HsAllAppsState::stateEntered"); |
217 HSMENUTEST_FUNC_EXIT("HsAllAppsState::stateEntered"); |
213 } |
218 } |
214 |
219 |
343 |
348 |
344 HbAction *uninstallAction = mContextMenu->addAction(hbTrId( |
349 HbAction *uninstallAction = mContextMenu->addAction(hbTrId( |
345 "txt_common_menu_delete")); |
350 "txt_common_menu_delete")); |
346 uninstallAction->setData(UninstallContextAction); |
351 uninstallAction->setData(UninstallContextAction); |
347 HbAction *appSettingsAction(NULL); |
352 HbAction *appSettingsAction(NULL); |
|
353 HbAction *appDetailsAction(NULL); |
348 |
354 |
349 // check conditions and hide irrelevant menu items |
355 // check conditions and hide irrelevant menu items |
350 |
356 |
351 QSharedPointer<const CaEntry> entry = mAllAppsModel->entry(item->modelIndex()); |
357 QSharedPointer<const CaEntry> entry = mAllAppsModel->entry(item->modelIndex()); |
352 |
358 |
353 if (!(entry->attribute(appSettingsPlugin()).isEmpty())) { |
359 if (!(entry->attribute(appSettingsPlugin()).isEmpty())) { |
354 appSettingsAction = mContextMenu->addAction(hbTrId( |
360 appSettingsAction = mContextMenu->addAction(hbTrId( |
355 "txt_common_menu_settings")); |
361 "txt_common_menu_settings")); |
356 appSettingsAction->setData(AppSettingContextAction); |
362 appSettingsAction->setData(AppSettingContextAction); |
357 } |
363 } |
|
364 if (!(entry->attribute(componentIdAttributeName()).isEmpty()) && |
|
365 entry->entryTypeName() == applicationTypeName() ) { |
|
366 appDetailsAction = mContextMenu->addAction(hbTrId( |
|
367 "txt_common_menu_details")); |
|
368 appDetailsAction->setData(AppDetailsContextAction); |
|
369 } |
|
370 |
358 EntryFlags flags = item->modelIndex().data( |
371 EntryFlags flags = item->modelIndex().data( |
359 CaItemModel::FlagsRole).value<EntryFlags> (); |
372 CaItemModel::FlagsRole).value<EntryFlags> (); |
360 |
373 |
361 if (!(flags & RemovableEntryFlag)) { |
374 if (!(flags & RemovableEntryFlag)) { |
362 uninstallAction->setVisible(false); |
375 uninstallAction->setVisible(false); |
397 break; |
410 break; |
398 case AppSettingContextAction: |
411 case AppSettingContextAction: |
399 machine()->postEvent( |
412 machine()->postEvent( |
400 HsMenuEventFactory::createAppSettingsViewEvent(itemId)); |
413 HsMenuEventFactory::createAppSettingsViewEvent(itemId)); |
401 break; |
414 break; |
|
415 case AppDetailsContextAction: |
|
416 machine()->postEvent( |
|
417 HsMenuEventFactory::createAppDetailsViewEvent(itemId)); |
|
418 break; |
402 default: |
419 default: |
403 break; |
420 break; |
404 } |
421 } |
405 |
422 |
406 mMenuView.setSearchPanelVisible(false); |
423 mMenuView.setSearchPanelVisible(false); |