|
1 /* |
|
2 * Copyright (c) 2005-2009 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 the CSecModUIPlugin class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // Includes |
|
20 #include <aknViewAppUi.h> |
|
21 #include <bautils.h> |
|
22 |
|
23 #include <SecModUI.rsg> |
|
24 #include "SecModUIModel.h" |
|
25 #include "SecModUIPlugin.h" |
|
26 #include "SecModUIPluginContainer.h" |
|
27 #include "SecModUIViewAccess.h" |
|
28 #include "SecModUIViewCode.h" |
|
29 #include "SecModUIViewMain.h" |
|
30 #include "SecModUIViewSignature.h" |
|
31 #include "StringLoader.h" |
|
32 |
|
33 |
|
34 // Constants |
|
35 |
|
36 // ========================= MEMBER FUNCTIONS ================================ |
|
37 |
|
38 |
|
39 // --------------------------------------------------------------------------- |
|
40 // CSecModUIPlugin::CSecModUIPlugin() |
|
41 // Constructor |
|
42 // |
|
43 // --------------------------------------------------------------------------- |
|
44 // |
|
45 CSecModUIPlugin::CSecModUIPlugin(): |
|
46 iResourceLoader( *CCoeEnv::Static() ), |
|
47 iPrevViewId() |
|
48 { |
|
49 |
|
50 } |
|
51 |
|
52 |
|
53 // --------------------------------------------------------------------------- |
|
54 // CSecModUIPlugin::~CSecModUIPlugin() |
|
55 // Destructor |
|
56 // |
|
57 // --------------------------------------------------------------------------- |
|
58 // |
|
59 CSecModUIPlugin::~CSecModUIPlugin() |
|
60 { |
|
61 delete iContainer; |
|
62 delete iSecUiModel; |
|
63 } |
|
64 |
|
65 |
|
66 // --------------------------------------------------------------------------- |
|
67 // CSecModUIPlugin::ConstructL(const TRect& aRect) |
|
68 // Symbian OS two-phased constructor |
|
69 // |
|
70 // --------------------------------------------------------------------------- |
|
71 // |
|
72 void CSecModUIPlugin::ConstructL() |
|
73 { |
|
74 |
|
75 BaseConstructL(); |
|
76 |
|
77 iSecUiModel = CSecModUIModel::NewL(); |
|
78 |
|
79 CSecModUIViewMain* viewMain = CSecModUIViewMain::NewLC(*iSecUiModel); |
|
80 AppUi()->AddViewL(viewMain); |
|
81 CleanupStack::Pop(viewMain); |
|
82 |
|
83 CSecModUIViewCode* viewCode = CSecModUIViewCode::NewLC(*iSecUiModel); |
|
84 AppUi()->AddViewL(viewCode); |
|
85 CleanupStack::Pop(viewCode); |
|
86 |
|
87 CSecModUIViewAccess* viewAccess = CSecModUIViewAccess::NewLC(*iSecUiModel); |
|
88 AppUi()->AddViewL(viewAccess); |
|
89 CleanupStack::Pop(viewAccess); |
|
90 |
|
91 CSecModUIViewSignature* viewSignature = CSecModUIViewSignature::NewLC(*iSecUiModel); |
|
92 AppUi()->AddViewL(viewSignature); |
|
93 CleanupStack::Pop(viewSignature); |
|
94 |
|
95 } |
|
96 // --------------------------------------------------------------------------- |
|
97 // CSecModUIPlugin::NewL() |
|
98 // Static constructor |
|
99 // |
|
100 // --------------------------------------------------------------------------- |
|
101 // |
|
102 CSecModUIPlugin* CSecModUIPlugin::NewL( TAny* /*aInitParams*/ ) |
|
103 { |
|
104 CSecModUIPlugin* self = new( ELeave ) CSecModUIPlugin(); |
|
105 CleanupStack::PushL( self ); |
|
106 self->ConstructL(); |
|
107 CleanupStack::Pop( self ); |
|
108 return self; |
|
109 } |
|
110 |
|
111 |
|
112 // --------------------------------------------------------------------------- |
|
113 // CSecModUIPlugin::Id() |
|
114 // |
|
115 // |
|
116 // --------------------------------------------------------------------------- |
|
117 // |
|
118 TUid CSecModUIPlugin::Id() const |
|
119 { |
|
120 return KSecModUIPluginUid; |
|
121 } |
|
122 |
|
123 |
|
124 |
|
125 // --------------------------------------------------------- |
|
126 // CApSettingsPlugin::HandleClientRectChange |
|
127 // --------------------------------------------------------- |
|
128 void CSecModUIPlugin::HandleClientRectChange() |
|
129 { |
|
130 if ( iContainer ) |
|
131 { |
|
132 iContainer->SetRect( ClientRect() ); |
|
133 } |
|
134 } |
|
135 |
|
136 // --------------------------------------------------------------------------- |
|
137 // CSecModUIPlugin::DoActivateL() |
|
138 // |
|
139 // |
|
140 // --------------------------------------------------------------------------- |
|
141 // |
|
142 void CSecModUIPlugin::DoActivateL( const TVwsViewId& aPrevViewId, |
|
143 TUid /*aCustomMessageId*/, |
|
144 const TDesC8& /*aCustomMessage*/ ) |
|
145 { |
|
146 |
|
147 if (iPrevViewId.iViewUid.iUid == 0) |
|
148 { |
|
149 // This is Security View |
|
150 iPrevViewId = aPrevViewId; |
|
151 } |
|
152 |
|
153 if( iContainer ) |
|
154 { |
|
155 AppUi()->RemoveFromViewStack( *this, iContainer ); |
|
156 delete iContainer; |
|
157 iContainer=NULL; |
|
158 } |
|
159 |
|
160 iContainer = new( ELeave ) CSecModUIPluginContainer; |
|
161 iContainer->SetMopParent( this ); |
|
162 iContainer->ConstructL( ClientRect() ); |
|
163 |
|
164 AppUi()->AddToViewStackL( *this, iContainer ); |
|
165 |
|
166 iContainer->MakeVisible( ETrue ); |
|
167 iContainer->ActivateL(); |
|
168 iContainer->DrawNow(); |
|
169 |
|
170 if ( iPrevViewId != aPrevViewId ) |
|
171 { |
|
172 // Activate parent view Security View |
|
173 AppUi()->ActivateLocalViewL( iPrevViewId.iViewUid ); |
|
174 } |
|
175 else |
|
176 { |
|
177 // Activate Security Module Main View |
|
178 AppUi()->ActivateLocalViewL( KSecModUIViewMainId ); |
|
179 } |
|
180 } |
|
181 |
|
182 |
|
183 // --------------------------------------------------------------------------- |
|
184 // CSecModUIPlugin::DoDeactivate() |
|
185 // |
|
186 // |
|
187 // --------------------------------------------------------------------------- |
|
188 // |
|
189 void CSecModUIPlugin::DoDeactivate() |
|
190 { |
|
191 if( iContainer ) |
|
192 { |
|
193 AppUi()->RemoveFromViewStack( *this, iContainer ); |
|
194 delete iContainer; |
|
195 iContainer = NULL; |
|
196 } |
|
197 } |
|
198 |
|
199 |
|
200 // --------------------------------------------------------------------------- |
|
201 // CSecModUIPlugin::GetCaptionL() |
|
202 // |
|
203 // |
|
204 // --------------------------------------------------------------------------- |
|
205 // |
|
206 void CSecModUIPlugin::GetCaptionL( TDes& aCaption ) const |
|
207 { |
|
208 StringLoader::Load( aCaption, R_QTN_WIM_SETTINGS ); |
|
209 } |
|
210 |
|
211 |
|
212 // --------------------------------------------------------------------------- |
|
213 // CSecModUIPlugin::Visible() |
|
214 // |
|
215 // |
|
216 // --------------------------------------------------------------------------- |
|
217 // |
|
218 TBool CSecModUIPlugin::Visible() const |
|
219 { |
|
220 TBool visible( EFalse ); |
|
221 TRAPD( err, visible = DoIsVisibleL() ); |
|
222 if( !err && visible ) |
|
223 { |
|
224 return ETrue; |
|
225 } |
|
226 return EFalse; |
|
227 } |
|
228 |
|
229 |
|
230 // --------------------------------------------------------------------------- |
|
231 // CSecModUIPlugin::DoIsVisibleL() |
|
232 // |
|
233 // |
|
234 // --------------------------------------------------------------------------- |
|
235 // |
|
236 TBool CSecModUIPlugin::DoIsVisibleL() const |
|
237 { |
|
238 TBool isVisible( EFalse ); |
|
239 const TInt KItemCount = 4; |
|
240 CDesCArray* itemArray = new (ELeave) CDesCArrayFlat( KItemCount ); |
|
241 CleanupStack::PushL( itemArray ); |
|
242 if( iSecUiModel ) |
|
243 { |
|
244 isVisible = ( iSecUiModel->SecurityModuleCount() != 0 ); |
|
245 } |
|
246 CleanupStack::PopAndDestroy( itemArray ); |
|
247 return isVisible; |
|
248 } |
|
249 |
|
250 |
|
251 // End of file |