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