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