53 #include "xncomponentnodeimpl.h" |
53 #include "xncomponentnodeimpl.h" |
54 #include "c_xnutils.h" |
54 #include "c_xnutils.h" |
55 |
55 |
56 #undef _AVKON_CBA_LSC |
56 #undef _AVKON_CBA_LSC |
57 |
57 |
58 _LIT8( KWidgetSpecific, "Menu/WidgetSpecific" ); |
|
59 _LIT8( KViewSpecific, "Menu/ViewSpecific" ); |
|
60 _LIT8( KWidgetsHidden, "Menu/WidgetsHidden" ); |
|
61 _LIT8( KWidgetsShown, "Menu/WidgetsShown" ); |
|
62 _LIT8( KEditMode, "Menu/EditMode" ); |
58 _LIT8( KEditMode, "Menu/EditMode" ); |
|
59 _LIT8( KNormalMode, "Menu/NormalMode" ); |
63 _LIT8( KAlwaysShown, "Menu/AlwaysShown" ); |
60 _LIT8( KAlwaysShown, "Menu/AlwaysShown" ); |
64 _LIT8( KHsShowHelp, "hs_show_help" ); |
61 _LIT8( KHsShowHelp, "hs_show_help" ); |
65 |
62 |
66 const TInt KMenuCommandFirst = 6000; |
63 const TInt KMenuCommandFirst = 6000; |
67 const TInt KMenuCommandLast = 6199; |
64 const TInt KMenuCommandLast = 6199; |
68 const TInt KCBACommandFirst = 6200; |
65 const TInt KCBACommandFirst = EAknSoftkeyOptions; |
69 const TInt KCBACommandSecond = 6201; |
66 const TInt KCBACommandSecond = EAknSoftkeyBack; |
70 const TInt KCBACommandMiddle = 6202; |
67 const TInt KCBACommandMiddle = EAknSoftkeyDialler; |
71 |
68 |
72 const TInt KXnMenuArrayGranularity = 6; |
69 const TInt KXnMenuArrayGranularity = 6; |
73 const TInt KWideScreenWidth = 640; |
70 const TInt KWideScreenWidth = 640; |
74 |
71 |
75 using namespace XnPropertyNames; |
72 using namespace XnPropertyNames; |
807 CleanupStack::PopAndDestroy( &children ); |
804 CleanupStack::PopAndDestroy( &children ); |
808 |
805 |
809 return retval; |
806 return retval; |
810 } |
807 } |
811 |
808 |
|
809 // ----------------------------------------------------------------------------- |
|
810 // FindWidgetElementL |
|
811 // |
|
812 // ----------------------------------------------------------------------------- |
|
813 // |
|
814 static CXnNodePluginIf* FindWidgetElementL( CXnNodePluginIf& aPluginNode ) |
|
815 { |
|
816 CXnNodePluginIf* retval( NULL ); |
|
817 |
|
818 RPointerArray< CXnNodePluginIf > children( aPluginNode.ChildrenL() ); |
|
819 CleanupClosePushL( children ); |
|
820 |
|
821 for ( TInt i = 0; i < children.Count(); i++ ) |
|
822 { |
|
823 CXnNodePluginIf* node( children[i] ); |
|
824 |
|
825 if ( node->AppIfL().InternalDomNodeType() == XnPropertyNames::KWidget ) |
|
826 { |
|
827 retval = node; |
|
828 break; |
|
829 } |
|
830 } |
|
831 |
|
832 CleanupStack::PopAndDestroy( &children ); |
|
833 |
|
834 return retval; |
|
835 } |
|
836 |
812 // ============================ MEMBER FUNCTIONS =============================== |
837 // ============================ MEMBER FUNCTIONS =============================== |
813 |
838 |
814 // ----------------------------------------------------------------------------- |
839 // ----------------------------------------------------------------------------- |
815 // CXnMenuAdapter::NewL |
840 // CXnMenuAdapter::NewL |
816 // Symbian static 1st phase constructor |
841 // Symbian static 1st phase constructor |
1447 void CXnMenuAdapter::PopulateMenuL() |
1472 void CXnMenuAdapter::PopulateMenuL() |
1448 { |
1473 { |
1449 iMenuItems.Reset(); |
1474 iMenuItems.Reset(); |
1450 |
1475 |
1451 iIdCounter = KMenuCommandFirst; |
1476 iIdCounter = KMenuCommandFirst; |
1452 |
1477 |
1453 CXnNodePluginIf* focused( iUiEngine->FocusedNodeL() ); |
|
1454 |
|
1455 const TDesC8& ns( iRootNode->Namespace() ); |
|
1456 |
|
1457 TBool widgetSpecific( EFalse ); |
|
1458 |
|
1459 for( ; focused ; focused = focused->ParentL() ) |
|
1460 { |
|
1461 if( focused->AppIfL().InternalDomNodeType() == XnPropertyNames::KPlugin ) |
|
1462 { |
|
1463 widgetSpecific = ETrue; |
|
1464 break; |
|
1465 } |
|
1466 } |
|
1467 |
|
1468 TBool widgetsShown( iUiEngine->WidgetsVisible() ); |
|
1469 |
|
1470 RPointerArray< const TDesC8 > groups; |
1478 RPointerArray< const TDesC8 > groups; |
1471 CleanupClosePushL( groups ); |
1479 CleanupClosePushL( groups ); |
1472 |
1480 |
1473 if( iUiEngine->EditMode() ) |
1481 if( iUiEngine->EditMode() ) |
1474 { |
1482 { |
1475 groups.AppendL( &KEditMode ); |
1483 groups.AppendL( &KEditMode ); |
1476 } |
1484 } |
1477 else |
1485 else |
1478 { |
1486 { |
1479 groups.AppendL( widgetSpecific ? &KWidgetSpecific : &KViewSpecific ); |
1487 groups.Append( &KNormalMode ); |
1480 groups.AppendL( widgetsShown ? &KWidgetsShown : &KWidgetsHidden ); |
|
1481 } |
1488 } |
1482 |
1489 |
1483 groups.AppendL( &KAlwaysShown ); |
1490 groups.AppendL( &KAlwaysShown ); |
1484 |
1491 |
1485 // Recursively add menuitems |
1492 // Recursively add menuitems |
2734 if ( focusedNode && aNode ) |
2741 if ( focusedNode && aNode ) |
2735 { |
2742 { |
2736 // Get <plugin> element |
2743 // Get <plugin> element |
2737 CXnNodePluginIf& pluginNode( iUiEngine->PluginNodeL( focusedNode ) ); |
2744 CXnNodePluginIf& pluginNode( iUiEngine->PluginNodeL( focusedNode ) ); |
2738 |
2745 |
2739 RPointerArray< CXnNodePluginIf > children( pluginNode.ChildrenL() ); |
2746 CXnNodePluginIf* widget( FindWidgetElementL( pluginNode ) ); |
2740 CleanupClosePushL( children ); |
2747 |
2741 |
|
2742 CXnNodePluginIf* widgetExtNode( NULL ); |
2748 CXnNodePluginIf* widgetExtNode( NULL ); |
2743 |
2749 |
2744 if( children.Count() > 0 ) |
2750 if( widget ) |
2745 { |
2751 { |
2746 // children[0] must be <widget> element |
2752 widgetExtNode = FindChildL( *widget, KXnMenuExtension ); |
2747 widgetExtNode = FindChildL( *children[0], KXnMenuExtension ); |
|
2748 } |
2753 } |
2749 |
2754 |
2750 if( !widgetExtNode ) |
2755 if( !widgetExtNode ) |
2751 { |
2756 { |
2752 widgetExtNode = focusedNode; |
2757 widgetExtNode = focusedNode; |