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