systemsettings/GSAccessoryPlugin/src/gsaccheadphonesview.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 CGSAccHeadphonesView 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 "gsaccheadphonescontainer.h"
       
    27 #include "gsaccheadphonesview.h"
       
    28 #include "trace.h"
       
    29 
       
    30 // ========================= MEMBER FUNCTIONS ================================
       
    31 
       
    32 // ---------------------------------------------------------------------------
       
    33 // CGSAccHeadphonesView::NewLC()
       
    34 // ---------------------------------------------------------------------------
       
    35 //
       
    36 CGSAccHeadphonesView* CGSAccHeadphonesView::NewLC(
       
    37     CGSAccessoryPluginModel& aModel )
       
    38     {
       
    39     CGSAccHeadphonesView* self = new ( ELeave ) CGSAccHeadphonesView( aModel );
       
    40     CleanupStack::PushL( self );
       
    41     self->BaseConstructL( R_ACC_HEADPHONES_VIEW );
       
    42     return self;
       
    43     }
       
    44 
       
    45 
       
    46 // ---------------------------------------------------------------------------
       
    47 // CGSAccHeadphonesView::~CGSAccHeadphonesView()
       
    48 // ---------------------------------------------------------------------------
       
    49 //
       
    50 CGSAccHeadphonesView::~CGSAccHeadphonesView()
       
    51     {
       
    52     FUNC_LOG;
       
    53     }
       
    54 
       
    55 
       
    56 // ---------------------------------------------------------------------------
       
    57 // TUid CGSAccHeadphonesView::Id()
       
    58 // ---------------------------------------------------------------------------
       
    59 //
       
    60 TUid CGSAccHeadphonesView::Id() const
       
    61     {
       
    62     return KAccHeadphonesViewId;
       
    63     }
       
    64 
       
    65 
       
    66 // ---------------------------------------------------------------------------
       
    67 // CGSAccHeadphonesView::HandleCommandL()
       
    68 // ---------------------------------------------------------------------------
       
    69 //
       
    70 void CGSAccHeadphonesView::HandleCommandL( TInt aCommand )
       
    71     {
       
    72     FUNC_LOG;
       
    73 
       
    74     switch ( aCommand )
       
    75         {
       
    76         case EGSCmdAppChange:
       
    77             // Act as user had pressed the selection key
       
    78             HandleListBoxSelectionL( iContainer->CurrentFeatureId() );
       
    79             break;
       
    80         default:
       
    81             CGSAccBaseView::HandleCommandL( aCommand );
       
    82             break;
       
    83         }
       
    84     }
       
    85 
       
    86 
       
    87 // ---------------------------------------------------------------------------
       
    88 // CGSAccHeadphonesView::NewContainerL()
       
    89 // ---------------------------------------------------------------------------
       
    90 //
       
    91 void CGSAccHeadphonesView::NewContainerL()
       
    92     {
       
    93     iContainer = new ( ELeave ) CGSAccHeadphonesContainer ( iModel );
       
    94     }
       
    95 
       
    96 
       
    97 // ---------------------------------------------------------------------------
       
    98 // CGSAccHeadphonesView::HandleListBoxSelectionL()
       
    99 // ---------------------------------------------------------------------------
       
   100 //
       
   101 void CGSAccHeadphonesView::HandleListBoxSelectionL( TInt aSelectedItem )
       
   102     {
       
   103     FUNC_LOG;
       
   104 
       
   105     // User has pressed selection key. If the selected item has just two
       
   106     // possible values, flip the value to the other option. If the item has
       
   107     // more possible values, show a selection dialog.
       
   108     if ( aSelectedItem == KGSSettIdHPDP )
       
   109         {
       
   110         ChangeDefaultProfileL(
       
   111             KSettingsHeadphonesDefaultProfile, KGSSettIdHPDP );
       
   112         }
       
   113     }
       
   114 
       
   115 
       
   116 // ---------------------------------------------------------------------------
       
   117 // CGSAccHeadphonesView::CGSAccHeadphonesView()
       
   118 // ---------------------------------------------------------------------------
       
   119 //
       
   120 CGSAccHeadphonesView::CGSAccHeadphonesView( CGSAccessoryPluginModel& aModel )
       
   121   : CGSAccBaseView( aModel )
       
   122     {
       
   123     FUNC_LOG;
       
   124     }