systemsettings/GSAccessoryPlugin/src/gsacchaccontainer.cpp
changeset 0 2e3d3ce01487
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 /*
       
     2 * Copyright (c) 2005-2008 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:  Implementation of CGSAccHACContainer class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <e32cmn.h> // For gsfwviewuids.h
       
    20 #include <gsaccessoryplugin.rsg>
       
    21 #include <gsfwviewuids.h> // for KUidGS
       
    22 #include <gslistbox.h>
       
    23 #include <csxhelp/cp.hlp.hrh>
       
    24 
       
    25 #include "gsaccessoryplugin.hrh"
       
    26 #include "gsaccessorypluginmodel.h"
       
    27 #include "gsacchaccontainer.h"
       
    28 #include "trace.h"
       
    29 
       
    30 // ========================= MEMBER FUNCTIONS ================================
       
    31 
       
    32 // ---------------------------------------------------------------------------
       
    33 // CGSAccHACContainer::CGSAccHACContainer()
       
    34 // ---------------------------------------------------------------------------
       
    35 //
       
    36 CGSAccHACContainer::CGSAccHACContainer(
       
    37     CGSAccessoryPluginModel& aModel )
       
    38   : CGSAccBaseContainer( aModel )
       
    39     {
       
    40     FUNC_LOG;
       
    41     }
       
    42 
       
    43 
       
    44 // ---------------------------------------------------------------------------
       
    45 // CGSAccHACContainer::~CGSAccHACContainer()
       
    46 // ---------------------------------------------------------------------------
       
    47 //
       
    48 CGSAccHACContainer::~CGSAccHACContainer()
       
    49     {
       
    50     FUNC_LOG;
       
    51 
       
    52     delete iHacItems;
       
    53     }
       
    54 
       
    55 
       
    56 // ---------------------------------------------------------------------------
       
    57 // CGSAccHACContainer::UpdateListBoxL()
       
    58 // ---------------------------------------------------------------------------
       
    59 //
       
    60 void CGSAccHACContainer::UpdateListBoxL( TInt aFeatureId )
       
    61     {
       
    62     FUNC_LOG;
       
    63 
       
    64     if ( aFeatureId == KGSSettIdHACMode )
       
    65         {
       
    66         RefreshHacModeL();
       
    67         }
       
    68 
       
    69     iListBox->HandleItemAdditionL();
       
    70     }
       
    71 
       
    72 
       
    73 // ---------------------------------------------------------------------------
       
    74 // CGSAccHACContainer::ConstructL()
       
    75 // ---------------------------------------------------------------------------
       
    76 //
       
    77 void CGSAccHACContainer::ConstructL( const TRect& aRect )
       
    78     {
       
    79     FUNC_LOG;
       
    80 
       
    81     CreateListBoxL();
       
    82     BaseConstructL( aRect, R_ACC_HAC_TITLE, R_ACC_HAC_LBX ); // Needs the listbox
       
    83     }
       
    84 
       
    85 
       
    86 // ---------------------------------------------------------------------------
       
    87 // CGSAccHACContainer::ConstructListBoxL()
       
    88 // ---------------------------------------------------------------------------
       
    89 //
       
    90 void CGSAccHACContainer::ConstructListBoxL( TInt aResLbxId )
       
    91     {
       
    92     FUNC_LOG;
       
    93 
       
    94     CGSAccBaseContainer::ConstructListBoxL( aResLbxId );
       
    95 
       
    96     iHacItems =
       
    97         iCoeEnv->ReadDesC16ArrayResourceL( R_ACC_HAC_MODE_SETTING_PAGE_LBX );
       
    98 
       
    99     RefreshHacModeL();
       
   100     MakeItemVisibleL( KGSSettIdHACMode );
       
   101     }
       
   102 
       
   103 
       
   104 // ---------------------------------------------------------------------------
       
   105 // CGSAccHACContainer::GetHelpContext() const
       
   106 // ---------------------------------------------------------------------------
       
   107 //
       
   108 void CGSAccHACContainer::GetHelpContext( TCoeHelpContext& aContext ) const
       
   109     {
       
   110     FUNC_LOG;
       
   111 
       
   112     aContext.iMajor = KUidGS;
       
   113     aContext.iContext = KSET_HLP_ACCESSORIES_LIST;
       
   114     }
       
   115 
       
   116 
       
   117 // ---------------------------------------------------------------------------
       
   118 // CGSAccHACContainer::RefreshHacModeL()
       
   119 // ---------------------------------------------------------------------------
       
   120 //
       
   121 void CGSAccHACContainer::RefreshHacModeL()
       
   122     {
       
   123     FUNC_LOG;
       
   124 
       
   125     TInt mode = iModel.HacMode();
       
   126     if ( iHacItems && mode >= 0 && mode < iHacItems->Count() )
       
   127         {
       
   128         SetItemTextL( KGSSettIdHACMode, ( *iHacItems )[ mode ] );
       
   129         }
       
   130     }
       
   131