|
1 /* |
|
2 * Copyright (c) 2006 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: Sensors orientation view |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "gssenorientationview.h" |
|
21 #include "gssenorientationcontainer.h" |
|
22 #include "gssensorplugin.hrh" |
|
23 #include "gssensorpluginlocalviewids.h" |
|
24 #include "gssenorientationcontainer.h" |
|
25 #include "gssensorpluginmodel.h" |
|
26 #include "gssensorplugin_debug.h" |
|
27 |
|
28 #include <AknViewAppUi.h> |
|
29 #include <gssensorpluginrsc.rsg> |
|
30 #include <GSCommon.hrh> |
|
31 |
|
32 |
|
33 // ========================= MEMBER FUNCTIONS ================================ |
|
34 |
|
35 // --------------------------------------------------------------------------- |
|
36 // CGSSenOrientationView::CGSSenOrientationView |
|
37 // Default constructor |
|
38 // --------------------------------------------------------------------------- |
|
39 // |
|
40 CGSSenOrientationView::CGSSenOrientationView( CGSSensorPluginModel* aModel ) : |
|
41 iModel( aModel ) |
|
42 { |
|
43 TRACE_( "[GSSensorPlugin] CGSSenOrientationView::CGSSenOrientationView()" ); |
|
44 } |
|
45 |
|
46 // --------------------------------------------------------------------------- |
|
47 // CGSSenOrientationView::NewL |
|
48 // Symbian OS two-phased constructor |
|
49 // --------------------------------------------------------------------------- |
|
50 CGSSenOrientationView* CGSSenOrientationView::NewL( CGSSensorPluginModel* aModel ) |
|
51 { |
|
52 TRACE_( "[GSSensorPlugin] CGSSenOrientationView::NewL()" ); |
|
53 CGSSenOrientationView* self = NewLC( aModel ); |
|
54 CleanupStack::Pop( self ); |
|
55 TRACE_( "[GSSensorPlugin] CGSSenOrientationView::NewL() - return" ); |
|
56 return self; |
|
57 } |
|
58 |
|
59 // --------------------------------------------------------------------------- |
|
60 // CGSSenOrientationView::NewLC |
|
61 // Symbian OS two-phased constructor |
|
62 // --------------------------------------------------------------------------- |
|
63 CGSSenOrientationView* CGSSenOrientationView::NewLC( CGSSensorPluginModel* aModel ) |
|
64 { |
|
65 TRACE_( "[GSSensorPlugin] CGSSenOrientationView::NewLC()" ); |
|
66 CGSSenOrientationView* self = new( ELeave ) CGSSenOrientationView( aModel ); |
|
67 CleanupStack::PushL( self ); |
|
68 self->ConstructL(); |
|
69 TRACE_( "[GSSensorPlugin] CGSSenOrientationView::NewLC() - return" ); |
|
70 return self; |
|
71 } |
|
72 |
|
73 // --------------------------------------------------------------------------- |
|
74 // CGSSenOrientationView::~CGSSenOrientationView() |
|
75 // Destructor |
|
76 // --------------------------------------------------------------------------- |
|
77 CGSSenOrientationView::~CGSSenOrientationView() |
|
78 { |
|
79 TRACE_( "[GSSensorPlugin] CGSSenOrientationView::~CGSSenOrientationView()" ); |
|
80 iModel = NULL; |
|
81 } |
|
82 |
|
83 // --------------------------------------------------------------------------- |
|
84 // CGSSenOrientationView::ConstructL() |
|
85 // Symbian OS two-phased constructor |
|
86 // --------------------------------------------------------------------------- |
|
87 void CGSSenOrientationView::ConstructL() |
|
88 { |
|
89 TRACE_( "[GSSensorPlugin] CGSSenOrientationView::ConstructL()" ); |
|
90 BaseConstructL( R_GS_CHECKBOX_VIEW ); |
|
91 TRACE_( "[GSSensorPlugin] CGSSenOrientationView::ConstructL() - return" ); |
|
92 } |
|
93 |
|
94 // --------------------------------------------------------------------------- |
|
95 // TUid CGSSenOrientationView::Id() |
|
96 // --------------------------------------------------------------------------- |
|
97 TUid CGSSenOrientationView::Id() const |
|
98 { |
|
99 TRACE_1( "[GSSensorPlugin] CGSSenOrientationView::Id() - ID: %i", KSenOrientationViewId ); |
|
100 return KSenOrientationViewId; |
|
101 } |
|
102 |
|
103 // --------------------------------------------------------------------------- |
|
104 // CGSSenOrientationView::HandleCommandL() |
|
105 // Command handling for sensor activation status view |
|
106 // --------------------------------------------------------------------------- |
|
107 void CGSSenOrientationView::HandleCommandL( TInt aCommand ) |
|
108 { |
|
109 TRACE_1( "[GSSensorPlugin] CGSSenOrientationView::HandleCommandL() - command: %i", |
|
110 aCommand ); |
|
111 |
|
112 switch ( aCommand ) |
|
113 { |
|
114 case EGSMSKCmdAppChange: |
|
115 { |
|
116 // Update checkbox and selections |
|
117 HandleListBoxSelectionL(); |
|
118 break; |
|
119 } |
|
120 case EGSCmdOk: |
|
121 // Store changes and show previous view |
|
122 Container()->StoreSelectionsL(); |
|
123 // cont. to next case |
|
124 case EAknSoftkeyBack: |
|
125 { |
|
126 // activate previous view |
|
127 iAppUi->ActivateLocalViewL( KGSSensorPluginUid ); |
|
128 break; |
|
129 } |
|
130 default: |
|
131 iAppUi->HandleCommandL( aCommand ); |
|
132 break; |
|
133 } |
|
134 TRACE_( "[GSSensorPlugin] CGSSenOrientationView::HandleCommandL() - return" ); |
|
135 } |
|
136 |
|
137 // --------------------------------------------------------------------------- |
|
138 // CGSSenOrientationView::Container |
|
139 // Returns call container item |
|
140 // --------------------------------------------------------------------------- |
|
141 // |
|
142 CGSSenOrientationContainer* CGSSenOrientationView::Container() |
|
143 { |
|
144 TRACE_( "[GSSensorPlugin] CGSSenOrientationView::Container()" ); |
|
145 return static_cast<CGSSenOrientationContainer*>( iContainer ); |
|
146 } |
|
147 |
|
148 // --------------------------------------------------------------------------- |
|
149 // CGSSenOrientationView::NewContainerL() |
|
150 // Creates new iContainer. |
|
151 // --------------------------------------------------------------------------- |
|
152 // |
|
153 void CGSSenOrientationView::NewContainerL() |
|
154 { |
|
155 TRACE_( "[GSSensorPlugin] CGSSenOrientationView::NewContainerL()" ); |
|
156 iContainer = new ( ELeave ) CGSSenOrientationContainer( iModel ); |
|
157 TRACE_( "[GSSensorPlugin] CGSSenOrientationView::NewContainerL() - return" ); |
|
158 } |
|
159 |
|
160 // --------------------------------------------------------------------------- |
|
161 // CGSSenOrientationView::HandleListBoxSelectionL() |
|
162 // --------------------------------------------------------------------------- |
|
163 void CGSSenOrientationView::HandleListBoxSelectionL() |
|
164 { |
|
165 TRACE_( "[GSSensorPlugin] CGSSenOrientationView::HandleListBoxSelectionL()" ); |
|
166 const TInt currentItem = Container()->CurrentFeatureId(); |
|
167 Container()->ChangeSelectionStatus( currentItem ); |
|
168 Container()->UpdateCheckboxIconL( currentItem ); |
|
169 TRACE_( "[GSSensorPlugin] CGSSenOrientationView::HandleListBoxSelectionL() - return" ); |
|
170 } |