sipplugins/sippsipsettingsui/src/sipsettlistsipsrvsetcontainer.cpp
changeset 0 307788aac0a8
child 4 dd3853b8dc3f
child 15 8248b03a2669
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 /*
       
     2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  The control container (view) of the proxy & registrar views
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 
       
    22 #include    <aknview.h>
       
    23 #include    <csxhelp/cp.hlp.hrh>
       
    24 #include    <gsfwviewuids.h>
       
    25 #include    <gssipsettingspluginrsc.rsg> //GUI Resource
       
    26 #include    "sipsettlistsipsrvsetcontainer.h"
       
    27 #include    "sipsettlistsipsrvsetmodel.h"
       
    28 #include    "sipsettlistsipsrvsetitemlist.h"
       
    29 #include     "sipsettingsplugin.h"
       
    30 #include    "gssippluginlogger.h"
       
    31 
       
    32 // LOCAL CONSTANTS AND MACROS
       
    33 
       
    34 const TInt KNumberOfControls = 1;
       
    35 const TInt KControlItemList = 0;
       
    36 
       
    37 // ============================ MEMBER FUNCTIONS ===============================
       
    38 
       
    39 // -----------------------------------------------------------------------------
       
    40 // CSIPSettListSIPSrvSetContainer::CSIPSettListSIPSrvSetContainer
       
    41 // C++ default constructor can NOT contain any code, that
       
    42 // might leave.
       
    43 // -----------------------------------------------------------------------------
       
    44 //
       
    45 CSIPSettListSIPSrvSetContainer::CSIPSettListSIPSrvSetContainer()
       
    46     {
       
    47     __GSLOGSTRING("CSIPSettListSIPSrvSetContainer::CSIPSettListSIPSrvSetContainer" )
       
    48     }
       
    49 
       
    50 // -----------------------------------------------------------------------------
       
    51 // CSIPSettListSIPSrvSetContainer::ConstructL
       
    52 // Symbian 2nd phase constructor can leave.
       
    53 // -----------------------------------------------------------------------------
       
    54 //
       
    55 void CSIPSettListSIPSrvSetContainer::ConstructL(
       
    56     const TRect& aRect,
       
    57     CSIPSettListSIPSrvSetModel& aModel,
       
    58     TInt aResourceID )
       
    59     {
       
    60     __GSLOGSTRING("CSIPSettListSIPSrvSetContainer::ConstructL Start" )
       
    61     CreateWindowL();
       
    62 
       
    63     if ( aResourceID == R_SIP_PROXY_SETTING_VIEW_ITEM_LIST )
       
    64         {
       
    65         iProxyServerView = ETrue;
       
    66         }
       
    67     else
       
    68         {
       
    69         iProxyServerView = EFalse;
       
    70         }    
       
    71     // Initialize item list
       
    72     iItemList = CSIPSettListSIPSrvSetItemList::NewL( 
       
    73         this, &aModel, aResourceID );    
       
    74 
       
    75     // Set limits to the view & activate it
       
    76     SetRect( aRect );    
       
    77     ActivateL();
       
    78     iTimer = CGSSIPTimer::NewL( *this, *(iItemList->ListBox()->View()->ItemDrawer()) );
       
    79     __GSLOGSTRING("CSIPSettListSIPSrvSetContainer::ConstructL End" )  
       
    80     }
       
    81 
       
    82 // -----------------------------------------------------------------------------
       
    83 // CSIPSettListSIPSrvSetContainer::NewL
       
    84 // Two-phased constructor.
       
    85 // -----------------------------------------------------------------------------
       
    86 //
       
    87 CSIPSettListSIPSrvSetContainer* CSIPSettListSIPSrvSetContainer::NewL(
       
    88     const TRect& aRect,             
       
    89     MObjectProvider* aProvider,
       
    90     CSIPSettListSIPSrvSetModel& aModel,
       
    91     TInt aResourceID )
       
    92     {
       
    93     __GSLOGSTRING("CSIPSettListSIPSrvSetContainer::NewL" )
       
    94     CSIPSettListSIPSrvSetContainer* self = 
       
    95         new ( ELeave ) CSIPSettListSIPSrvSetContainer();
       
    96     
       
    97     CleanupStack::PushL( self );
       
    98     self->SetMopParent( aProvider );
       
    99     self->ConstructL( aRect, aModel, aResourceID );
       
   100     CleanupStack::Pop( self );
       
   101 
       
   102     return self;
       
   103     }
       
   104 
       
   105     
       
   106 // Destructor
       
   107 CSIPSettListSIPSrvSetContainer::~CSIPSettListSIPSrvSetContainer()
       
   108     {    
       
   109     __GSLOGSTRING("CSIPSettListSIPSrvSetContainer::~CSIPSettListSIPSrvSetContainer" )
       
   110     delete iItemList;
       
   111     delete iTimer;
       
   112     iTimer = NULL;
       
   113     }
       
   114 
       
   115 // -----------------------------------------------------------------------------
       
   116 // CSIPSettListSIPSrvSetContainer::EditCurrentListItemL
       
   117 // Opens up the pop-up for changing a setting
       
   118 // -----------------------------------------------------------------------------
       
   119 //
       
   120 void CSIPSettListSIPSrvSetContainer::EditCurrentListItemL( TInt aCommand )
       
   121     {
       
   122     __GSLOGSTRING("CSIPSettListSIPSrvSetContainer::EditCurrentListItemL" )
       
   123     const TInt index = iItemList->ListBox()->CurrentItemIndex();
       
   124     if ( aCommand == EGSMSKCmdAppChange && index == EGSServerItemRouting)
       
   125         {
       
   126         iItemList->HandleListBoxEventL( iItemList->ListBox(),
       
   127             MEikListBoxObserver::EEventEnterKeyPressed );
       
   128         }
       
   129     else
       
   130         {
       
   131         iItemList->EditItemL( iItemList->ListBox()->CurrentItemIndex(), ETrue );    
       
   132         }
       
   133     }
       
   134 
       
   135 // -----------------------------------------------------------------------------
       
   136 // CSIPSettListSIPSrvSetContainer::StoreSettingsL
       
   137 // Stores settings from item list to variables
       
   138 // -----------------------------------------------------------------------------
       
   139 //
       
   140 void CSIPSettListSIPSrvSetContainer::StoreSettingsL()
       
   141     {    
       
   142     iItemList->StoreSettingsL();    
       
   143     }
       
   144 
       
   145 // -----------------------------------------------------------------------------
       
   146 // CSIPSettListSIPSrvSetContainer::CountComponentControls
       
   147 // Returns the amount of controls on the view
       
   148 // -----------------------------------------------------------------------------
       
   149 //
       
   150 TInt CSIPSettListSIPSrvSetContainer::CountComponentControls() const
       
   151     {
       
   152     return KNumberOfControls;
       
   153     }
       
   154 
       
   155 // -----------------------------------------------------------------------------
       
   156 // CSIPSettListSIPSrvSetContainer::ComponentControl
       
   157 // Returns list box
       
   158 // -----------------------------------------------------------------------------
       
   159 //
       
   160 CCoeControl* CSIPSettListSIPSrvSetContainer::ComponentControl( 
       
   161     TInt aIndex ) const
       
   162     {
       
   163     __GSLOGSTRING("CSIPSettListSIPSrvSetContainer::ComponentControl" )
       
   164     CCoeControl* cntrl = NULL;
       
   165 
       
   166     if ( aIndex == KControlItemList )
       
   167         {
       
   168         cntrl = iItemList->ListBox();
       
   169         }
       
   170                                                                   
       
   171     return cntrl;
       
   172     }
       
   173 
       
   174 // -----------------------------------------------------------------------------
       
   175 // CSIPSettListSIPSrvSetContainer::SizeChanged
       
   176 // Sets new size for the item list
       
   177 // -----------------------------------------------------------------------------
       
   178 //
       
   179 void CSIPSettListSIPSrvSetContainer::SizeChanged()
       
   180     {
       
   181     iItemList->ListBox()->SetRect( Rect() );
       
   182     }
       
   183 
       
   184 // -----------------------------------------------------------------------------
       
   185 // CSIPSettListSIPSrvSetContainer::OfferKeyEventL
       
   186 // Handles the key events, pushes them to item list
       
   187 // -----------------------------------------------------------------------------
       
   188 //
       
   189 TKeyResponse CSIPSettListSIPSrvSetContainer::OfferKeyEventL( 
       
   190     const TKeyEvent& aKeyEvent,
       
   191     TEventCode aType )
       
   192     {
       
   193     __GSLOGSTRING("CSIPSettListSIPSrvSetContainer::OfferKeyEventL" )
       
   194     // Pass the key event to list box
       
   195     if ( aKeyEvent.iCode == EKeyUpArrow || aKeyEvent.iCode == EKeyDownArrow )
       
   196         {
       
   197         iItemList->ListBox()->View()->ItemDrawer()->ClearFlags( CTextListItemDrawer::EDisableHighlight );
       
   198         DrawNow();
       
   199         iTimer->StartTimer();
       
   200 
       
   201         }
       
   202     return iItemList->OfferKeyEventL( aKeyEvent, aType );    
       
   203     }
       
   204 
       
   205 // -----------------------------------------------------------------------------
       
   206 // CSIPSettListSIPSrvSetContainer::FocusChanged()
       
   207 // Responds to a change in focus
       
   208 // -----------------------------------------------------------------------------
       
   209 //
       
   210 void CSIPSettListSIPSrvSetContainer::FocusChanged( TDrawNow aDrawNow )
       
   211     {
       
   212     __GSLOGSTRING("CSIPSettListSIPSrvSetContainer::FocusChanged" ) 
       
   213     if( iItemList )
       
   214         {
       
   215         iItemList->SetFocus( IsFocused(), aDrawNow );
       
   216         }
       
   217     
       
   218             iTimer->StopTimer();
       
   219      
       
   220         CCoeControl::FocusChanged( aDrawNow );
       
   221     
       
   222     }
       
   223 
       
   224 // ---------------------------------------------------------------------------
       
   225 // CSIPSettListSIPSrvSetContainer::HandleResourceChange
       
   226 // Resource change handling
       
   227 // ---------------------------------------------------------------------------
       
   228 // 
       
   229 void CSIPSettListSIPSrvSetContainer::HandleResourceChange( TInt aType )
       
   230     {
       
   231     __GSLOGSTRING("CSIPSettListSIPSrvSetContainer::HandleResourceChange" ) 
       
   232     CCoeControl::HandleResourceChange( aType );
       
   233     if ( aType == KEikDynamicLayoutVariantSwitch )
       
   234         {
       
   235         TRect mainPaneRect;
       
   236         AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane,
       
   237                                            mainPaneRect);
       
   238         SetRect( mainPaneRect );
       
   239         }
       
   240     }
       
   241 
       
   242 // ---------------------------------------------------------------------------
       
   243 // CSIPSettListSIPSrvSetContainer::GetHelpContext(TCoeHelpContext& aContext) const
       
   244 // Gets Help 
       
   245 //  
       
   246 // ---------------------------------------------------------------------------
       
   247 //
       
   248 void CSIPSettListSIPSrvSetContainer::GetHelpContext(TCoeHelpContext& aContext) const
       
   249     {
       
   250     __GSLOGSTRING("CSIPSettListSIPSrvSetContainer::GetHelpContext" ) 
       
   251     aContext.iMajor = KUidGS;
       
   252     if ( iProxyServerView )
       
   253         {
       
   254         aContext.iContext = KSIP_HLP_PROXY_PARAMS;    
       
   255         }
       
   256     else
       
   257         {
       
   258         aContext.iContext = KSIP_HLP_REGISTRAR_PARAM;
       
   259         }
       
   260     }
       
   261 
       
   262 // -----------------------------------------------------------------------------
       
   263 // CSIPSettListSIPSrvSetContainer::HandlePointerEventL()
       
   264 // Responds to a Pointer Event.
       
   265 // -----------------------------------------------------------------------------
       
   266 //
       
   267 void CSIPSettListSIPSrvSetContainer::HandlePointerEventL( const TPointerEvent& aPointerEvent )
       
   268     {
       
   269     __GSLOGSTRING("CSIPSettListSIPSrvSetContainer::HandlePointerEventL" ) 
       
   270      iItemList->ListBox()->View()->ItemDrawer()->ClearFlags( CTextListItemDrawer::EDisableHighlight );
       
   271      DrawNow();
       
   272      CCoeControl::HandlePointerEventL( aPointerEvent );
       
   273     }
       
   274 
       
   275 // -----------------------------------------------------------------------------
       
   276 // CSIPSettListSIPSrvSetContainer::IfPointerEvent()
       
   277 // Check if it is Pointer Event.
       
   278 // -----------------------------------------------------------------------------
       
   279 //
       
   280 TBool CSIPSettListSIPSrvSetContainer::IfPointerEvent()
       
   281     {
       
   282     return !( iTimer->IsStarted() );
       
   283     }
       
   284 
       
   285 //Third
       
   286 //  End of File