systemsettings/GSAccessoryPlugin/src/gsaccwirelesscarkitcontainer.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 CGSAccWirelessCarkitContainer class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <e32cmn.h> // For accessoriescrkeys.h
       
    20 #include <accessoriescrkeys.h>
       
    21 #include <gsaccessoryplugin.rsg>
       
    22 #include <gsfwviewuids.h> // for KUidGS
       
    23 #include <gslistbox.h>
       
    24 #include <csxhelp/cp.hlp.hrh>
       
    25 
       
    26 #include "gsaccessoryplugin.hrh"
       
    27 #include "gsaccessorypluginmodel.h"
       
    28 #include "gsaccprofilelist.h"
       
    29 #include "gsaccwirelesscarkitcontainer.h"
       
    30 #include "trace.h"
       
    31 
       
    32 // ========================= MEMBER FUNCTIONS ================================
       
    33 
       
    34 // ---------------------------------------------------------------------------
       
    35 // CGSAccWirelessCarkitContainer::CGSAccWirelessCarkitContainer()
       
    36 // ---------------------------------------------------------------------------
       
    37 //
       
    38 CGSAccWirelessCarkitContainer::CGSAccWirelessCarkitContainer(
       
    39     CGSAccessoryPluginModel& aModel )
       
    40   : CGSAccBaseContainer( aModel )
       
    41     {
       
    42     FUNC_LOG;
       
    43     }
       
    44 
       
    45 
       
    46 // ---------------------------------------------------------------------------
       
    47 // CGSAccWirelessCarkitContainer::~CGSAccWirelessCarkitContainer()
       
    48 // ---------------------------------------------------------------------------
       
    49 //
       
    50 CGSAccWirelessCarkitContainer::~CGSAccWirelessCarkitContainer()
       
    51     {
       
    52     FUNC_LOG;
       
    53 
       
    54     delete iAutoAnswerItems;
       
    55     }
       
    56 
       
    57 
       
    58 // ---------------------------------------------------------------------------
       
    59 // CGSAccWirelessCarkitContainer::UpdateListBoxL()
       
    60 // ---------------------------------------------------------------------------
       
    61 //
       
    62 void CGSAccWirelessCarkitContainer::UpdateListBoxL( TInt aFeatureId )
       
    63     {
       
    64     FUNC_LOG;
       
    65 
       
    66     switch ( aFeatureId )
       
    67         {
       
    68         case KGSSettIdWCKDP:
       
    69             RefreshDefaultProfileL();
       
    70             break;
       
    71         case KGSSettIdWCKAA:
       
    72             RefreshAutoAnswerL();
       
    73             break;
       
    74         default:
       
    75             break;
       
    76         }
       
    77 
       
    78     iListBox->HandleItemAdditionL();
       
    79     }
       
    80 
       
    81 
       
    82 // ---------------------------------------------------------------------------
       
    83 // CGSAccWirelessCarkitContainer::ConstructL()
       
    84 // ---------------------------------------------------------------------------
       
    85 //
       
    86 void CGSAccWirelessCarkitContainer::ConstructL( const TRect& aRect )
       
    87     {
       
    88     FUNC_LOG;
       
    89 
       
    90     CreateListBoxL();
       
    91     BaseConstructL(
       
    92         aRect, R_ACC_WIRELESS_CARKIT_TITLE, R_ACC_WIRELESS_CARKIT_LBX ); // Needs the listbox
       
    93     }
       
    94 
       
    95 
       
    96 // ---------------------------------------------------------------------------
       
    97 // CGSAccWirelessCarkitContainer::ConstructListBoxL()
       
    98 // ---------------------------------------------------------------------------
       
    99 //
       
   100 void CGSAccWirelessCarkitContainer::ConstructListBoxL( TInt aResLbxId )
       
   101     {
       
   102     FUNC_LOG;
       
   103 
       
   104     CGSAccBaseContainer::ConstructListBoxL( aResLbxId );
       
   105 
       
   106     iAutoAnswerItems =
       
   107         iCoeEnv->ReadDesC16ArrayResourceL( R_ACC_AUTO_ANSWER_SETTING_PAGE_LBX );
       
   108 
       
   109     RefreshDefaultProfileL();
       
   110     MakeItemVisibleL( KGSSettIdWCKDP );
       
   111 
       
   112     RefreshAutoAnswerL();
       
   113     MakeItemVisibleL( KGSSettIdWCKAA );
       
   114     }
       
   115 
       
   116 
       
   117 // ---------------------------------------------------------------------------
       
   118 // CGSAccWirelessCarkitContainer::GetHelpContext() const
       
   119 // ---------------------------------------------------------------------------
       
   120 //
       
   121 void CGSAccWirelessCarkitContainer::GetHelpContext(
       
   122     TCoeHelpContext& aContext ) const
       
   123     {
       
   124     FUNC_LOG;
       
   125 
       
   126     aContext.iMajor = KUidGS;
       
   127     aContext.iContext = KSET_HLP_ACCESS_WIRELESS_CK;
       
   128     }
       
   129 
       
   130 
       
   131 // ---------------------------------------------------------------------------
       
   132 // CGSAccWirelessCarkitContainer::RefreshDefaultProfileL()
       
   133 // ---------------------------------------------------------------------------
       
   134 //
       
   135 void CGSAccWirelessCarkitContainer::RefreshDefaultProfileL()
       
   136     {
       
   137     FUNC_LOG;
       
   138 
       
   139     TInt profile =
       
   140         iModel.DefaultProfileByKey( KSettingsWirelessCarkitDefaultProfile );
       
   141     // Set default profile item text.
       
   142     SetItemTextL(
       
   143         KGSSettIdWCKDP,
       
   144         iModel.ProfileList().NameByIdL( profile, iCoeEnv ) );
       
   145     }
       
   146 
       
   147 
       
   148 // ---------------------------------------------------------------------------
       
   149 // CGSAccWirelessCarkitContainer::RefreshAutoAnswerL()
       
   150 // ---------------------------------------------------------------------------
       
   151 //
       
   152 void CGSAccWirelessCarkitContainer::RefreshAutoAnswerL()
       
   153     {
       
   154     FUNC_LOG;
       
   155 
       
   156     TInt mode =
       
   157         iModel.AutoAnswerModeByKey( KSettingsWirelessCarkitAutomaticAnswer );
       
   158     if ( iAutoAnswerItems && mode >= 0 && mode < iAutoAnswerItems->Count() )
       
   159         {
       
   160         SetItemTextL( KGSSettIdWCKAA, ( *iAutoAnswerItems )[ mode ] );
       
   161         }
       
   162     }