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