Changeset 21970 in webkit


Ignore:
Timestamp:
Jun 4, 2007 2:49:07 PM (17 years ago)
Author:
yongjzha
Message:

yadavall, reviewed by <yongjun.zhang@nokia.com>

DESC: Remove circular dependency between UI RSS file and engine
http://bugs.webkit.org/show_bug.cgi?id=13994

  • BrowserView/src/WidgetExtension.cpp: (CWidgetExtension::NewL): (CWidgetExtension::~CWidgetExtension): (CWidgetExtension::LaunchApplicationL): (CWidgetExtension::OpenApplication): (CWidgetExtension::SetPreferenceForKey): (CWidgetExtension::AddOptionMenuItemsL): (CWidgetExtension::MenuItemSelected): (CWidgetExtension::SetParamL): (CWidgetExtension::AddOptionsMenuItem): (CWidgetExtension::SetRightSoftKeyLabel): (CWidgetExtension::Append): (CWidgetExtension::DeleteMenuItem): (CWidgetExtension::ReplaceMenuItem): (CWidgetExtension::MenuItem): (CWidgetExtension::GetFromMenuItemCollection): (CWidgetExtension::SetDimmed): (CWidgetExtension::SetMenuItemObserver): (CWidgetExtension::MenuItemObserver): (CWidgetExtension::MenuObserver): (CWidgetExtension::RightKeyObserver): (CWidgetExtension::FindNodeById): (CWidgetExtension::FindNodeByText):
