27 |
27 |
28 #include "akncollectionobserver.h" |
28 #include "akncollectionobserver.h" |
29 #include "aknitemactionmenudata.h" |
29 #include "aknitemactionmenudata.h" |
30 #include "aknitemactionmenuregister.h" |
30 #include "aknitemactionmenuregister.h" |
31 #include "akntrace.h" |
31 #include "akntrace.h" |
|
32 #include "aknmarkingmode.h" |
32 |
33 |
33 /** |
34 /** |
34 * Index for invalid list index. |
35 * Index for invalid list index. |
35 */ |
36 */ |
36 const TInt KInvalidListIndex( -1 ); |
37 const TInt KInvalidListIndex( -1 ); |
376 return iOwner; |
378 return iOwner; |
377 } |
379 } |
378 |
380 |
379 |
381 |
380 // --------------------------------------------------------------------------- |
382 // --------------------------------------------------------------------------- |
|
383 // CAknItemActionMenu::MarkingMode |
|
384 // --------------------------------------------------------------------------- |
|
385 // |
|
386 CAknMarkingMode& CAknItemActionMenu::MarkingMode() |
|
387 { |
|
388 _AKNTRACE_FUNC_ENTER; |
|
389 _AKNTRACE_FUNC_EXIT; |
|
390 return *iMarking; |
|
391 } |
|
392 |
|
393 |
|
394 // --------------------------------------------------------------------------- |
381 // CAknItemActionMenu::CAknItemActionMenu |
395 // CAknItemActionMenu::CAknItemActionMenu |
382 // --------------------------------------------------------------------------- |
396 // --------------------------------------------------------------------------- |
383 // |
397 // |
384 CAknItemActionMenu::CAknItemActionMenu( MObjectProvider* aOwner ) |
398 CAknItemActionMenu::CAknItemActionMenu( MObjectProvider* aOwner ) |
385 : iPopupMenu( NULL ), |
399 : iPopupMenu( NULL ), |
386 iMenuBarObserver( NULL ), |
400 iMenuBarObserver( NULL ), |
387 iMenuBar( NULL ), |
401 iMenuBar( NULL ), |
388 iMenuPane( NULL ), |
402 iMenuPane( NULL ), |
389 iMenuData( NULL ), |
403 iMenuData( NULL ), |
390 iOwner( aOwner ) |
404 iOwner( aOwner ), |
|
405 iMarking( NULL ) |
391 { |
406 { |
392 _AKNTRACE_FUNC_ENTER; |
407 _AKNTRACE_FUNC_ENTER; |
393 AKNTASHOOK_ADD( this, "CAknItemActionMenu" ); |
408 AKNTASHOOK_ADD( this, "CAknItemActionMenu" ); |
394 _AKNTRACE_FUNC_EXIT; |
409 _AKNTRACE_FUNC_EXIT; |
395 } |
410 } |
402 void CAknItemActionMenu::ConstructL( MAknCollection& aCollection ) |
417 void CAknItemActionMenu::ConstructL( MAknCollection& aCollection ) |
403 { |
418 { |
404 _AKNTRACE_FUNC_ENTER; |
419 _AKNTRACE_FUNC_ENTER; |
405 AddCollectionStateL( aCollection ); |
420 AddCollectionStateL( aCollection ); |
406 iMenuData = CAknItemActionMenuData::NewL(); |
421 iMenuData = CAknItemActionMenuData::NewL(); |
|
422 iMarking = CAknMarkingMode::NewL( *this, iStates ); |
407 _AKNTRACE_FUNC_EXIT; |
423 _AKNTRACE_FUNC_EXIT; |
408 } |
424 } |
409 |
425 |
410 |
426 |
411 // --------------------------------------------------------------------------- |
427 // --------------------------------------------------------------------------- |
494 TInt cascadeId( iMenuData->MenuItemCascadeId( aCommandId ) ); |
510 TInt cascadeId( iMenuData->MenuItemCascadeId( aCommandId ) ); |
495 if ( cascadeId && iMenuPane ) |
511 if ( cascadeId && iMenuPane ) |
496 { |
512 { |
497 TMenuItemTextBuf text = iMenuData->MenuItemText( aCommandId ); |
513 TMenuItemTextBuf text = iMenuData->MenuItemText( aCommandId ); |
498 iMenuData->Reset(); |
514 iMenuData->Reset(); |
499 iMenuPane->AddCascadeMenuItemsToActionMenuL( |
515 iMenuPane->AddCascadeMenuItemsToMenuL( |
500 cascadeId, EFalse, *iMenuData ); |
516 cascadeId, EFalse, ETrue, iMenuData ); |
501 aCommandId = LaunchSubMenuQueryL( text ); |
517 aCommandId = LaunchSubMenuQueryL( text ); |
502 } |
518 } |
503 |
519 |
504 if ( aCommandId > 0 && iMenuBarObserver ) |
520 if ( aCommandId > 0 && iMenuData->MenuItemCommandId( aCommandId ) |
|
521 == EAknCmdMarkingModeMarkOne && iMenuBar ) |
|
522 { |
|
523 MarkingMode().MarkCurrentItemL(); |
|
524 } |
|
525 else if ( aCommandId > 0 && iMenuBarObserver ) |
505 { |
526 { |
506 iProcessingCommand = ETrue; |
527 iProcessingCommand = ETrue; |
507 iMenuBarObserver->ProcessCommandL( |
528 iMenuBarObserver->ProcessCommandL( |
508 iMenuData->MenuItemCommandId( aCommandId ) ); |
529 iMenuData->MenuItemCommandId( aCommandId ) ); |
509 iProcessingCommand = EFalse; |
530 iProcessingCommand = EFalse; |
|
531 // Try exit marking mode |
|
532 MarkingMode().TryExitMarkingMode(); |
510 } |
533 } |
511 } |
534 } |
512 // Inform collection that submenu was closed |
535 // Inform collection that submenu was closed |
513 if ( informState && iStates.Find( informState ) != KErrNotFound ) |
536 if ( informState && iStates.Find( informState ) != KErrNotFound ) |
514 { |
537 { |