systemsettings/GSAccessoryPlugin/src/gsaccheadsetview.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 CGSAccHeadsetView class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <e32cmn.h> // For accessoriescrkeys.h
       
    20 #include <accessoriescrkeys.h>
       
    21 #include <gsaccessoryplugin.rsg>
       
    22 #include <gscommon.hrh>
       
    23 
       
    24 #include "acclocalviewids.h"
       
    25 #include "gsaccessoryplugin.hrh"
       
    26 #include "gsaccheadsetview.h"
       
    27 #include "gsaccheadsetcontainer.h"
       
    28 #include "trace.h"
       
    29 
       
    30 // ========================= MEMBER FUNCTIONS ================================
       
    31 
       
    32 // ---------------------------------------------------------------------------
       
    33 // CGSAccHeadsetView::NewLC()
       
    34 // ---------------------------------------------------------------------------
       
    35 //
       
    36 CGSAccHeadsetView* CGSAccHeadsetView::NewLC( CGSAccessoryPluginModel& aModel )
       
    37     {
       
    38     CGSAccHeadsetView* self = new ( ELeave ) CGSAccHeadsetView( aModel );
       
    39     CleanupStack::PushL( self );
       
    40     self->BaseConstructL( R_ACC_HEADSET_VIEW );
       
    41     return self;
       
    42     }
       
    43 
       
    44 
       
    45 // ---------------------------------------------------------------------------
       
    46 // CGSAccHeadsetView::~CGSAccHeadsetView()
       
    47 // ---------------------------------------------------------------------------
       
    48 //
       
    49 CGSAccHeadsetView::~CGSAccHeadsetView()
       
    50     {
       
    51     FUNC_LOG;
       
    52     }
       
    53 
       
    54 
       
    55 // ---------------------------------------------------------------------------
       
    56 // TUid CGSAccHeadsetView::Id()
       
    57 // ---------------------------------------------------------------------------
       
    58 //
       
    59 TUid CGSAccHeadsetView::Id() const
       
    60     {
       
    61     return KAccHeadsetViewId;
       
    62     }
       
    63 
       
    64 
       
    65 // ---------------------------------------------------------------------------
       
    66 // CGSAccHeadsetView::HandleCommandL()
       
    67 // ---------------------------------------------------------------------------
       
    68 //
       
    69 void CGSAccHeadsetView::HandleCommandL( TInt aCommand )
       
    70     {
       
    71     FUNC_LOG;
       
    72 
       
    73     if ( aCommand == EGSCmdAppChange )
       
    74         {
       
    75         const TInt currentFeatureId = iContainer->CurrentFeatureId();
       
    76         if ( currentFeatureId == KGSSettIdHSAA )
       
    77             {
       
    78             // Change automatic answer mode setting through selection dialog
       
    79             ChangeAutoAnswerModeSettingL(
       
    80                 KSettingsHeadsetAutomaticAnswer,
       
    81                 KGSSettIdHSAA,
       
    82                 ETrue );
       
    83             }
       
    84         else
       
    85             {
       
    86             // Act as user had pressed the selection key
       
    87             HandleListBoxSelectionL( currentFeatureId );
       
    88             }
       
    89         }
       
    90     else
       
    91         {
       
    92         CGSAccBaseView::HandleCommandL( aCommand );
       
    93         }
       
    94     }
       
    95 
       
    96 
       
    97 // ---------------------------------------------------------------------------
       
    98 // CGSAccHeadsetView::NewContainerL()
       
    99 // ---------------------------------------------------------------------------
       
   100 //
       
   101 void CGSAccHeadsetView::NewContainerL()
       
   102     {
       
   103     iContainer = new ( ELeave ) CGSAccHeadsetContainer ( iModel );
       
   104     }
       
   105 
       
   106 
       
   107 // ---------------------------------------------------------------------------
       
   108 // CGSAccHeadsetView::HandleListBoxSelectionL()
       
   109 // ---------------------------------------------------------------------------
       
   110 //
       
   111 void CGSAccHeadsetView::HandleListBoxSelectionL( TInt aSelectedItem )
       
   112     {
       
   113     FUNC_LOG;
       
   114 
       
   115     // User has pressed selection key. If the selected item has just two
       
   116     // possible values, flip the value to the other option. If the item has
       
   117     // more possible values, show a selection dialog.
       
   118     switch ( aSelectedItem )
       
   119         {
       
   120         case KGSSettIdHSDP:
       
   121             // Show selection dialog for the accessory default profile
       
   122             ChangeDefaultProfileL(
       
   123                 KSettingsHeadsetDefaultProfile, KGSSettIdHSDP );
       
   124             break;
       
   125         case KGSSettIdHSAA:
       
   126             // Change automatic answer mode setting without selection dialog
       
   127             ChangeAutoAnswerModeSettingL(
       
   128                 KSettingsHeadsetAutomaticAnswer,
       
   129                 KGSSettIdHSAA,
       
   130                 EFalse );
       
   131             break;
       
   132        default:
       
   133             break;
       
   134         }
       
   135     }
       
   136 
       
   137 
       
   138 // ---------------------------------------------------------------------------
       
   139 // CGSAccHeadsetView::CGSAccHeadsetView()
       
   140 // ---------------------------------------------------------------------------
       
   141 //
       
   142 CGSAccHeadsetView::CGSAccHeadsetView( CGSAccessoryPluginModel& aModel )
       
   143   : CGSAccBaseView( aModel )
       
   144     {
       
   145     FUNC_LOG;
       
   146     }