211 // Do not call StartLayoutSwitchFullScreen(), |
211 // Do not call StartLayoutSwitchFullScreen(), |
212 // layout switch effect is started automatically |
212 // layout switch effect is started automatically |
213 iIsKastorEffectStarted = ETrue; |
213 iIsKastorEffectStarted = ETrue; |
214 TInt lastItemIndex = iCurrentContainer->NumberOfItems() - 1; |
214 TInt lastItemIndex = iCurrentContainer->NumberOfItems() - 1; |
215 |
215 |
216 if ( lastItemIndex >= 0 && iCurrentContainer->ItemIsFullyVisible( lastItemIndex ) && |
216 if ( lastItemIndex >= 0 && iCurrentContainer->ItemIsFullyVisible( lastItemIndex ) |
217 !iCurrentContainer->IsHighlightVisible() ) |
217 && !iCurrentContainer->IsHighlightVisible() ) |
218 { |
218 { |
219 iCurrentContainer->SetManualHighlightL( lastItemIndex, EFalse ); |
219 iCurrentContainer->SetManualHighlightL( lastItemIndex, EFalse ); |
220 } |
220 } |
|
221 /* else if( !iCurrentContainer->IsHighlightVisible() |
|
222 && iCurrentContainer->Widget()->TopItemIndex() > -1) |
|
223 { |
|
224 iCurrentContainer->SetManualHighlightL( |
|
225 iCurrentContainer->Widget()->TopItemIndex(), EFalse ); |
|
226 } */ |
221 |
227 |
222 iCurrentContainer->SetRect( ClientRect() ); |
228 iCurrentContainer->SetRect( ClientRect() ); |
223 iDummyContainer->SetRect( ClientRect() ); |
229 iDummyContainer->SetRect( ClientRect() ); |
224 |
230 |
225 THashMapIter< TInt, CMmWidgetContainer* > iterator( iContainerMap ); |
231 THashMapIter< TInt, CMmWidgetContainer* > iterator( iContainerMap ); |
320 // Handle empty message sends by AVKON after app key press or switch |
326 // Handle empty message sends by AVKON after app key press or switch |
321 // to Menu via task swapper. |
327 // to Menu via task swapper. |
322 if( !aParams.Compare( KNullDesC8 ) ) |
328 if( !aParams.Compare( KNullDesC8 ) ) |
323 { |
329 { |
324 if ( !iAppkeyHandler->IsActive() ) |
330 if ( !iAppkeyHandler->IsActive() ) |
325 { |
331 { |
326 //make dummy container visible when returning |
332 //make dummy container visible when returning |
327 //to menu by AppKey |
333 //to menu by AppKey |
328 iDummyContainer->MakeVisible( ETrue ); |
334 iDummyContainer->MakeVisible( ETrue ); |
329 RefreshUiPanesL( ETrue ); |
335 RefreshUiPanesL( ETrue ); |
330 iCurrentContainer->MakeVisible( EFalse ); |
336 iCurrentContainer->MakeVisible( EFalse ); |
331 iDummyContainer->DrawNow(); |
337 iDummyContainer->DrawNow(); |
332 CleanupForExitL( EExitKeyApplication ); |
338 CleanupForExitL( EExitKeyApplication ); |
333 User::LeaveIfError( iCoeEnv->WsSession().SetWindowGroupOrdinalPosition( |
339 User::LeaveIfError( iCoeEnv->WsSession().SetWindowGroupOrdinalPosition( |
334 CEikonEnv::Static()->RootWin().Identifier(), 0 ) ); |
340 CEikonEnv::Static()->RootWin().Identifier(), 0 ) ); |
335 iAppkeyHandler->StartL(); |
341 iAppkeyHandler->StartL(); |
336 } |
342 } |
337 } |
343 } |
338 |
344 |
339 // first refresh model, show afterwords |
345 // first refresh model, show afterwords |
340 if ( aParams.Length() ) |
346 if ( aParams.Length() ) |
341 { |
347 { |
625 // --------------------------------------------------------------------------- |
631 // --------------------------------------------------------------------------- |
626 // |
632 // |
627 // --------------------------------------------------------------------------- |
633 // --------------------------------------------------------------------------- |
628 // |
634 // |
629 TInt CMmAppUi::GetKastorEffectL( CHnItemModel* aItemModel ) |
635 TInt CMmAppUi::GetKastorEffectL( CHnItemModel* aItemModel ) |
630 { |
636 { |
631 TInt effect( AknTransEffect::ENone ); |
637 TInt effect( AknTransEffect::ENone ); |
632 if ((IsEditMode() || iEditModeStatus == ETransitionFromEditMode) |
638 if ((IsEditMode() || iEditModeStatus == ETransitionFromEditMode) |
633 && !AknLayoutUtils::PenEnabled()) |
639 && !AknLayoutUtils::PenEnabled()) |
634 { |
640 { |
635 return effect; |
641 return effect; |
636 } |
642 } |
637 switch( aItemModel->GetItemType() ) |
643 switch( aItemModel->GetItemType() ) |
638 { |
644 { |
639 case EItemTypeApplication: |
645 case EItemTypeApplication: |
640 { |
646 { |
641 if( !IsEditMode() && !aItemModel->IsDrmExpired() ) |
647 if( !IsEditMode() && !aItemModel->IsDrmExpired() ) |
642 { |
648 { |
643 if( aItemModel->IsRunning() ) |
649 if( aItemModel->IsRunning() ) |
644 { |
650 { |
645 effect = AknTransEffect::EApplicationStartSwitchRect; |
651 effect = AknTransEffect::EApplicationStartSwitchRect; |
646 } |
652 } |
647 else |
653 else |
648 { |
654 { |
649 effect = AknTransEffect::EApplicationStartRect; |
655 effect = AknTransEffect::EApplicationStartRect; |
650 } |
656 } |
651 } |
657 } |
652 break; |
658 break; |
653 } |
659 } |
654 case EItemTypeSuite: |
660 case EItemTypeSuite: |
655 { |
661 { |
656 if( !IsEditMode() ) |
662 if( !IsEditMode() ) |
657 { |
663 { |
658 effect = EMenuOpenFolderEffect; |
664 effect = EMenuOpenFolderEffect; |
659 iIsKastorEffectStarted = ETrue; |
665 iIsKastorEffectStarted = ETrue; |
660 } |
666 } |
661 break; |
667 break; |
662 } |
668 } |
663 case EItemTypeParentFolder: |
669 case EItemTypeParentFolder: |
664 { |
670 { |
665 effect = EMenuCloseFolderEffect; |
671 effect = EMenuCloseFolderEffect; |
666 iIsKastorEffectStarted = ETrue; |
672 iIsKastorEffectStarted = ETrue; |
667 break; |
673 break; |
668 } |
674 } |
669 case EItemTypeFolder: |
675 case EItemTypeFolder: |
670 { |
676 { |
671 if (!(IsEditMode() && aItemModel->IsDeleteLocked())) |
677 if (!(IsEditMode() && aItemModel->IsDeleteLocked())) |
672 { |
678 { |
673 effect = EMenuOpenFolderEffect; |
679 effect = EMenuOpenFolderEffect; |
674 iIsKastorEffectStarted = ETrue; |
680 iIsKastorEffectStarted = ETrue; |
675 } |
681 } |
676 break; |
682 break; |
677 } |
683 } |
678 case EItemTypeUnknown: |
684 case EItemTypeUnknown: |
679 default: |
685 default: |
680 { |
686 { |
681 effect = AknTransEffect::ENone; |
687 effect = AknTransEffect::ENone; |
682 break; |
688 break; |
683 } |
689 } |
684 } |
690 } |
685 return effect; |
691 return effect; |
686 } |
692 } |
687 |
693 |
688 // --------------------------------------------------------------------------- |
694 // --------------------------------------------------------------------------- |
689 // |
695 // |
1068 // ----------------------------------------------------------------------------- |
1074 // ----------------------------------------------------------------------------- |
1069 // |
1075 // |
1070 void CMmAppUi::HandleDragStopL( TInt aModelItemIndex ) |
1076 void CMmAppUi::HandleDragStopL( TInt aModelItemIndex ) |
1071 { |
1077 { |
1072 MMPERF(("CMmAppUi::HandleDragStopL - START")); |
1078 MMPERF(("CMmAppUi::HandleDragStopL - START")); |
1073 if ( IsEditMode() ) |
1079 if( IsEditMode() ) |
1074 { |
1080 { |
1075 TInt itemId = iCurrentSuiteModel->IdByIndex( aModelItemIndex ); |
1081 TInt itemId = iCurrentSuiteModel->IdByIndex( aModelItemIndex ); |
1076 TMcsItemType typeCurr = |
1082 TMcsItemType typeCurr = |
1077 iCurrentSuiteModel->GetItemType( aModelItemIndex ); |
1083 iCurrentSuiteModel->GetItemType( aModelItemIndex ); |
1078 TBool isOverFolder = ( AknLayoutUtils::PenEnabled() && |
1084 TBool isOverFolder = ( AknLayoutUtils::PenEnabled() && |
1079 ( typeCurr == EItemTypeParentFolder || typeCurr == EItemTypeFolder ) ); |
1085 ( typeCurr == EItemTypeParentFolder || typeCurr == EItemTypeFolder ) ); |
1080 TBool isDeleteLocked = (itemId != KErrNotFound) ? |
1086 TBool isDeleteLocked = (itemId != KErrNotFound) |
1081 iCurrentSuiteModel->GetItemModel( itemId )->IsDeleteLocked(): |
1087 ? iCurrentSuiteModel->GetItemModel( itemId )->IsDeleteLocked() |
1082 EFalse; |
1088 : EFalse; |
1083 |
1089 |
1084 TBuf8< KMaxLength > beforeCustomId; |
1090 TBuf8<KMaxLength> beforeCustomId; |
1085 beforeCustomId.Num( KErrNotFound ); |
1091 beforeCustomId.Num( KErrNotFound ); |
1086 if ( aModelItemIndex + 1 < iCurrentContainer->NumberOfItems() ) |
1092 if( aModelItemIndex + 1 < iCurrentContainer->NumberOfItems() ) |
1087 { |
1093 { |
1088 beforeCustomId.Num( iCurrentSuiteModel->GetItemModel( |
1094 beforeCustomId.Num( iCurrentSuiteModel->GetItemModel( |
1089 iCurrentSuiteModel->IdByIndex( aModelItemIndex + 1 ) )->CustomId() ); |
1095 iCurrentSuiteModel->IdByIndex( aModelItemIndex + 1 ) )->CustomId() ); |
1090 } |
1096 } |
1091 |
1097 |
1092 TBuf8< KMaxLength > draggedCustomId; |
1098 TBuf8<KMaxLength> draggedCustomId; |
1093 draggedCustomId.Num( KErrNotFound ); |
1099 draggedCustomId.Num( KErrNotFound ); |
1094 CHnItemModel* draggedModel = iCurrentSuiteModel->GetItemModel( iIdDragged ); |
1100 CHnItemModel* draggedModel = iCurrentSuiteModel->GetItemModel( iIdDragged ); |
1095 if (draggedModel) |
1101 if( draggedModel ) |
1096 { |
1102 { |
1097 draggedCustomId.Num( iCurrentSuiteModel->GetItemModel( iIdDragged )->CustomId() ); |
1103 draggedCustomId.Num( iCurrentSuiteModel->GetItemModel( iIdDragged )->CustomId() ); |
1098 } |
1104 } |
1099 |
1105 |
1100 CLiwGenericParamList* eventParameters = CLiwGenericParamList::NewL(); |
1106 CLiwGenericParamList* eventParameters = CLiwGenericParamList::NewL(); |
1134 iCurrentContainer->CancelDragL( EFalse ); |
1142 iCurrentContainer->CancelDragL( EFalse ); |
1135 |
1143 |
1136 iHNInterface->TriggerHnEventL( KKeyIdMoveInto, itemId, eventParameters ); |
1144 iHNInterface->TriggerHnEventL( KKeyIdMoveInto, itemId, eventParameters ); |
1137 iMakeHightlightedItemFullyVisible = ETrue; |
1145 iMakeHightlightedItemFullyVisible = ETrue; |
1138 } |
1146 } |
1139 else if ( iIdDragged == itemId ) |
1147 else if( iIdDragged == itemId ) |
1140 { |
1148 { |
1141 iCurrentContainer->CancelDragL( ETrue ); |
1149 iCurrentContainer->CancelDragL( ETrue ); |
1142 TBool result = iHNInterface->TriggerHnEventL( KKeyIdMove, itemId, eventParameters ); |
1150 iCurrentContainer->SetTriggerMoveItemL( itemId, eventParameters ); |
1143 // fix for: edit->move, then LSK->Up->LSK->LSK FAST... (short options show up) |
1151 // fix for: edit->move, then LSK->Up->LSK->LSK FAST... (short options show up) |
1144 if ( result != KErrNone && !AknLayoutUtils::PenEnabled() ) |
1152 if( !AknLayoutUtils::PenEnabled() ) |
1145 { |
|
1146 CLiwGenericParamList* paramList = CLiwGenericParamList::NewLC(); |
|
1147 TLiwGenericParam command(KHnRequest, TLiwVariant( KEvaluateMdModel)); |
|
1148 paramList->AppendL(command); |
|
1149 HandleRequestL(*paramList); |
|
1150 CleanupStack::PopAndDestroy(paramList); |
|
1151 } |
|
1152 } |
|
1153 else |
|
1154 { |
|
1155 iCurrentContainer->CancelDragL( ETrue ); |
|
1156 if (!AknLayoutUtils::PenEnabled()) |
|
1157 { |
1153 { |
1158 CLiwGenericParamList* paramList = CLiwGenericParamList::NewLC(); |
1154 CLiwGenericParamList* paramList = CLiwGenericParamList::NewLC(); |
1159 TLiwGenericParam command(KHnRequest, TLiwVariant( KEvaluateMdModel)); |
1155 TLiwGenericParam command(KHnRequest, TLiwVariant( KEvaluateMdModel)); |
1160 paramList->AppendL(command); |
1156 paramList->AppendL( command ); |
1161 HandleRequestL(*paramList); |
1157 HandleRequestL( *paramList ); |
1162 CleanupStack::PopAndDestroy(paramList); |
1158 CleanupStack::PopAndDestroy( paramList ); |
|
1159 } |
|
1160 } |
|
1161 else |
|
1162 { |
|
1163 iCurrentContainer->CancelDragL( ETrue ); |
|
1164 if( !AknLayoutUtils::PenEnabled() ) |
|
1165 { |
|
1166 CLiwGenericParamList* paramList = CLiwGenericParamList::NewLC(); |
|
1167 TLiwGenericParam command(KHnRequest, TLiwVariant( KEvaluateMdModel)); |
|
1168 paramList->AppendL( command ); |
|
1169 HandleRequestL( *paramList ); |
|
1170 CleanupStack::PopAndDestroy( paramList ); |
1163 } |
1171 } |
1164 } |
1172 } |
1165 |
1173 |
1166 CleanupStack::PopAndDestroy( eventParameters ); |
1174 CleanupStack::PopAndDestroy( eventParameters ); |
1167 } |
1175 } |
1244 iPopupMenu->SetPosition( aPenEventLocation, |
1252 iPopupMenu->SetPosition( aPenEventLocation, |
1245 CAknStylusPopUpMenu::EPositionTypeLeftBottom ); |
1253 CAknStylusPopUpMenu::EPositionTypeLeftBottom ); |
1246 } |
1254 } |
1247 |
1255 |
1248 if( iCurrentSuiteModel == iHNInterface->GetLastSuiteModelL() |
1256 if( iCurrentSuiteModel == iHNInterface->GetLastSuiteModelL() |
1249 && iCurrentContainer->IsHighlightVisible() |
1257 && iCurrentContainer->IsHighlightVisible() |
1250 && iCurrentContainer->GetSuiteModelL()->GetItemModelsCount() > 1 ) |
1258 && iCurrentContainer->GetSuiteModelL()->GetItemModelsCount() > 1 ) |
1251 { |
1259 { |
1252 MMPERF(("CMmAppUi::DynInitMenuPaneL - START")); |
1260 MMPERF(("CMmAppUi::DynInitMenuPaneL - START")); |
1253 //fill the main menu structure, look for cascade menus |
1261 //fill the main menu structure, look for cascade menus |
1254 //reset the helper hash map |
1262 //reset the helper hash map |
1255 iCascadeMenuMap.Close(); |
1263 iCascadeMenuMap.Close(); |
1256 |
1264 |
1257 MHnMenuItemModelIterator* menuIterator = |
1265 MHnMenuItemModelIterator* menuIterator = |
1258 iCurrentSuiteModel->GetMenuStructureL( |
1266 iCurrentSuiteModel->GetMenuStructureL( |
1259 iCurrentSuiteModel->IdByIndex( |
1267 iCurrentSuiteModel->IdByIndex( |
1260 iCurrentContainer->GetHighlight() ) ); |
1268 iCurrentContainer->GetHighlight() ) ); |
1261 |
1269 |
1262 // check if there is a menu structure available |
1270 // check if there is a menu structure available |
1263 // for the specified item |
1271 // for the specified item |
1264 if ( menuIterator ) |
1272 if ( menuIterator ) |
1265 { |
1273 { |
1266 //create item sorting helper objects |
1274 //create item sorting helper objects |
1267 RArray<TInt> positionArray; |
1275 RArray<TInt> positionArray; |
1268 CleanupClosePushL( positionArray ); |
1276 CleanupClosePushL( positionArray ); |
1269 RHashMap<TInt, CEikMenuPaneItem::SData> menuItemMap; |
1277 RHashMap<TInt, CEikMenuPaneItem::SData> menuItemMap; |
1270 CleanupClosePushL( menuItemMap ); |
1278 CleanupClosePushL( menuItemMap ); |
1271 |
1279 |
1272 while ( menuIterator->HasNextSpecific() ) |
1280 while ( menuIterator->HasNextSpecific() ) |
1273 { |
1281 { |
1274 CHnMenuItemModel* childItem = menuIterator->GetNextSpecific(); |
1282 CHnMenuItemModel* childItem = menuIterator->GetNextSpecific(); |
1275 CEikMenuPaneItem::SData childData; |
1283 CEikMenuPaneItem::SData childData; |
1276 childData.iCommandId = childItem->Command(); |
1284 childData.iCommandId = childItem->Command(); |
1277 childData.iText = childItem->NameL(). |
1285 childData.iText = childItem->NameL(). |
1278 Left( CEikMenuPaneItem::SData::ENominalTextLength ); |
1286 Left( CEikMenuPaneItem::SData::ENominalTextLength ); |
1279 childData.iFlags = 0; |
1287 childData.iFlags = 0; |
1280 childData.iCascadeId = 0; |
1288 childData.iCascadeId = 0; |
1281 |
1289 |
1282 positionArray.AppendL( childItem->Position() ); |
1290 positionArray.AppendL( childItem->Position() ); |
1283 menuItemMap.InsertL( childItem->Position(), childData ); |
1291 menuItemMap.InsertL( childItem->Position(), childData ); |
1284 } |
1292 } |
1285 |
1293 |
1286 positionArray.Sort(); |
1294 positionArray.Sort(); |
1287 |
1295 |
1288 //add items in correct order |
1296 //add items in correct order |
1289 for ( TInt i = 0; i < positionArray.Count(); ++i ) |
1297 for ( TInt i = 0; i < positionArray.Count(); ++i ) |
1290 { |
1298 { |
1291 iPopupMenu-> |
1299 iPopupMenu-> |
1292 AddMenuItemL( |
1300 AddMenuItemL( |
1293 menuItemMap.FindL( positionArray[i] ).iText, |
1301 menuItemMap.FindL( positionArray[i] ).iText, |
1294 menuItemMap.FindL( positionArray[i] ).iCommandId ); |
1302 menuItemMap.FindL( positionArray[i] ).iCommandId ); |
1295 } |
1303 } |
1296 |
1304 |
1297 if (positionArray.Count()>0) |
1305 if (positionArray.Count()>0) |
1298 { |
1306 { |
1299 iPopupMenu->ShowMenu(); |
1307 iPopupMenu->ShowMenu(); |
1300 popupMenuDisplayed = ETrue; |
1308 popupMenuDisplayed = ETrue; |
1301 } |
1309 } |
1302 CleanupStack::PopAndDestroy( &menuItemMap ); |
1310 CleanupStack::PopAndDestroy( &menuItemMap ); |
1303 CleanupStack::PopAndDestroy( &positionArray ); |
1311 CleanupStack::PopAndDestroy( &positionArray ); |
1304 } |
1312 } |
1305 MMPERF(("CMmAppUi::DynInitMenuPaneL - STOP")); |
1313 MMPERF(("CMmAppUi::DynInitMenuPaneL - STOP")); |
1306 } |
1314 } |
1307 |
1315 |
1308 if ( !popupMenuDisplayed && iCurrentContainer ) |
1316 if ( !popupMenuDisplayed && iCurrentContainer ) |
1309 { |
1317 { |
1310 iCurrentContainer->EndLongTapL( ETrue ); |
1318 iCurrentContainer->EndLongTapL( ETrue ); |
1311 HandleHighlightItemSingleClickedL( |
1319 HandleHighlightItemSingleClickedL( |
1312 iCurrentContainer->Widget()->CurrentItemIndex() ); |
1320 iCurrentContainer->Widget()->CurrentItemIndex() ); |
1313 } |
1321 } |
1314 } |
1322 } |
1315 |
1323 |
1316 // --------------------------------------------------------------------------- |
1324 // --------------------------------------------------------------------------- |
1317 // |
1325 // |
1318 // --------------------------------------------------------------------------- |
1326 // --------------------------------------------------------------------------- |
1319 // |
1327 // |
1320 void CMmAppUi::HandleHighlightItemDoubleClickedL( TInt aIndex ) |
1328 void CMmAppUi::HandleHighlightItemDoubleClickedL( TInt aIndex ) |
1321 { |
1329 { |
1322 if ( iKeyClickLocked ) |
1330 if ( iKeyClickLocked ) |
1323 return; |
1331 return; |
1324 |
1332 |
1325 if ( iCurrentSuiteModel->WidgetType() == EListWidget |
1333 if ( iCurrentSuiteModel->WidgetType() == EListWidget |
1326 && iCurrentContainer->GetPreviousHighlight() == aIndex ) |
1334 && iCurrentContainer->GetPreviousHighlight() == aIndex ) |
1327 { |
1335 { |
1328 ForwardEventToHNL( KKeyIdSelect, aIndex ); |
1336 ForwardEventToHNL( KKeyIdSelect, aIndex ); |
1474 TBool ignoreItemSpecific( EFalse ); |
1482 TBool ignoreItemSpecific( EFalse ); |
1475 if ( iCurrentSuiteModel ) |
1483 if ( iCurrentSuiteModel ) |
1476 { |
1484 { |
1477 TInt itemId( KErrNotFound ); |
1485 TInt itemId( KErrNotFound ); |
1478 TBool suiteModelHasItems = iCurrentContainer->GetSuiteModelL()->GetItemModelsCount() > 1; |
1486 TBool suiteModelHasItems = iCurrentContainer->GetSuiteModelL()->GetItemModelsCount() > 1; |
1479 TBool highlightVisible = iCurrentContainer->IsHighlightVisible(); |
1487 TBool highlightVisible = iCurrentContainer->IsHighlightVisible(); |
1480 if ( !highlightVisible && suiteModelHasItems ) |
1488 if ( !highlightVisible && suiteModelHasItems ) |
1481 { |
1489 { |
1482 // if there is no highlight, but there are items, show menuitems for logically |
1490 // if there is no highlight, but there are items, show menuitems for logically |
1483 // current suite highlight fetched from suite model. |
1491 // current suite highlight fetched from suite model. |
1484 TInt suiteHighlight = iCurrentSuiteModel->GetSuiteHighlight(); |
1492 TInt suiteHighlight = iCurrentSuiteModel->GetSuiteHighlight(); |
1485 ASSERT( suiteHighlight != KErrNotFound ); |
1493 ASSERT( suiteHighlight != KErrNotFound ); |
1486 itemId = iCurrentSuiteModel->IdByIndex( suiteHighlight ); |
1494 itemId = iCurrentSuiteModel->IdByIndex( suiteHighlight ); |
1487 ignoreItemSpecific = ETrue; |
1495 ignoreItemSpecific = ETrue; |
1488 } |
1496 } |
1489 else |
1497 else |
1490 { |
1498 { |
1491 TBool idByContainer = highlightVisible && suiteModelHasItems; |
1499 TBool idByContainer = highlightVisible && suiteModelHasItems; |
1492 itemId = idByContainer ? |
1500 itemId = idByContainer ? |
1493 iCurrentSuiteModel->IdByIndex( iCurrentContainer->GetHighlight() ) : |
1501 iCurrentSuiteModel->IdByIndex( iCurrentContainer->GetHighlight() ) : |
1494 iCurrentSuiteModel->IdByIndex( KErrNotFound ); |
1502 iCurrentSuiteModel->IdByIndex( KErrNotFound ); |
1495 } |
1503 } |
1496 menuIterator = iCurrentSuiteModel->GetMenuStructureL( itemId ); |
1504 menuIterator = iCurrentSuiteModel->GetMenuStructureL( itemId ); |
1497 } |
1505 } |
1498 |
1506 |
1499 // check if there is a menu structure available |
1507 // check if there is a menu structure available |
1500 // for the specified item |
1508 // for the specified item |
1522 //get custom menu items and their positions |
1530 //get custom menu items and their positions |
1523 while ( menuIterator->HasNext() ) |
1531 while ( menuIterator->HasNext() ) |
1524 { |
1532 { |
1525 CHnMenuItemModel* menuItem = menuIterator->GetNext(); |
1533 CHnMenuItemModel* menuItem = menuIterator->GetNext(); |
1526 if ( (menuItem->MenuItemType() == CHnMenuItemModel::EItemApplication) || !ignoreItemSpecific ) |
1534 if ( (menuItem->MenuItemType() == CHnMenuItemModel::EItemApplication) || !ignoreItemSpecific ) |
1527 { |
1535 { |
1528 CEikMenuPaneItem::SData menuData; |
1536 CEikMenuPaneItem::SData menuData; |
1529 menuData.iCommandId = menuItem->Command(); |
1537 menuData.iCommandId = menuItem->Command(); |
1530 menuData.iText = menuItem->NameL(). |
1538 menuData.iText = menuItem->NameL(). |
1531 Left( CEikMenuPaneItem::SData::ENominalTextLength ); |
1539 Left( CEikMenuPaneItem::SData::ENominalTextLength ); |
1532 menuData.iFlags = 0; |
1540 menuData.iFlags = 0; |
1533 |
1541 |
1534 //check for children |
1542 //check for children |
1535 MHnMenuItemModelIterator* childIterator = |
1543 MHnMenuItemModelIterator* childIterator = |
1536 menuItem->GetMenuStructure(); |
1544 menuItem->GetMenuStructure(); |
1537 if ( childIterator->HasNext() ) |
1545 if ( childIterator->HasNext() ) |
1538 { |
1546 { |
1539 //this is a cascade item |
1547 //this is a cascade item |
1540 //one menu item can contain only one cascade menu |
1548 //one menu item can contain only one cascade menu |
1541 //check if there are available cascade menu containers |
1549 //check if there are available cascade menu containers |
1542 TInt freeResource = GetNextCascadeMenuResourceId(); |
1550 TInt freeResource = GetNextCascadeMenuResourceId(); |
1543 if ( freeResource != KErrNotFound ) |
1551 if ( freeResource != KErrNotFound ) |
1544 { |
1552 { |
1545 //error checking |
1553 //error checking |
1546 if( !iCascadeMenuMap.Insert( freeResource, |
1554 if( !iCascadeMenuMap.Insert( freeResource, |
1547 childIterator ) ) |
1555 childIterator ) ) |
1548 { |
1556 { |
1549 //add item only if there is an |
1557 //add item only if there is an |
1550 //available resource |
1558 //available resource |
1551 menuData.iCascadeId = freeResource; |
1559 menuData.iCascadeId = freeResource; |
1552 } |
1560 } |
1553 } |
1561 } |
1554 } |
1562 } |
1555 else |
1563 else |
1556 { |
1564 { |
1557 //normal entry |
1565 //normal entry |
1558 menuData.iCascadeId = 0; |
1566 menuData.iCascadeId = 0; |
1559 } |
1567 } |
1560 positionArray.AppendL( menuItem->Position() ); |
1568 positionArray.AppendL( menuItem->Position() ); |
1561 menuItemMap.InsertL( menuItem->Position(), menuData ); |
1569 menuItemMap.InsertL( menuItem->Position(), menuData ); |
1562 } |
1570 } |
1563 } |
1571 } |
1564 |
1572 |
1565 aMenuPane->Reset(); |
1573 aMenuPane->Reset(); |
1566 positionArray.Sort(); |
1574 positionArray.Sort(); |
1567 |
1575 |
2032 // --------------------------------------------------------------------------- |
2040 // --------------------------------------------------------------------------- |
2033 // |
2041 // |
2034 // --------------------------------------------------------------------------- |
2042 // --------------------------------------------------------------------------- |
2035 // |
2043 // |
2036 void CMmAppUi::SetEditModeL( TBool aIsEditMode ) |
2044 void CMmAppUi::SetEditModeL( TBool aIsEditMode ) |
2037 { |
2045 { |
2038 MMPERF(("CMmAppUi::SetEditModeL %d - START",aIsEditMode)); |
2046 MMPERF(("CMmAppUi::SetEditModeL %d - START",aIsEditMode)); |
2039 if ( IsEditMode() != aIsEditMode && iCurrentSuiteModel ) |
2047 if ( IsEditMode() != aIsEditMode && iCurrentSuiteModel ) |
2040 { |
2048 { |
2041 |
2049 |
2042 // stops moving items. This must be called when leaving non-touch edit mode to save |
2050 // stops moving items. This must be called when leaving non-touch edit mode to save |
2043 // the current visible order of the items. In non-touch it is called only once when completing editing |
2051 // the current visible order of the items. In non-touch it is called only once when completing editing |
2044 |
2052 |
2045 iHNInterface->SetEditModeL(aIsEditMode); |
2053 iHNInterface->SetEditModeL(aIsEditMode); |
2046 iCurrentContainer->StopMovingL(); |
2054 iCurrentContainer->StopMovingL(); |
2047 |
2055 |
2048 if ( aIsEditMode ) |
2056 if ( aIsEditMode ) |
2049 { |
2057 { |
2050 iEditModeStatus = ETransitionToEditMode; |
2058 iEditModeStatus = ETransitionToEditMode; |
2051 } |
2059 } |
2052 else |
2060 else |
2053 { |
2061 { |
2054 if ( iEditModeStatus == ETransitionToEditMode ) |
2062 if ( iEditModeStatus == ETransitionToEditMode ) |
2055 { |
2063 { |
2056 iEditModeStatus = EFastTransitionFromEditMode; |
2064 iEditModeStatus = EFastTransitionFromEditMode; |
2057 } |
2065 } |
2058 else |
2066 else |
2059 { |
2067 { |
2060 iEditModeStatus = ETransitionFromEditMode; |
2068 iEditModeStatus = ETransitionFromEditMode; |
2061 } |
2069 } |
2062 } |
2070 } |
2063 |
2071 |
2064 HandleHighlightOffsetL( aIsEditMode ? EOffsetNext : EOffsetPrevious ); |
2072 HandleHighlightOffsetL( aIsEditMode ? EOffsetNext : EOffsetPrevious ); |
2065 iCurrentSuiteModel->SetSuiteHighlightL( |
2073 iCurrentSuiteModel->SetSuiteHighlightL( |
2066 AdjustEditModeHighlightL( iCurrentSuiteModel->GetSuiteHighlight() ) ); |
2074 AdjustEditModeHighlightL( iCurrentSuiteModel->GetSuiteHighlight() ) ); |
2067 |
2075 |
2653 // |
2661 // |
2654 void CMmAppUi::SetMiddleSoftKeyL() |
2662 void CMmAppUi::SetMiddleSoftKeyL() |
2655 { |
2663 { |
2656 DEBUG(("_Mm_:CMmAppUi::SetMiddleSoftKeyL - IN")); |
2664 DEBUG(("_Mm_:CMmAppUi::SetMiddleSoftKeyL - IN")); |
2657 if ( iCurrentSuiteModel && !AknLayoutUtils::PenEnabled() && !IsEditMode() ) |
2665 if ( iCurrentSuiteModel && !AknLayoutUtils::PenEnabled() && !IsEditMode() ) |
2658 { |
2666 { |
2659 DEBUG(("\t_Mm_:suite highlight: %d", |
2667 DEBUG(("\t_Mm_:suite highlight: %d", |
2660 iCurrentSuiteModel->GetSuiteHighlight())); |
2668 iCurrentSuiteModel->GetSuiteHighlight())); |
2661 |
2669 |
2662 TBool idByContainer = iCurrentContainer->IsHighlightVisible() && |
2670 TBool idByContainer = iCurrentContainer->IsHighlightVisible() && |
2663 iCurrentContainer->GetSuiteModelL()->GetItemModelsCount() > 1; |
2671 iCurrentContainer->GetSuiteModelL()->GetItemModelsCount() > 1; |
2664 TInt itemId = idByContainer ? |
2672 TInt itemId = idByContainer ? |
2665 iCurrentSuiteModel->IdByIndex( iCurrentContainer->GetHighlight() ) : |
2673 iCurrentSuiteModel->IdByIndex( iCurrentContainer->GetHighlight() ) : |
2666 iCurrentSuiteModel->IdByIndex( KErrNotFound ); |
2674 iCurrentSuiteModel->IdByIndex( KErrNotFound ); |
2667 CHnItemModel* itemModel = iCurrentSuiteModel->GetItemModel( itemId ); |
2675 CHnItemModel* itemModel = iCurrentSuiteModel->GetItemModel( itemId ); |
2668 |
2676 |
2669 CHnButtonModel* mskModel = NULL; |
2677 CHnButtonModel* mskModel = NULL; |
2670 |
2678 |
2671 if ( itemModel ) |
2679 if ( itemModel ) |
2672 { |
2680 { |
2673 mskModel = itemModel->GetMiddleSoftKey(); |
2681 mskModel = itemModel->GetMiddleSoftKey(); |
2674 } |
2682 } |
2675 |
2683 |
2676 if ( mskModel ) |
2684 if ( mskModel ) |
2677 { |
2685 { |
2678 TInt event = (mskModel->GetEventId() == KErrNotFound) ? |
2686 TInt event = (mskModel->GetEventId() == KErrNotFound) ? |
2679 KKeyIdSelect : mskModel->GetEventId(); |
2687 KKeyIdSelect : mskModel->GetEventId(); |
2680 Cba()->SetCommandL( CEikButtonGroupContainer::EMiddleSoftkeyPosition, |
2688 Cba()->SetCommandL( CEikButtonGroupContainer::EMiddleSoftkeyPosition, |
2681 event, mskModel->GetButtonText()); |
2689 event, mskModel->GetButtonText()); |
2682 } |
2690 } |
2683 else |
2691 else |
2684 { |
2692 { |
2685 // reset to default |
2693 // reset to default |
2686 RefreshCbaL(); |
2694 RefreshCbaL(); |
2687 } |
2695 } |
2688 } |
2696 } |
2689 DEBUG(("_Mm_:CMmAppUi::SetMiddleSoftKeyL - OUT")); |
2697 DEBUG(("_Mm_:CMmAppUi::SetMiddleSoftKeyL - OUT")); |
2690 } |
2698 } |
2691 |
2699 |
2692 // --------------------------------------------------------------------------- |
2700 // --------------------------------------------------------------------------- |
2693 // |
2701 // |
2894 // --------------------------------------------------------------------------- |
2912 // --------------------------------------------------------------------------- |
2895 // |
2913 // |
2896 // --------------------------------------------------------------------------- |
2914 // --------------------------------------------------------------------------- |
2897 // |
2915 // |
2898 void CMmAppUi::HandleFocusGainedL() |
2916 void CMmAppUi::HandleFocusGainedL() |
2899 { |
2917 { |
2900 DEBUG(("_Mm_:CMmAppUi::HandleWsEventL " |
2918 DEBUG(("_Mm_:CMmAppUi::HandleWsEventL " |
2901 "- EEventFocusGained")); |
2919 "- EEventFocusGained")); |
2902 |
2920 |
2903 iHasFocus = ETrue; |
2921 iHasFocus = ETrue; |
2904 |
2922 |
2905 // Tricky: lack of iCurrentSuiteModel indicates that suite evaluation is in |
2923 // Tricky: lack of iCurrentSuiteModel indicates that suite evaluation is in |
2906 // progress - do not call HandlePresentationChangeL if evalution has not |
2924 // progress - do not call HandlePresentationChangeL if evalution has not |
2907 // finished. |
2925 // finished. |
2908 if ( iCurrentContainer && !iCurrentContainer->IsVisible() && |
2926 if ( iCurrentContainer && !iCurrentContainer->IsVisible() && |
2909 iCurrentSuiteModel ) |
2927 iCurrentSuiteModel ) |
2910 { |
2928 { |
2911 HandlePresentationChangeL( iCurrentContainer ); |
2929 HandlePresentationChangeL( iCurrentContainer ); |
2912 } |
2930 } |
2913 |
2931 |
2914 if ( iCurrentSuiteModel && iCurrentContainer ) |
2932 if ( iCurrentSuiteModel && iCurrentContainer ) |
2915 { |
2933 { |
2916 iDummyContainer->MakeVisible( EFalse ); |
2934 iDummyContainer->MakeVisible( EFalse ); |
2917 iCurrentContainer->MakeVisible( ETrue ); |
2935 iCurrentContainer->MakeVisible( ETrue ); |
2918 iCurrentContainer->DrawNow(); |
2936 iCurrentContainer->DrawNow(); |
2919 } |
2937 } |
2920 if( IsForeground() ) |
2938 if( IsForeground() ) |
2921 { |
2939 { |
2922 RefreshUiPanesL(); |
2940 RefreshUiPanesL(); |
2923 } |
2941 } |
2924 if ( iCurrentContainer ) |
2942 if ( iCurrentContainer ) |
2925 { |
2943 { |
2926 iCurrentContainer->SetHasFocusL( ETrue ); |
2944 iCurrentContainer->SetHasFocusL( ETrue ); |
2927 } |
2945 } |
2928 if ( iCurrentSuiteModel ) |
2946 if ( iCurrentSuiteModel ) |
2929 { |
2947 { |
2930 iCurrentSuiteModel->SetVisibleL( ETrue ); |
2948 iCurrentSuiteModel->SetVisibleL( ETrue ); |
2931 } |
2949 } |
2932 } |
2950 } |
2933 |
2951 |
2934 // --------------------------------------------------------------------------- |
2952 // --------------------------------------------------------------------------- |
2935 // |
2953 // |
2936 // --------------------------------------------------------------------------- |
2954 // --------------------------------------------------------------------------- |
2937 // |
2955 // |
2938 void CMmAppUi::HandleFocusLostL() |
2956 void CMmAppUi::HandleFocusLostL() |
2939 { |
2957 { |
2940 DEBUG(("_Mm_:CMmAppUi::HandleWsEventL " |
2958 DEBUG(("_Mm_:CMmAppUi::HandleWsEventL " |
2941 "- EEventFocusLost")); |
2959 "- EEventFocusLost")); |
2942 |
2960 |
2943 iHasFocus = EFalse; |
2961 iHasFocus = EFalse; |
2944 |
2962 |
2945 if( iCurrentContainer ) |
2963 if( iCurrentContainer ) |
2946 { |
2964 { |
2947 //This is needed in case some popup is displayed |
2965 //This is needed in case some popup is displayed |
2948 //while touching item in grid. Highlight |
2966 //while touching item in grid. Highlight |
2949 //should be reset to normal then. |
2967 //should be reset to normal then. |
2950 if( AknLayoutUtils::PenEnabled() ) |
2968 if( AknLayoutUtils::PenEnabled() ) |
2951 { |
2969 { |
2952 if( iCurrentContainer->WidgetType() == EGridWidget && !IsEditMode() ) |
2970 if( iCurrentContainer->WidgetType() == EGridWidget && !IsEditMode() ) |
2953 { |
2971 { |
2954 iCurrentContainer->Widget()->View()->ItemDrawer()-> |
2972 iCurrentContainer->Widget()->View()->ItemDrawer()-> |
2955 SetFlags( CListItemDrawer::EDisableHighlight ); |
2973 SetFlags( CListItemDrawer::EDisableHighlight ); |
2956 } |
2974 } |
2957 iCurrentContainer->Widget()->View()-> |
2975 iCurrentContainer->Widget()->View()-> |
2958 ItemDrawer()->ClearFlags( CListItemDrawer::EPressedDownState ); |
2976 ItemDrawer()->ClearFlags( CListItemDrawer::EPressedDownState ); |
2959 iCurrentContainer->Widget()->View()->DrawItem( |
2977 iCurrentContainer->Widget()->View()->DrawItem( |
2960 iCurrentContainer->Widget()->CurrentItemIndex() ) ; |
2978 iCurrentContainer->Widget()->CurrentItemIndex() ) ; |
2961 } |
2979 } |
2962 if( IsEditMode() && iCurrentContainer->IsDraggable() ) |
2980 if( IsEditMode() && iCurrentContainer->IsDraggable() ) |
2963 { |
2981 { |
2964 HandleDragStopL( iCurrentContainer->GetHighlight() ); |
2982 HandleDragStopL( iCurrentContainer->GetHighlight() ); |
2965 iCurrentContainer->DrawNow(); |
2983 iCurrentContainer->DrawNow(); |
2966 } |
2984 } |
2967 iCurrentContainer->SetHasFocusL( EFalse ); |
2985 iCurrentContainer->SetHasFocusL( EFalse ); |
2968 } |
2986 } |
2969 if ( iCurrentSuiteModel ) |
2987 if ( iCurrentSuiteModel ) |
2970 { |
2988 { |
2971 iCurrentSuiteModel->SetVisibleL( EFalse ); |
2989 iCurrentSuiteModel->SetVisibleL( EFalse ); |
2972 } |
2990 } |
2973 |
2991 |
2974 } |
2992 } |
2975 |
2993 |
2976 // --------------------------------------------------------------------------- |
2994 // --------------------------------------------------------------------------- |
2977 // |
2995 // |
2978 // --------------------------------------------------------------------------- |
2996 // --------------------------------------------------------------------------- |
2979 // |
2997 // |
2980 void CMmAppUi::HandleFullOrPartialForegroundGainedL() |
2998 void CMmAppUi::HandleFullOrPartialForegroundGainedL() |
2981 { |
2999 { |
2982 DEBUG(("_Mm_:CMmAppUi::HandleWsEventL " |
3000 DEBUG(("_Mm_:CMmAppUi::HandleWsEventL " |
2983 "- KAknFullOrPartialForegroundGained")); |
3001 "- KAknFullOrPartialForegroundGained")); |
2984 //show Menu in TS when launched for the first time |
3002 //show Menu in TS when launched for the first time |
2985 if( isHiddenFromFS ) |
3003 if( isHiddenFromFS ) |
2986 { |
3004 { |
2987 HideApplicationFromFSW( EFalse ); |
3005 HideApplicationFromFSW( EFalse ); |
2988 isHiddenFromFS = EFalse; |
3006 isHiddenFromFS = EFalse; |
2989 } |
3007 } |
2990 |
3008 |
2991 if (iCurrentContainer && iCurrentSuiteModel ) |
3009 if (iCurrentContainer && iCurrentSuiteModel ) |
2992 { |
3010 { |
2993 iCurrentContainer->HandleForegroundGainedL(); |
3011 iCurrentContainer->HandleForegroundGainedL(); |
2994 iDummyContainer->MakeVisible( EFalse ); |
3012 iDummyContainer->MakeVisible( EFalse ); |
2995 iCurrentContainer->MakeVisible( ETrue ); |
3013 iCurrentContainer->MakeVisible( ETrue ); |
2996 RefreshUiPanesL(); |
3014 RefreshUiPanesL(); |
2997 } |
3015 } |
2998 if (iSkinChangeNeeded && !iSkinChangeInProgress) |
3016 if (iSkinChangeNeeded && !iSkinChangeInProgress) |
2999 { |
3017 { |
3000 MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance(); |
3018 MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance(); |
3001 if (skinInstance && !skinInstance->IsUpdateInProgress()) |
3019 if (skinInstance && !skinInstance->IsUpdateInProgress()) |
3002 { |
3020 { |
3003 RefreshIconsL(); |
3021 RefreshIconsL(); |
3004 |
3022 |
3005 } |
3023 } |
3006 } |
3024 } |
3007 } |
3025 } |
3008 |
3026 |
3009 // --------------------------------------------------------------------------- |
3027 // --------------------------------------------------------------------------- |
3010 // |
3028 // |
3011 // --------------------------------------------------------------------------- |
3029 // --------------------------------------------------------------------------- |
3012 // |
3030 // |
3013 void CMmAppUi::HandleFullOrPartialForegroundLostL() |
3031 void CMmAppUi::HandleFullOrPartialForegroundLostL() |
3014 { |
3032 { |
3015 DEBUG(("_Mm_:CMmAppUi::HandleWsEventL " |
3033 DEBUG(("_Mm_:CMmAppUi::HandleWsEventL " |
3016 "- KAknFullOrPartialForegroundLost")); |
3034 "- KAknFullOrPartialForegroundLost")); |
3017 if ( iCurrentContainer ) |
3035 if ( iCurrentContainer ) |
3018 { |
3036 { |
3019 iCurrentContainer->HandleBackgroundGainedL(); |
3037 iCurrentContainer->HandleBackgroundGainedL(); |
3020 if ( IsRootdisplayedL() ) |
3038 if ( IsRootdisplayedL() ) |
3021 { |
3039 { |
3022 iCurrentContainer->RestoreWidgetPosition(); |
3040 iCurrentContainer->RestoreWidgetPosition(); |
3023 iCurrentContainer->CacheWidgetPosition(); |
3041 iCurrentContainer->CacheWidgetPosition(); |
3024 } |
3042 } |
3025 } |
3043 } |
3026 } |
3044 } |
3027 |
3045 |
3028 // End of File |
3046 // End of File |