|
1 /* |
|
2 * Copyright (c) 2003-2007 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 class CCertManUIPlugin |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <aknViewAppUi.h> |
|
21 #include <bautils.h> |
|
22 |
|
23 #include <certmanui.rsg> |
|
24 |
|
25 #include "CertmanuiKeeper.h" |
|
26 #include "Certmanuiviewid.h" |
|
27 #include "CertmanuiPlugin.h" |
|
28 #include "CertmanuiviewMain.h" |
|
29 #include "CertmanuiviewTrust.h" |
|
30 #include "CertmanuiviewPersonal.h" |
|
31 #include "CertmanuiviewDevice.h" |
|
32 #include "CertmanuiviewTrustedSite.h" |
|
33 #include "CertmanuicontainerAuthority.h" |
|
34 #include "CertmanuiPluginContainer.h" |
|
35 #include "StringLoader.h" |
|
36 |
|
37 |
|
38 // Constants |
|
39 _LIT( KResourceFile, "z:CertManUi.rsc" ); |
|
40 |
|
41 // ========================= MEMBER FUNCTIONS ================================ |
|
42 |
|
43 |
|
44 // --------------------------------------------------------------------------- |
|
45 // CCertManUIPlugin::CCertManUIPlugin() |
|
46 // Constructor |
|
47 // |
|
48 // --------------------------------------------------------------------------- |
|
49 // |
|
50 CCertManUIPlugin::CCertManUIPlugin(): |
|
51 iResourceLoader( *CCoeEnv::Static() ), |
|
52 iPrevViewId() |
|
53 { |
|
54 } |
|
55 |
|
56 |
|
57 // --------------------------------------------------------------------------- |
|
58 // CCertManUIPlugin::~CCertManUIPlugin() |
|
59 // Destructor |
|
60 // |
|
61 // --------------------------------------------------------------------------- |
|
62 // |
|
63 CCertManUIPlugin::~CCertManUIPlugin() |
|
64 { |
|
65 iResourceLoader.Close(); |
|
66 |
|
67 if ( iContainer != NULL ) |
|
68 { |
|
69 AppUi()->RemoveFromViewStack( *this, iContainer ); |
|
70 } |
|
71 |
|
72 delete iContainer; |
|
73 delete iCertManUIKeeper; |
|
74 } |
|
75 |
|
76 |
|
77 // --------------------------------------------------------------------------- |
|
78 // CCertManUIPlugin::ConstructL(const TRect& aRect) |
|
79 // Symbian OS two-phased constructor |
|
80 // |
|
81 // --------------------------------------------------------------------------- |
|
82 // |
|
83 void CCertManUIPlugin::ConstructL() |
|
84 { |
|
85 BaseConstructL(); |
|
86 |
|
87 AddResourceFileL(); |
|
88 |
|
89 iCertManUIKeeper = new ( ELeave )CCertManUIKeeper(); |
|
90 |
|
91 iCertManUIInitialized = EFalse; |
|
92 |
|
93 CCertManUIViewMain* viewMain = |
|
94 CCertManUIViewMain::NewLC( ClientRect(), *iCertManUIKeeper ); |
|
95 AppUi()->AddViewL(viewMain); |
|
96 |
|
97 CCertManUIViewAuthority* viewAuthority = |
|
98 CCertManUIViewAuthority::NewLC( ClientRect(), *iCertManUIKeeper ); |
|
99 AppUi()->AddViewL(viewAuthority); |
|
100 |
|
101 CCertManUIViewTrustedSite* viewTrustedSite = |
|
102 CCertManUIViewTrustedSite::NewLC( ClientRect(), *iCertManUIKeeper ); |
|
103 AppUi()->AddViewL(viewTrustedSite); |
|
104 |
|
105 CCertManUIViewPersonal* viewPersonal = |
|
106 CCertManUIViewPersonal::NewLC( ClientRect(), *iCertManUIKeeper ); |
|
107 AppUi()->AddViewL(viewPersonal); |
|
108 |
|
109 CCertManUIViewDevice* viewDevice = |
|
110 CCertManUIViewDevice::NewLC( ClientRect(), *iCertManUIKeeper ); |
|
111 AppUi()->AddViewL(viewDevice); |
|
112 |
|
113 CCertManUIViewTrust* viewTrust = |
|
114 CCertManUIViewTrust::NewLC( ClientRect(), *iCertManUIKeeper ); |
|
115 AppUi()->AddViewL( viewTrust ); |
|
116 |
|
117 CleanupStack::Pop( 6 ); // viewMain, viewAuthority, viewTrustedSite, viewPersonal, viewDevice, viewTrust |
|
118 } |
|
119 // --------------------------------------------------------------------------- |
|
120 // CCertManUIPlugin::NewL() |
|
121 // Static constructor |
|
122 // |
|
123 // --------------------------------------------------------------------------- |
|
124 // |
|
125 CCertManUIPlugin* CCertManUIPlugin::NewL( TAny* /*aInitParams*/ ) |
|
126 { |
|
127 CCertManUIPlugin* self = new( ELeave ) CCertManUIPlugin(); |
|
128 CleanupStack::PushL( self ); |
|
129 self->ConstructL(); |
|
130 CleanupStack::Pop( self ); |
|
131 return self; |
|
132 } |
|
133 |
|
134 |
|
135 // --------------------------------------------------------------------------- |
|
136 // CCertManUIPlugin::Id() |
|
137 // |
|
138 // |
|
139 // --------------------------------------------------------------------------- |
|
140 // |
|
141 TUid CCertManUIPlugin::Id() const |
|
142 { |
|
143 return KCertManUIPluginUid; |
|
144 } |
|
145 |
|
146 |
|
147 // --------------------------------------------------------- |
|
148 // CCertManUIKeeper::AddResourceFileL() |
|
149 // |
|
150 // --------------------------------------------------------- |
|
151 // |
|
152 void CCertManUIPlugin::AddResourceFileL() |
|
153 { |
|
154 TFileName fileName; |
|
155 TParse parse; |
|
156 parse.Set( KResourceFile, &KDC_RESOURCE_FILES_DIR, NULL ); |
|
157 |
|
158 fileName = parse.FullName(); |
|
159 iResourceLoader.OpenL( fileName ); |
|
160 } |
|
161 |
|
162 |
|
163 // --------------------------------------------------------- |
|
164 // CApSettingsPlugin::HandleClientRectChange |
|
165 // --------------------------------------------------------- |
|
166 void CCertManUIPlugin::HandleClientRectChange() |
|
167 { |
|
168 if ( iContainer ) |
|
169 { |
|
170 iContainer->SetRect( ClientRect() ); |
|
171 } |
|
172 } |
|
173 |
|
174 // --------------------------------------------------------------------------- |
|
175 // CCertManUIPlugin::DoActivateL() |
|
176 // |
|
177 // |
|
178 // --------------------------------------------------------------------------- |
|
179 // |
|
180 void CCertManUIPlugin::DoActivateL( const TVwsViewId& aPrevViewId, |
|
181 TUid /*aCustomMessageId*/, |
|
182 const TDesC8& /*aCustomMessage*/ ) |
|
183 { |
|
184 if (iPrevViewId.iViewUid.iUid == 0) |
|
185 { |
|
186 // This is Security View |
|
187 iPrevViewId = aPrevViewId; |
|
188 } |
|
189 |
|
190 if( iContainer ) |
|
191 { |
|
192 AppUi()->RemoveFromViewStack( *this, iContainer ); |
|
193 delete iContainer; |
|
194 iContainer=NULL; |
|
195 } |
|
196 |
|
197 iContainer = new( ELeave ) CCertManUIPluginContainer; |
|
198 iContainer->SetMopParent( this ); |
|
199 iContainer->ConstructL( ClientRect() ); |
|
200 |
|
201 AppUi()->AddToViewStackL( *this, iContainer ); |
|
202 |
|
203 if ( iPrevViewId != aPrevViewId ) |
|
204 { |
|
205 // Activate parent view Security View |
|
206 AppUi()->ActivateLocalViewL( iPrevViewId.iViewUid ); |
|
207 } |
|
208 else |
|
209 { |
|
210 if (( iCertManUIKeeper != NULL ) && ( !iCertManUIInitialized )) |
|
211 { |
|
212 iCertManUIKeeper->InitializeL( ClientRect(), KCertManUIPluginUid ); |
|
213 iCertManUIInitialized = ETrue; |
|
214 } |
|
215 |
|
216 // Activate CertMan Authority view |
|
217 AppUi()->ActivateLocalViewL( KCertManUIViewMainId ); |
|
218 } |
|
219 } |
|
220 |
|
221 |
|
222 // --------------------------------------------------------------------------- |
|
223 // CCertManUIPlugin::DoDeactivate() |
|
224 // |
|
225 // |
|
226 // --------------------------------------------------------------------------- |
|
227 // |
|
228 void CCertManUIPlugin::DoDeactivate() |
|
229 { |
|
230 if( iContainer ) |
|
231 { |
|
232 AppUi()->RemoveFromViewStack( *this, iContainer ); |
|
233 delete iContainer; |
|
234 iContainer = NULL; |
|
235 } |
|
236 } |
|
237 |
|
238 |
|
239 // --------------------------------------------------------------------------- |
|
240 // CCertManUIPlugin::GetCaptionL() |
|
241 // |
|
242 // |
|
243 // --------------------------------------------------------------------------- |
|
244 // |
|
245 void CCertManUIPlugin::GetCaptionL( TDes& aCaption ) const |
|
246 { |
|
247 StringLoader::Load( aCaption, R_GS_CERTMANUI_CAPTION ); |
|
248 } |
|
249 |
|
250 // End of file |