144 } |
159 } |
145 _AKNTRACE_FUNC_EXIT; |
160 _AKNTRACE_FUNC_EXIT; |
146 } |
161 } |
147 |
162 |
148 |
163 |
149 void CEikMenuBarExtension::SetItemCommandsDimmedL() |
164 void CEikMenuBarExtension::SetItemCommandsStateL() |
150 { |
165 { |
151 if ( !iItemActionMenu ) |
166 if ( iSingleClickEnabled && !iItemActionMenu ) |
152 { |
167 { |
153 AknItemActionMenuRegister::RegisterMenuBarL( *iBar ); |
168 AknItemActionMenuRegister::RegisterMenuBarL( *iBar ); |
154 } |
169 } |
155 // hide item-specific commands if highlight not visible |
170 |
156 if ( iBar->GetMenuType() != CEikMenuBar::EMenuContext |
171 // Hide item-specific commands if highlight not visible |
157 && ( ( iItemActionMenu |
172 // or show only item specific commands if list is in multiple marking |
158 && !iItemActionMenu->CollectionHighlightVisible() ) |
173 // state |
159 || !iItemActionMenu ) ) |
174 if ( iBar->GetMenuType() != CEikMenuBar::EMenuContext ) |
160 { |
175 { |
161 iBar->iMenuPane->SetItemCommandsDimmed(); |
176 if ( iItemActionMenu ) |
162 } |
177 { |
|
178 TBool dimCommands( EFalse ); |
|
179 TBool changeState( EFalse ); |
|
180 if ( iItemActionMenu->MarkingMode().MultipleMarkingActive() ) |
|
181 { |
|
182 changeState = ETrue; |
|
183 dimCommands = EFalse; |
|
184 } |
|
185 else if ( !iItemActionMenu->CollectionHighlightVisible() ) |
|
186 { |
|
187 changeState = ETrue; |
|
188 dimCommands = ETrue; |
|
189 } |
|
190 if ( changeState ) |
|
191 { |
|
192 iBar->iMenuPane->SetItemCommandsStateL( dimCommands ); |
|
193 } |
|
194 } |
|
195 else if ( iSingleClickEnabled ) |
|
196 { |
|
197 // Dim tagged item action and item specific commands |
|
198 // anyway, fixes case where listbox creation is not |
|
199 // finished yet when options menu is opened |
|
200 iBar->iMenuPane->SetItemCommandsStateL( ETrue ); |
|
201 } |
|
202 } |
|
203 } |
|
204 |
|
205 CAknMarkingMode* CEikMenuBarExtension::MarkingModeActive() |
|
206 { |
|
207 CAknMarkingMode* markingMode( NULL ); |
|
208 if ( iItemActionMenu |
|
209 && iItemActionMenu->MarkingMode().MultipleMarkingActive() ) |
|
210 { |
|
211 markingMode = &iItemActionMenu->MarkingMode(); |
|
212 } |
|
213 return markingMode; |
163 } |
214 } |
164 |
215 |
165 |
216 |
166 void CEikMenuBarExtension::StoreCollectionHighlightValue() |
217 void CEikMenuBarExtension::StoreCollectionHighlightValue() |
167 { |
218 { |
883 fepMenuObserver->DynInitMenuBarL(iMenuTitleResourceId, this); |
938 fepMenuObserver->DynInitMenuBarL(iMenuTitleResourceId, this); |
884 } |
939 } |
885 |
940 |
886 TInt titles = iTitleArray->Count() - 1; |
941 TInt titles = iTitleArray->Count() - 1; |
887 |
942 |
|
943 CAknMarkingMode* marking( NULL ); |
|
944 if ( iExt ) |
|
945 { |
|
946 marking = iExt->MarkingModeActive(); |
|
947 } |
|
948 |
888 if ( titles < 0 ) |
949 if ( titles < 0 ) |
889 { |
950 { |
890 delete iMenuCba; |
951 delete iMenuCba; |
891 iMenuCba = NULL; |
952 iMenuCba = NULL; |
892 iTitleArray->ResetAndDestroy(); |
953 iTitleArray->ResetAndDestroy(); |
893 iMenuPane->Close(); |
954 iMenuPane->Close(); |
894 return; |
955 return; |
895 } |
956 } |
896 |
957 |
897 // Create the menu pane using the last pane in the menu bar |
958 TBool markedItems( EFalse ); |
898 iMenuObserver->RestoreMenuL(iMenuPane,(*iTitleArray)[titles]->iData.iMenuPaneResourceId,MEikMenuObserver::EMenuPane); |
959 if ( marking ) |
899 if (fepMenuObserver) |
960 { |
900 fepMenuObserver->DynInitMenuPaneL((*iTitleArray)[titles]->iData.iMenuPaneResourceId,iMenuPane); |
961 markedItems = marking->MarkedItems(); |
901 if (iActiveEditMenuObserver) |
962 } |
902 iActiveEditMenuObserver->DynInitMenuPaneL((*iTitleArray)[titles]->iData.iMenuPaneResourceId,iMenuPane); |
963 // In marking mode do not add commands if no marked items in list |
903 |
964 if ( !marking || markedItems ) |
904 titles = iTitleArray->Count() - 2; |
965 { |
905 iMenuPane->FilterDimmedItems(); |
966 // Create the menu pane using the last pane in the menu bar |
906 |
967 iMenuObserver->RestoreMenuL( |
907 // Add the remaining menu panes from right to left at the end of the current pane |
968 iMenuPane, |
908 while (titles >= 0) |
969 ( *iTitleArray )[ titles ]->iData.iMenuPaneResourceId, |
909 { |
970 MEikMenuObserver::EMenuPane ); |
910 TInt resource = (*iTitleArray)[titles]->iData.iMenuPaneResourceId; |
971 if ( fepMenuObserver ) |
911 iMenuPane->AddMenuItemsL(resource, 0, ETrue); |
972 fepMenuObserver->DynInitMenuPaneL( |
912 iMenuObserver->DynInitMenuPaneL(resource,iMenuPane); |
973 ( *iTitleArray )[ titles ]->iData.iMenuPaneResourceId, |
913 if (fepMenuObserver) |
974 iMenuPane ); |
914 fepMenuObserver->DynInitMenuPaneL(resource,iMenuPane); |
975 if ( iActiveEditMenuObserver ) |
915 if (iActiveEditMenuObserver) |
976 iActiveEditMenuObserver->DynInitMenuPaneL( |
916 iActiveEditMenuObserver->DynInitMenuPaneL(resource,iMenuPane); |
977 ( *iTitleArray )[ titles ]->iData.iMenuPaneResourceId, |
917 iExt->SetItemCommandsDimmedL(); |
978 iMenuPane ); |
|
979 |
|
980 titles = iTitleArray->Count() - 2; |
918 iMenuPane->FilterDimmedItems(); |
981 iMenuPane->FilterDimmedItems(); |
919 titles--; |
982 |
920 } |
983 // Add the remaining menu panes from right to left |
|
984 // at the end of the current pane |
|
985 while ( titles >= 0 ) |
|
986 { |
|
987 TInt resource = |
|
988 ( *iTitleArray )[ titles ]->iData.iMenuPaneResourceId; |
|
989 iMenuPane->AddMenuItemsL( resource, 0, ETrue ); |
|
990 iMenuObserver->DynInitMenuPaneL( resource, iMenuPane ); |
|
991 if ( fepMenuObserver ) |
|
992 fepMenuObserver->DynInitMenuPaneL( resource, iMenuPane ); |
|
993 if ( iActiveEditMenuObserver ) |
|
994 iActiveEditMenuObserver->DynInitMenuPaneL( |
|
995 resource,iMenuPane ); |
|
996 |
|
997 if ( resource == R_AVKON_MENUPANE_MARK_MULTIPLE ) |
|
998 { |
|
999 iMenuPane->SetItemDimmed( EAknCmdMarkingModeMarkOne, ETrue ); |
|
1000 } |
|
1001 |
|
1002 titles--; |
|
1003 } |
|
1004 iExt->SetItemCommandsStateL(); |
|
1005 iMenuPane->FilterDimmedItems(); |
|
1006 } |
|
1007 |
|
1008 // Multiple marking mode active |
|
1009 if ( marking ) |
|
1010 { |
|
1011 iMenuPane->AddMenuItemsL( R_AVKON_MENUPANE_MARK_MULTIPLE, 0, ETrue ); |
|
1012 |
|
1013 if ( !marking->CollectionEmpty() ) |
|
1014 { |
|
1015 iMenuPane->SetItemDimmed( EAknCmdMarkingModeMarkAll, EFalse ); |
|
1016 } |
|
1017 |
|
1018 if ( markedItems ) |
|
1019 { |
|
1020 iMenuPane->SetItemDimmed( EAknCmdMarkingModeUnmarkAll, EFalse ); |
|
1021 } |
|
1022 |
|
1023 iMenuPane->SetItemDimmed( EAknCmdMarkingModeMarkOne, ETrue ); |
|
1024 iMenuPane->SetItemDimmed( EAknCmdMarkingModeEnter, ETrue ); |
|
1025 iMenuPane->FilterDimmedItems(); |
|
1026 } |
|
1027 |
921 iMenuObserver->SetEmphasis(this,ETrue); |
1028 iMenuObserver->SetEmphasis(this,ETrue); |
922 iMenuCba = CEikButtonGroupContainer::NewL(CEikButtonGroupContainer::ECba, |
1029 iMenuCba = CEikButtonGroupContainer::NewL(CEikButtonGroupContainer::ECba, |
923 CEikButtonGroupContainer::EHorizontal, |
1030 CEikButtonGroupContainer::EHorizontal, |
924 this, softkeyResourceId, *iMenuPane, |
1031 this, softkeyResourceId, *iMenuPane, |
925 CEikButtonGroupContainer::EIsEmbedded | |
1032 CEikButtonGroupContainer::EIsEmbedded | |
928 CEikCba* cba = static_cast<CEikCba*>( iMenuCba->ButtonGroup() ); |
1035 CEikCba* cba = static_cast<CEikCba*>( iMenuCba->ButtonGroup() ); |
929 if ( cba ) |
1036 if ( cba ) |
930 { |
1037 { |
931 iMenuPane->SetEmbeddedCba( cba ); |
1038 iMenuPane->SetEmbeddedCba( cba ); |
932 } |
1039 } |
933 |
1040 MTouchFeedback* feedback = NULL; |
934 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
1041 if( AknLayoutUtils::PenEnabled() ) |
|
1042 { |
|
1043 feedback = MTouchFeedback::Instance(); |
|
1044 } |
935 if ( feedback ) |
1045 if ( feedback ) |
936 { |
1046 { |
937 feedback->FlushRegistryUpdates(); |
1047 feedback->FlushRegistryUpdates(); |
938 } |
1048 } |
939 |
1049 |
940 TInt taskSwapper ( ETaskSwapper ); |
1050 TInt taskSwapper ( ETaskSwapper ); |
941 RProperty::Get( |
1051 RProperty::Get( |
942 KPSUidAvkonInternal, |
1052 KPSUidAvkonInternal, |
943 KAknMenuOptionNoTaskSwapper, |
1053 KAknMenuOptionNoTaskSwapper, |
944 taskSwapper); |
1054 taskSwapper); |
945 if ( iMenuPane->NumberOfItemsInPane() != 0 && iExt->iMenuType == EMenuOptions && taskSwapper == ETaskSwapper ) |
1055 |
|
1056 if ( iMenuPane->NumberOfItemsInPane() != 0 |
|
1057 && iExt->iMenuType == EMenuOptions |
|
1058 && taskSwapper == ETaskSwapper |
|
1059 && !marking ) |
946 { |
1060 { |
947 // 'Active Applications' menu item is added at the first item of the |
1061 // 'Active Applications' menu item is added at the first item of the |
948 // options menu after other menu items are added. |
1062 // options menu after other menu items are added. |
949 iMenuPane->AddMenuItemsL(R_AVKON_MENUPANE_TASK_SWAPPER); |
1063 iMenuPane->AddMenuItemsL(R_AVKON_MENUPANE_TASK_SWAPPER); |
950 } |
1064 } |
997 if(AknLayoutUtils::PenEnabled()) |
1111 if(AknLayoutUtils::PenEnabled()) |
998 { |
1112 { |
999 // menu pane captures all pointer events, and forwards them to CBA if neccessary |
1113 // menu pane captures all pointer events, and forwards them to CBA if neccessary |
1000 iMenuPane->SetGloballyCapturing(ETrue); |
1114 iMenuPane->SetGloballyCapturing(ETrue); |
1001 iMenuPane->SetPointerCapture(ETrue); |
1115 iMenuPane->SetPointerCapture(ETrue); |
1002 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
|
1003 if ( feedback ) |
|
1004 { |
|
1005 TTouchLogicalFeedback fbLogicalType = ETouchFeedbackPopUp; |
|
1006 if ( CAknTransitionUtils::TransitionsEnabled( AknTransEffect::EComponentTransitionsOff ) ) |
|
1007 { |
|
1008 fbLogicalType = ETouchFeedbackOptionsMenuOpened; |
|
1009 } |
|
1010 feedback->InstantFeedback( |
|
1011 this, |
|
1012 fbLogicalType, |
|
1013 ETouchFeedbackVibra, |
|
1014 TPointerEvent() ); |
|
1015 } |
|
1016 } |
1116 } |
1017 |
1117 |
1018 iMenuPane->MakeVisible( EFalse ); |
1118 iMenuPane->MakeVisible( EFalse ); |
1019 |
1119 |
1020 // options menu launch animation |
1120 // options menu launch animation |
1021 TBool optMenuFg = iAvkonAppUi->IsForeground(); |
1121 TBool optMenuFg = iAvkonAppUi->IsForeground(); |
1022 |
1122 |
1023 if( optMenuFg ) |
1123 if( optMenuFg ) |
1024 { |
1124 { |
1025 GfxTransEffect::Begin( iMenuPane, KGfxControlAppearAction ); |
1125 GfxTransEffect::Begin( iMenuPane, KGfxControlAppearAction ); |
|
1126 if( feedback && CAknTransitionUtils::TransitionsEnabled( AknTransEffect::EComponentTransitionsOff )) |
|
1127 { |
|
1128 TTouchLogicalFeedback fbLogicalType = ETouchFeedbackOptionsMenuOpened; |
|
1129 if( iExt->iMenuType == EMenuContext || iExt->iMenuType == EMenuEdit ) |
|
1130 { |
|
1131 fbLogicalType = ETouchFeedbackIncreasingPopUp; |
|
1132 } |
|
1133 feedback->InstantFeedback( this, fbLogicalType, |
|
1134 ETouchFeedbackVibra, TPointerEvent() ); |
|
1135 } |
1026 } |
1136 } |
1027 |
1137 |
1028 iMenuPane->StartDisplayingMenuPane(NULL, menuPosition, NULL, screenSize.iWidth, EPopupTargetBottomLeft); |
1138 iMenuPane->StartDisplayingMenuPane(NULL, menuPosition, NULL, screenSize.iWidth, EPopupTargetBottomLeft); |
1029 iMenuCba->ActivateL(); |
1139 iMenuCba->ActivateL(); |
1030 |
1140 |
1191 { |
1306 { |
1192 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
1307 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
1193 if ( feedback ) |
1308 if ( feedback ) |
1194 { |
1309 { |
1195 TTouchLogicalFeedback fbLogicalType = ETouchFeedbackPopUp; |
1310 TTouchLogicalFeedback fbLogicalType = ETouchFeedbackPopUp; |
1196 if ( CAknTransitionUtils::TransitionsEnabled( AknTransEffect::EComponentTransitionsOff ) ) |
1311 if ( CAknTransitionUtils::TransitionsEnabled( |
|
1312 AknTransEffect::EComponentTransitionsOff ) ) |
1197 { |
1313 { |
1198 fbLogicalType = ETouchFeedbackOptionsMenuClosed; |
1314 if ( iExt->iMenuType == EMenuContext || |
|
1315 iExt->iMenuType == EMenuEdit ) |
|
1316 { |
|
1317 fbLogicalType = ETouchFeedbackDecreasingPopUp; |
|
1318 } |
|
1319 else |
|
1320 { |
|
1321 fbLogicalType = ETouchFeedbackOptionsMenuClosed; |
|
1322 } |
1199 } |
1323 } |
1200 feedback->InstantFeedback( |
1324 feedback->InstantFeedback( |
1201 this, |
1325 this, |
1202 fbLogicalType, |
1326 fbLogicalType, |
1203 ETouchFeedbackVibra, |
1327 ETouchFeedbackVibra, |
1204 TPointerEvent() ); |
1328 TPointerEvent() ); |
1205 } |
1329 } |
1206 } |
1330 } |
1207 break; |
1331 break; |
1208 // AKNLAF end |
1332 // AKNLAF end |
|
1333 |
|
1334 case EAknCmdMarkingModeEnter: |
|
1335 { |
|
1336 if ( iExt->iItemActionMenu ) |
|
1337 { |
|
1338 iExt->iItemActionMenu->MarkingMode( |
|
1339 ).SetCollectionMultipleMarkingState( ETrue ); |
|
1340 } |
|
1341 break; |
|
1342 |
|
1343 case EAknCmdMarkingModeMarkOne: |
|
1344 { |
|
1345 if ( iExt->iItemActionMenu ) |
|
1346 { |
|
1347 iExt->iItemActionMenu->MarkingMode().MarkCurrentItemL(); |
|
1348 } |
|
1349 } |
|
1350 break; |
|
1351 |
|
1352 case EAknCmdMarkingModeMarkAll: |
|
1353 { |
|
1354 if ( iExt->iItemActionMenu ) |
|
1355 { |
|
1356 iExt->iItemActionMenu->MarkingMode().MarkAllL(); |
|
1357 } |
|
1358 } |
|
1359 break; |
|
1360 |
|
1361 case EAknCmdMarkingModeUnmarkAll: |
|
1362 { |
|
1363 if ( iExt->iItemActionMenu ) |
|
1364 { |
|
1365 iExt->iItemActionMenu->MarkingMode().UnmarkAll(); |
|
1366 } |
|
1367 } |
|
1368 break; |
|
1369 } |
|
1370 |
1209 default: |
1371 default: |
|
1372 if ( iExt->iItemActionMenu ) |
|
1373 { |
|
1374 iExt->iItemActionMenu->MarkingMode().TryExitMarkingMode(); |
|
1375 } |
1210 break; |
1376 break; |
1211 } |
1377 } |
1212 } |
1378 } |
1213 |
1379 |
1214 |
1380 |