Location:
S60/trunk/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • S60/trunk/WebKit/BrowserView/src/WidgetExtension.cpp

    r21150 r21970  
    4646#include <apgtask.h>
    4747#include <browserlauncher.h>
    48 #include <widgetui.rsg>
    4948#include <widgetmenu.rsg>
    5049#include <eikbtgpc.h>
     50#include <avkon.hrh>
    5151
    5252#include "WidgetExtension.h"
     
    9393    MWidgetCallback& aWidgetCallback )
    9494    {
    95     CWidgetExtension* self = new ( ELeave ) CWidgetExtension( 
     95    CWidgetExtension* self = new ( ELeave ) CWidgetExtension(
    9696        aWebKitView, aWidgetCallback );
    9797    CleanupStack::PushL( self );
     
    139139    delete iWidgetBundleId;
    140140    // delete tree
    141     DeleteTree( iMenuRoot );   
     141    DeleteTree( iMenuRoot );
    142142    iLibrary.Close();
    143143    }
     
    190190// ----------------------------------------------------------------------------
    191191//
    192 void CWidgetExtension::LaunchApplicationL( 
     192void CWidgetExtension::LaunchApplicationL(
    193193    const TUid& aUid, const TDesC& aParam )
    194194    {
     
    232232// ----------------------------------------------------------------------------
    233233//
    234 void CWidgetExtension::OpenApplication( 
     234void CWidgetExtension::OpenApplication(
    235235    const TUid& aAppUid, const TDesC& aParam )
    236236    {
     
    297297// ----------------------------------------------------------------------------
    298298//
    299 void CWidgetExtension::SetPreferenceForKey( 
     299void CWidgetExtension::SetPreferenceForKey(
    300300    const TDesC& aKey, const TDesC& aValue )
    301301    {
     
    331331    }
    332332
    333 // The binary tree representation of a multiway tree is based on 
    334 // first child-next sibling representation of the tree. In this representation 
     333// The binary tree representation of a multiway tree is based on
     334// first child-next sibling representation of the tree. In this representation
    335335// every node is linked with its leftmost child and its next (right nearest)
    336 // sibling. 
    337 
    338 /* 
    339 Example: Consider the following multiway tree 
    340 
    341                         1                 
     336// sibling.
     337
     338/*
     339Example: Consider the following multiway tree
     340
     341                        1
    342342                      / | \
    343343                     /  |  \
     
    363363
    364364
    365 If we look at the first child-next sibling representation of the tree closely, 
    366 we will see that it forms a binary tree. To see this better, rotate every 
     365If we look at the first child-next sibling representation of the tree closely,
     366we will see that it forms a binary tree. To see this better, rotate every
    367367next-sibling edge 45 degrees clockwise. After that, the following binary tree is got:
    368368
     
    390390// ----------------------------------------------------------------------------
    391391//
    392 void CWidgetExtension::AddOptionMenuItemsL( 
     392void CWidgetExtension::AddOptionMenuItemsL(
    393393    CEikMenuPane& aMenuPane, TInt aResourceId )
    394394    {
     
    397397    TInt parentCmdId = -1;
    398398
    399     if ( aResourceId == R_WIDGETUI_MENU )
    400         {
    401         //invoke menu onshow callback
    402         if ( iWidgetEngineBridge )
    403             {
    404             iWidgetEngineBridge->MenuShowed();
    405             }
    406 
    407         if ( aMenuPane.NumberOfItemsInPane() > 1 )
    408             {
    409             aMenuPane.DeleteBetweenMenuItems(
    410                 0, aMenuPane.NumberOfItemsInPane() - 2 );
    411             }
    412         if ( iMenuRoot )
    413             node = iMenuRoot->FirstChild();
    414         }       
    415     else if ( aResourceId >= R_CASCADE_MENU_1 ) //one of the cascade menu pane
    416         {   
     399    if ( aResourceId >= R_CASCADE_MENU_1 ) //one of the cascade menu pane
     400        {
    417401        for ( TInt i = 0; i < iCascadeArr.Count(); i++ )
    418402            {
     
    424408            }
    425409        if ( parentCmdId != -1 )
    426             {   
     410            {
    427411            MenuItemSelected( parentCmdId + KMenuItemCommandIdBase);
    428412            parentNode = FindNodeById( iMenuRoot, parentCmdId );
     
    431415            node = parentNode->FirstChild();
    432416        }
     417    else
     418         {
     419         //invoke menu onshow callback
     420         if ( iWidgetEngineBridge )
     421             {
     422             iWidgetEngineBridge->MenuShowed();
     423             }
     424
     425         if ( aMenuPane.NumberOfItemsInPane() > 1 )
     426             {
     427             aMenuPane.DeleteBetweenMenuItems(
     428                 0, aMenuPane.NumberOfItemsInPane() - 2 );
     429             }
     430         if ( iMenuRoot )
     431             node = iMenuRoot->FirstChild();
     432        }
    433433
    434434    if ( node )
     
    436436        //add first child
    437437        AddMenuItem( aMenuPane, node );
    438        
     438
    439439        //add all other children (siblings of first child)
    440440        CMenuItem* sibling = node->NextSibling();
     
    489489// ----------------------------------------------------------------------------
    490490void CWidgetExtension::MenuItemSelected( TInt aCmdId )
    491     {   
     491    {
    492492    if ( iWidgetEngineBridge )
    493493        {
     
    495495        }
    496496
    497     OnShowSelected();   
     497    OnShowSelected();
    498498    }
    499499
     
    607607// -----------------------------------------------------------------------------
    608608//
    609 void CWidgetExtension::SetParamL( 
     609void CWidgetExtension::SetParamL(
    610610    TBrCtlDefs::TBrCtlWidgetParams aParam, const TDesC& aValue )
    611611    {
     
    635635// -----------------------------------------------------------------------------
    636636//
    637 void CWidgetExtension::SetParamL( 
     637void CWidgetExtension::SetParamL(
    638638    TBrCtlDefs::TBrCtlWidgetParams aParam, TUint aValue )
    639639    {
     
    657657// -----------------------------------------------------------------------------
    658658//
    659 void CWidgetExtension::AddOptionsMenuItem( 
     659void CWidgetExtension::AddOptionsMenuItem(
    660660    const TDesC& aText, TInt aCmdId, TInt aParentId, void* aObj )
    661     {   
    662     if ( !iMenuRoot ) 
    663         { 
     661    {
     662    if ( !iMenuRoot )
     663        {
    664664        iMenuRoot = CMenuItem::NewL( _L(""), -1 );
    665         }   
     665        }
    666666    if ( aText.Length() > 0 )
    667667        {
     
    669669        if ( !parent )
    670670            return;
    671         CMenuItem* item = CMenuItem::NewL( aText, aCmdId, parent, aObj ); 
    672         Append( parent, item );   
     671        CMenuItem* item = CMenuItem::NewL( aText, aCmdId, parent, aObj );
     672        Append( parent, item );
    673673        }
    674674    }
     
    683683void CWidgetExtension::SetRightSoftKeyLabel( const TDesC& aText )
    684684    {
    685     CEikButtonGroupContainer * pCbaGroup = CEikButtonGroupContainer::Current();     
     685    CEikButtonGroupContainer * pCbaGroup = CEikButtonGroupContainer::Current();
    686686    pCbaGroup->SetCommandL( EAknSoftkeyExit, aText );
    687687    pCbaGroup->DrawNow();
     
    695695// -----------------------------------------------------------------------------
    696696//
    697 TBool CWidgetExtension::Append( 
     697TBool CWidgetExtension::Append(
    698698    CMenuItem* aParent, CMenuItem* aItem )
    699     { 
     699    {
    700700    if ( !aParent )
    701701        return EFalse;
    702702
    703     if ( aParent->FirstChild() == NULL ) //first child 
    704         { 
    705         aParent->SetFirstChild( aItem ); 
    706         } 
     703    if ( aParent->FirstChild() == NULL ) //first child
     704        {
     705        aParent->SetFirstChild( aItem );
     706        }
    707707    else //insert as sibling of first child
    708         { 
     708        {
    709709        AppendSibling( aParent->FirstChild(), aItem );
    710710        }
    711     return ETrue;           
    712     } 
     711    return ETrue;
     712    }
    713713
    714714// -----------------------------------------------------------------------------
     
    742742void CWidgetExtension::DeleteMenuItem( TInt aCmdId )
    743743    {
    744     CMenuItem* node = FindNodeById( iMenuRoot, aCmdId ); 
     744    CMenuItem* node = FindNodeById( iMenuRoot, aCmdId );
    745745
    746746    if ( !node )
     
    762762            }
    763763        //or one of the sibling of firstchild
    764         else 
     764        else
    765765            {
    766766            CMenuItem* prev = parent->FirstChild();
     
    777777                    break;
    778778                    }
    779                 item = item->NextSibling();   
     779                item = item->NextSibling();
    780780                }
    781781            }
     
    803803// ----------------------------------------------------------------------------
    804804//
    805 void CWidgetExtension::ReplaceMenuItem( 
    806     TInt oldItemCmdId, 
    807     const TDesC& newItemText, 
    808     TInt newItemCmdId, 
     805void CWidgetExtension::ReplaceMenuItem(
     806    TInt oldItemCmdId,
     807    const TDesC& newItemText,
     808    TInt newItemCmdId,
    809809    TInt newItemDimmed )
    810810    {
    811811    CMenuItem* node = NULL;
    812812
    813     node = FindNodeById( iMenuRoot, oldItemCmdId );   
     813    node = FindNodeById( iMenuRoot, oldItemCmdId );
    814814    if ( node )
    815815        {
    816         node->SetText( newItemText );   
    817         node->SetCmdId( newItemCmdId );   
     816        node->SetText( newItemText );
     817        node->SetCmdId( newItemCmdId );
    818818        node->SetDimmed( newItemDimmed );
    819819        }
     
    827827// ----------------------------------------------------------------------------
    828828//
    829 void CWidgetExtension::MenuItem( 
     829void CWidgetExtension::MenuItem(
    830830    TDes& textVal, TInt& cmdId, TBool& dimStat )
    831831    {
     
    834834    if ( cmdId == -1 )
    835835        {
    836         node = FindNodeByText( iMenuRoot, textVal ); 
     836        node = FindNodeByText( iMenuRoot, textVal );
    837837        }
    838838    else
     
    859859    CMenuItem* node = NULL;
    860860
    861     node = FindNodeByText( iMenuRoot, textVal ); 
     861    node = FindNodeByText( iMenuRoot, textVal );
    862862    if ( node )
    863863        return node->Obj();
    864864    else
    865         return NULL;   
     865        return NULL;
    866866    }
    867867
     
    877877    CMenuItem* node = NULL;
    878878
    879     node = FindNodeById( iMenuRoot, cmdId ); 
     879    node = FindNodeById( iMenuRoot, cmdId );
    880880    if ( node )
    881881        return node->Obj();
    882882    else
    883         return NULL;   
     883        return NULL;
    884884    }
    885885
     
    894894    {
    895895    CMenuItem* node = NULL;
    896     node = FindNodeById( iMenuRoot, aCmdId );       
    897     if ( node ) 
     896    node = FindNodeById( iMenuRoot, aCmdId );
     897    if ( node )
    898898        node->SetDimmed( aValue );
    899899    }
     
    906906// ----------------------------------------------------------------------------
    907907//
    908 void CWidgetExtension::SetMenuItemObserver( 
     908void CWidgetExtension::SetMenuItemObserver(
    909909    TInt aCmdId, WidgetEventHandler* aOnSelectCallback )
    910910    {
    911911    CMenuItem* node = NULL;
    912     node = FindNodeById( iMenuRoot, aCmdId ); 
     912    node = FindNodeById( iMenuRoot, aCmdId );
    913913    if ( node )
    914914        node->SetCallback( aOnSelectCallback );
     
    925925    {
    926926    CMenuItem* node = NULL;
    927     node = FindNodeById( iMenuRoot, aCmdId ); 
     927    node = FindNodeById( iMenuRoot, aCmdId );
    928928    if ( node )
    929929        return node->Callback();
     
    953953//
    954954WidgetEventHandler* CWidgetExtension::MenuObserver()
    955     { 
     955    {
    956956    return iMenuCallback;
    957957    }
     
    977977//
    978978WidgetEventHandler* CWidgetExtension::RightKeyObserver()
    979     { 
     979    {
    980980    return iRightKeyCallback;
    981981    }
     
    10081008    CMenuItem* item = NULL;
    10091009
    1010     if ( !node ) 
     1010    if ( !node )
    10111011        return item;
    10121012
     
    10171017    else
    10181018        {
    1019         if ( node->FirstChild() ) 
    1020             { 
    1021             item = FindNodeById( node->FirstChild(), aCmdId ); 
    1022             if ( item ) 
     1019        if ( node->FirstChild() )
     1020            {
     1021            item = FindNodeById( node->FirstChild(), aCmdId );
     1022            if ( item )
    10231023                return item;
    1024             } 
     1024            }
    10251025        if ( node->NextSibling() )
    1026             { 
    1027             item = FindNodeById( node->NextSibling(), aCmdId ); 
     1026            {
     1027            item = FindNodeById( node->NextSibling(), aCmdId );
    10281028            }
    10291029        }
     
    10421042    CMenuItem* item = NULL;
    10431043
    1044     if ( !node ) 
     1044    if ( !node )
    10451045        return item;
    10461046
     
    10511051    else
    10521052        {
    1053         if ( node->FirstChild() ) 
    1054             { 
    1055             item = FindNodeByText( node->FirstChild(), aText ); 
    1056 
    1057             if ( item ) 
     1053        if ( node->FirstChild() )
     1054            {
     1055            item = FindNodeByText( node->FirstChild(), aText );
     1056
     1057            if ( item )
    10581058                return item;
    1059             } 
     1059            }
    10601060        if ( node->NextSibling() )
    1061             { 
    1062             item = FindNodeByText( node->NextSibling(), aText ); 
     1061            {
     1062            item = FindNodeByText( node->NextSibling(), aText );
    10631063            }
    10641064        }
  • S60/trunk/WebKit/ChangeLog

    r21915 r21970  
     1yadavall, reviewed by <yongjun.zhang@nokia.com>
     2 DESC: Remove circular dependency between UI RSS file and engine
     3 http://bugs.webkit.org/show_bug.cgi?id=13994
     4
     5        * BrowserView/src/WidgetExtension.cpp:
     6        (CWidgetExtension::NewL):
     7        (CWidgetExtension::~CWidgetExtension):
     8        (CWidgetExtension::LaunchApplicationL):
     9        (CWidgetExtension::OpenApplication):
     10        (CWidgetExtension::SetPreferenceForKey):
     11        (CWidgetExtension::AddOptionMenuItemsL):
     12        (CWidgetExtension::MenuItemSelected):
     13        (CWidgetExtension::SetParamL):
     14        (CWidgetExtension::AddOptionsMenuItem):
     15        (CWidgetExtension::SetRightSoftKeyLabel):
     16        (CWidgetExtension::Append):
     17        (CWidgetExtension::DeleteMenuItem):
     18        (CWidgetExtension::ReplaceMenuItem):
     19        (CWidgetExtension::MenuItem):
     20        (CWidgetExtension::GetFromMenuItemCollection):
     21        (CWidgetExtension::SetDimmed):
     22        (CWidgetExtension::SetMenuItemObserver):
     23        (CWidgetExtension::MenuItemObserver):
     24        (CWidgetExtension::MenuObserver):
     25        (CWidgetExtension::RightKeyObserver):
     26        (CWidgetExtension::FindNodeById):
     27        (CWidgetExtension::FindNodeByText):
     28
    129spadma, reviewed by zalan
    230 DESC: Browser control API, CBrCtlInterface:: ContentSize() does not return correct content size.
Note: See TracChangeset for help on using the changeset viewer.