1248 iPopupMenu->SetPosition( aPenEventLocation, |
1248 iPopupMenu->SetPosition( aPenEventLocation, |
1249 CAknStylusPopUpMenu::EPositionTypeLeftBottom ); |
1249 CAknStylusPopUpMenu::EPositionTypeLeftBottom ); |
1250 } |
1250 } |
1251 |
1251 |
1252 if( iCurrentSuiteModel == iHNInterface->GetLastSuiteModelL() |
1252 if( iCurrentSuiteModel == iHNInterface->GetLastSuiteModelL() |
1253 && iCurrentContainer->IsHighlightVisible() |
1253 && iCurrentContainer->IsHighlightVisible() |
1254 && iCurrentContainer->GetSuiteModelL()->GetItemModelsCount() > 1 ) |
1254 && iCurrentContainer->GetSuiteModelL()->GetItemModelsCount() > 1 ) |
1255 { |
1255 { |
1256 MMPERF(("CMmAppUi::DynInitMenuPaneL - START")); |
1256 MMPERF(("CMmAppUi::DynInitMenuPaneL - START")); |
1257 //fill the main menu structure, look for cascade menus |
1257 //fill the main menu structure, look for cascade menus |
1258 //reset the helper hash map |
1258 //reset the helper hash map |
1259 iCascadeMenuMap.Close(); |
1259 iCascadeMenuMap.Close(); |
1260 |
1260 |
1261 MHnMenuItemModelIterator* menuIterator = |
1261 MHnMenuItemModelIterator* menuIterator = |
1262 iCurrentSuiteModel->GetMenuStructureL( |
1262 iCurrentSuiteModel->GetMenuStructureL( |
1263 iCurrentSuiteModel->IdByIndex( |
1263 iCurrentSuiteModel->IdByIndex( |
1264 iCurrentContainer->GetHighlight() ) ); |
1264 iCurrentContainer->GetHighlight() ) ); |
1265 |
1265 |
1266 // check if there is a menu structure available |
1266 // check if there is a menu structure available |
1267 // for the specified item |
1267 // for the specified item |
1268 if ( menuIterator ) |
1268 if ( menuIterator ) |
1269 { |
1269 { |
1270 //create item sorting helper objects |
1270 //create item sorting helper objects |
1271 RArray<TInt> positionArray; |
1271 RArray<TInt> positionArray; |
1272 CleanupClosePushL( positionArray ); |
1272 CleanupClosePushL( positionArray ); |
1273 RHashMap<TInt, CEikMenuPaneItem::SData> menuItemMap; |
1273 RHashMap<TInt, CEikMenuPaneItem::SData> menuItemMap; |
1274 CleanupClosePushL( menuItemMap ); |
1274 CleanupClosePushL( menuItemMap ); |
1275 |
1275 |
1276 while ( menuIterator->HasNextSpecific() ) |
1276 while ( menuIterator->HasNextSpecific() ) |
1277 { |
1277 { |
1278 CHnMenuItemModel* childItem = menuIterator->GetNextSpecific(); |
1278 CHnMenuItemModel* childItem = menuIterator->GetNextSpecific(); |
1279 CEikMenuPaneItem::SData childData; |
1279 CEikMenuPaneItem::SData childData; |
1280 childData.iCommandId = childItem->Command(); |
1280 childData.iCommandId = childItem->Command(); |
1281 childData.iText = childItem->NameL(). |
1281 childData.iText = childItem->NameL(). |
1282 Left( CEikMenuPaneItem::SData::ENominalTextLength ); |
1282 Left( CEikMenuPaneItem::SData::ENominalTextLength ); |
1283 childData.iFlags = 0; |
1283 childData.iFlags = 0; |
1284 childData.iCascadeId = 0; |
1284 childData.iCascadeId = 0; |
1285 |
1285 |
1286 positionArray.AppendL( childItem->Position() ); |
1286 positionArray.AppendL( childItem->Position() ); |
1287 menuItemMap.InsertL( childItem->Position(), childData ); |
1287 menuItemMap.InsertL( childItem->Position(), childData ); |
1288 } |
1288 } |
1289 |
1289 |
1290 positionArray.Sort(); |
1290 positionArray.Sort(); |
1291 |
1291 |
1292 //add items in correct order |
1292 //add items in correct order |
1293 for ( TInt i = 0; i < positionArray.Count(); ++i ) |
1293 for ( TInt i = 0; i < positionArray.Count(); ++i ) |
1294 { |
1294 { |
1295 iPopupMenu-> |
1295 iPopupMenu->AddMenuItemL( |
1296 AddMenuItemL( |
1296 menuItemMap.FindL( positionArray[i] ).iText, |
1297 menuItemMap.FindL( positionArray[i] ).iText, |
1297 menuItemMap.FindL( positionArray[i] ).iCommandId ); |
1298 menuItemMap.FindL( positionArray[i] ).iCommandId ); |
1298 } |
1299 } |
1299 |
1300 |
1300 if (positionArray.Count()>0) |
1301 if (positionArray.Count()>0) |
1301 { |
1302 { |
1302 iPopupMenu->ShowMenu(); |
1303 iPopupMenu->ShowMenu(); |
1303 popupMenuDisplayed = ETrue; |
1304 popupMenuDisplayed = ETrue; |
1304 } |
1305 } |
1305 CleanupStack::PopAndDestroy( &menuItemMap ); |
1306 CleanupStack::PopAndDestroy( &menuItemMap ); |
1306 CleanupStack::PopAndDestroy( &positionArray ); |
1307 CleanupStack::PopAndDestroy( &positionArray ); |
1307 } |
1308 } |
1308 MMPERF(("CMmAppUi::DynInitMenuPaneL - STOP")); |
1309 MMPERF(("CMmAppUi::DynInitMenuPaneL - STOP")); |
1309 } |
1310 } |
|
1311 |
1310 |
1312 if ( !popupMenuDisplayed && iCurrentContainer ) |
1311 if ( !popupMenuDisplayed && iCurrentContainer ) |
1313 { |
1312 { |
1314 iCurrentContainer->EndLongTapL( ETrue ); |
1313 iCurrentContainer->EndLongTapL( ETrue ); |
1315 HandleHighlightItemSingleClickedL( |
1314 HandleHighlightItemSingleClickedL( |
1316 iCurrentContainer->Widget()->CurrentItemIndex() ); |
1315 iCurrentContainer->Widget()->CurrentItemIndex() ); |
1317 } |
1316 } |
1318 } |
1317 } |
1319 |
1318 |
1320 // --------------------------------------------------------------------------- |
1319 // --------------------------------------------------------------------------- |
1321 // |
1320 // |