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