systemsettings/GSAccessoryPlugin/src/gsaccmusicstandview.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 CGSAccMusicStandView 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 <gscommon.hrh>
       
    24 
       
    25 #include "acclocalviewids.h"
       
    26 #include "gsaccessoryplugin.hrh"
       
    27 #include "gsaccmusicstandcontainer.h"
       
    28 #include "gsaccmusicstandview.h"
       
    29 #include "trace.h"
       
    30 
       
    31 // ========================= MEMBER FUNCTIONS ================================
       
    32 
       
    33 // ---------------------------------------------------------------------------
       
    34 // CGSAccMusicStandView::NewLC()
       
    35 // ---------------------------------------------------------------------------
       
    36 //
       
    37 CGSAccMusicStandView* CGSAccMusicStandView::NewLC(
       
    38     CGSAccessoryPluginModel& aModel )
       
    39     {
       
    40     CGSAccMusicStandView* self =
       
    41         new ( ELeave ) CGSAccMusicStandView( aModel );
       
    42     CleanupStack::PushL( self );
       
    43     self->BaseConstructL( R_ACC_MUSIC_STAND_VIEW );
       
    44     return self;
       
    45     }
       
    46 
       
    47 
       
    48 // ---------------------------------------------------------------------------
       
    49 // CGSAccMusicStandView::~CGSAccMusicStandView()
       
    50 // ---------------------------------------------------------------------------
       
    51 //
       
    52 CGSAccMusicStandView::~CGSAccMusicStandView()
       
    53     {
       
    54     FUNC_LOG;
       
    55     }
       
    56 
       
    57 
       
    58 // ---------------------------------------------------------------------------
       
    59 // TUid CGSAccMusicStandView::Id()
       
    60 // ---------------------------------------------------------------------------
       
    61 //
       
    62 TUid CGSAccMusicStandView::Id() const
       
    63     {
       
    64     return KAccMusicStandViewId;
       
    65     }
       
    66 
       
    67 
       
    68 // ---------------------------------------------------------------------------
       
    69 // CGSAccMusicStandView::HandleCommandL()
       
    70 // ---------------------------------------------------------------------------
       
    71 //
       
    72 void CGSAccMusicStandView::HandleCommandL( TInt aCommand )
       
    73     {
       
    74     FUNC_LOG;
       
    75 
       
    76     if ( aCommand == EGSCmdAppChange )
       
    77         {
       
    78         const TInt currentFeatureId = iContainer->CurrentFeatureId();
       
    79         if ( currentFeatureId == KGSSettIdMSAA )
       
    80             {
       
    81             // Change automatic answer mode setting through selection dialog
       
    82             ChangeAutoAnswerModeSettingL(
       
    83                 KSettingsMusicStandAutomaticAnswer,
       
    84                 KGSSettIdMSAA,
       
    85                 ETrue );
       
    86             }
       
    87         else if ( currentFeatureId == KGSSettIdMSL )
       
    88             {
       
    89             // Change lights mode setting through selection dialog
       
    90             ChangeLightModeSettingL(
       
    91                 EAccModeMusicStand,
       
    92                 KAccServerMusicStandLights,
       
    93                 KGSSettIdMSL,
       
    94                 ETrue );
       
    95             }
       
    96         else
       
    97             {
       
    98             // Act as user had pressed the selection key
       
    99             HandleListBoxSelectionL( currentFeatureId );
       
   100             }
       
   101         }
       
   102     else
       
   103         {
       
   104         CGSAccBaseView::HandleCommandL( aCommand );
       
   105         }
       
   106     }
       
   107 
       
   108 
       
   109 // ---------------------------------------------------------------------------
       
   110 // CGSAccMusicStandView::NewContainerL()
       
   111 // ---------------------------------------------------------------------------
       
   112 //
       
   113 void CGSAccMusicStandView::NewContainerL()
       
   114     {
       
   115     iContainer = new ( ELeave ) CGSAccMusicStandContainer( iModel );
       
   116     }
       
   117 
       
   118 
       
   119 // ---------------------------------------------------------------------------
       
   120 // CGSAccMusicStandView::HandleListBoxSelectionL()
       
   121 // ---------------------------------------------------------------------------
       
   122 //
       
   123 void CGSAccMusicStandView::HandleListBoxSelectionL( TInt aSelectedItem )
       
   124     {
       
   125     FUNC_LOG;
       
   126 
       
   127     // User has pressed selection key. If the selected item has just two
       
   128     // possible values, flip the value to the other option. If the item has
       
   129     // more possible values, show a selection dialog.
       
   130     switch ( aSelectedItem )
       
   131         {
       
   132         case KGSSettIdMSDP:
       
   133             // Show selection dialog for the accessory default profile
       
   134             ChangeDefaultProfileL(
       
   135                 KSettingsMusicStandDefaultProfile, KGSSettIdMSDP );
       
   136             break;
       
   137         case KGSSettIdMSAA:
       
   138             // Change automatic answer mode setting without selection dialog
       
   139             ChangeAutoAnswerModeSettingL(
       
   140                 KSettingsMusicStandAutomaticAnswer,
       
   141                 KGSSettIdMSAA,
       
   142                 EFalse );
       
   143             break;
       
   144         case KGSSettIdMSL:
       
   145             // Change lights mode setting without selection dialog
       
   146             ChangeLightModeSettingL(
       
   147                 EAccModeMusicStand,
       
   148                 KAccServerMusicStandLights,
       
   149                 KGSSettIdMSL,
       
   150                 EFalse );
       
   151             break;
       
   152        default:
       
   153             break;
       
   154         }
       
   155     }
       
   156 
       
   157 
       
   158 // ---------------------------------------------------------------------------
       
   159 // CGSAccMusicStandView::CGSAccMusicStandView()
       
   160 // ---------------------------------------------------------------------------
       
   161 //
       
   162 CGSAccMusicStandView::CGSAccMusicStandView( CGSAccessoryPluginModel& aModel )
       
   163   : CGSAccBaseView( aModel )
       
   164     {
       
   165     FUNC_LOG;
       
   166     }