|
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 CCertManUIViewMain |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 |
|
21 #include <aknmessagequerydialog.h> |
|
22 #include <aknnotewrappers.h> // for warning & information notes |
|
23 #include <certmanui.rsg> |
|
24 #include <ErrorUI.h> |
|
25 #include "CertmanuiCertificateHelper.h" |
|
26 #include "CertmanuiKeeper.h" |
|
27 #include "CertmanuicontainerMain.h" |
|
28 #include "CertmanuiSyncWrapper.h" |
|
29 #include "Certmanui.hrh" |
|
30 #include "CertmanuiCommon.h" |
|
31 #include "CertManUILogger.h" |
|
32 #include "CertmanuiPlugin.h" // for KCertManUIPluginUid |
|
33 |
|
34 #include <hlplch.h> // For HlpLauncher |
|
35 |
|
36 const TUid KGSSecurityViewUid = { 0x1020743A }; |
|
37 |
|
38 |
|
39 // ================= MEMBER FUNCTIONS ======================= |
|
40 |
|
41 // --------------------------------------------------------- |
|
42 // CCertManUIViewMain::CCertManUIViewMain(CCertManUIKeeper& aKeeper) |
|
43 // : iKeeper(aKeeper), iCrMgr(iKeeper.CertManager()) |
|
44 // Constructor |
|
45 // --------------------------------------------------------- |
|
46 // |
|
47 CCertManUIViewMain::CCertManUIViewMain(CCertManUIKeeper& aKeeper) |
|
48 : iKeeper( aKeeper ) |
|
49 { |
|
50 CERTMANUILOGGER_WRITE_TIMESTAMP( "CCertManUIViewMain::CCertManUIViewMain" ); |
|
51 } |
|
52 |
|
53 // ----------------------------------------------------------------------------- |
|
54 // CCertManUIViewMain::~CCertManUIViewMain() |
|
55 // Destructor |
|
56 // ----------------------------------------------------------------------------- |
|
57 // |
|
58 CCertManUIViewMain::~CCertManUIViewMain() |
|
59 { |
|
60 CERTMANUILOGGER_ENTERFN( "CCertManUIViewMain::~CCertManUIViewMain" ); |
|
61 |
|
62 if ( iContainerMain ) |
|
63 { |
|
64 AppUi()->RemoveFromViewStack( *this, iContainerMain ); |
|
65 delete iContainerMain; |
|
66 } |
|
67 |
|
68 CERTMANUILOGGER_LEAVEFN( "CCertManUIViewMain::~CCertManUIViewMain" ); |
|
69 } |
|
70 |
|
71 // --------------------------------------------------------- |
|
72 // CCertManUIViewMain* CCertManUIViewMain::NewL(const TRect& /*aRect*/, |
|
73 // CCertManUIKeeper& aKeeper) |
|
74 // --------------------------------------------------------- |
|
75 // |
|
76 CCertManUIViewMain* CCertManUIViewMain::NewL( const TRect& /*aRect*/, |
|
77 CCertManUIKeeper& aKeeper ) |
|
78 { |
|
79 CCertManUIViewMain* self = new ( ELeave ) CCertManUIViewMain( aKeeper ); |
|
80 CleanupStack::PushL( self ); |
|
81 self->ConstructL(); |
|
82 CleanupStack::Pop(); |
|
83 return self; |
|
84 } |
|
85 |
|
86 // --------------------------------------------------------- |
|
87 // CCertManUIViewMain* CCertManUIViewMain::NewLC(const TRect& /*aRect*/, |
|
88 // CCertManUIKeeper& aKeeper) |
|
89 // --------------------------------------------------------- |
|
90 // |
|
91 CCertManUIViewMain* CCertManUIViewMain::NewLC(const TRect& /*aRect*/, |
|
92 CCertManUIKeeper& aKeeper) |
|
93 { |
|
94 CCertManUIViewMain* self = new ( ELeave ) CCertManUIViewMain( aKeeper ); |
|
95 CleanupStack::PushL( self ); |
|
96 self->ConstructL(); |
|
97 return self; |
|
98 } |
|
99 |
|
100 // --------------------------------------------------------- |
|
101 // CCertManUIViewMain::ConstructL() |
|
102 // EPOC two-phased constructor |
|
103 // --------------------------------------------------------- |
|
104 // |
|
105 void CCertManUIViewMain::ConstructL() |
|
106 { |
|
107 CERTMANUILOGGER_ENTERFN( "CCertManUIViewMain::ConstructL" ); |
|
108 |
|
109 BaseConstructL( R_CERTMANUI_VIEW_MAIN ); |
|
110 |
|
111 CERTMANUILOGGER_LEAVEFN( "CCertManUIViewMain::ConstructL" ); |
|
112 } |
|
113 |
|
114 // --------------------------------------------------------- |
|
115 // CCertManUIViewMain::Id() const |
|
116 // Returns Personal view id |
|
117 // --------------------------------------------------------- |
|
118 // |
|
119 TUid CCertManUIViewMain::Id() const |
|
120 { |
|
121 return KCertManUIViewMainId; |
|
122 } |
|
123 |
|
124 // --------------------------------------------------------- |
|
125 // CCertManUIViewMain::HandleCommandL(TInt aCommand) |
|
126 // Handles Softkey and Options list commands |
|
127 // --------------------------------------------------------- |
|
128 // |
|
129 void CCertManUIViewMain::HandleCommandL( TInt aCommand ) |
|
130 { |
|
131 CERTMANUILOGGER_ENTERFN( "CCertManUIViewMain::HandleCommandL" ); |
|
132 |
|
133 switch ( aCommand ) |
|
134 { |
|
135 case EAknSoftkeyBack: |
|
136 { |
|
137 // Activate Security view |
|
138 AppUi()->ActivateLocalViewL( KGSSecurityViewUid ); |
|
139 break; |
|
140 } |
|
141 case EAknCmdExit: |
|
142 { |
|
143 ((CAknViewAppUi*)iAvkonAppUi)->HandleCommandL( EAknCmdExit ); |
|
144 break; |
|
145 } |
|
146 case ECertManUICmdAppViewDtls: |
|
147 case ECertManUICmdAppOpen: |
|
148 { |
|
149 TInt index = iContainerMain->iListBox->CurrentItemIndex(); |
|
150 |
|
151 if ( index == 0) |
|
152 { |
|
153 AppUi()->ActivateLocalViewL( KCertManUIViewAuthorityId ); |
|
154 } |
|
155 else if ( index == 1) |
|
156 { |
|
157 AppUi()->ActivateLocalViewL( KCertManUIViewTrustedSiteId ); |
|
158 } |
|
159 else if ( index == 2) |
|
160 { |
|
161 AppUi()->ActivateLocalViewL( KCertManUIViewPersonalId ); |
|
162 } |
|
163 else if ( index == 3) |
|
164 { |
|
165 AppUi()->ActivateLocalViewL( KCertManUIViewDeviceId ); |
|
166 } |
|
167 else // For lint |
|
168 { |
|
169 } |
|
170 |
|
171 break; |
|
172 } |
|
173 |
|
174 case EAknCmdHelp: |
|
175 { |
|
176 if( FeatureManager::FeatureSupported( KFeatureIdHelp ) ) |
|
177 { |
|
178 HlpLauncher::LaunchHelpApplicationL( |
|
179 iEikonEnv->WsSession(), AppUi()->AppHelpContextL() ); |
|
180 } |
|
181 break; |
|
182 } |
|
183 |
|
184 default: |
|
185 { |
|
186 AppUi()->HandleCommandL( aCommand ); |
|
187 break; |
|
188 } |
|
189 } |
|
190 |
|
191 CERTMANUILOGGER_LEAVEFN( "CCertManUIViewMain::HandleCommandL" ); |
|
192 } |
|
193 |
|
194 // --------------------------------------------------------- |
|
195 // CCertManUIViewMain::HandleClientRectChange() |
|
196 // --------------------------------------------------------- |
|
197 // |
|
198 void CCertManUIViewMain::HandleClientRectChange() |
|
199 { |
|
200 if ( iContainerMain ) |
|
201 { |
|
202 iContainerMain->SetRect( ClientRect() ); |
|
203 } |
|
204 } |
|
205 |
|
206 // --------------------------------------------------------- |
|
207 // CCertManUIViewMain::DoActivateL(const TVwsViewId& aPrevViewId, |
|
208 // TUid /*aCustomMessageId*/, |
|
209 // const TDesC8& /*aCustomMessage*/) |
|
210 // Updates the view when opening it |
|
211 // --------------------------------------------------------- |
|
212 // |
|
213 void CCertManUIViewMain::DoActivateL( const TVwsViewId& aPrevViewId, |
|
214 TUid /*aCustomMessageId*/, |
|
215 const TDesC8& /*aCustomMessage*/ ) |
|
216 { |
|
217 CERTMANUILOGGER_ENTERFN( "CCertManUIViewMain::DoActivateL" ); |
|
218 |
|
219 if ( iContainerMain ) |
|
220 { |
|
221 ((CAknViewAppUi*)iAvkonAppUi)->RemoveFromViewStack( |
|
222 *this, iContainerMain ); |
|
223 |
|
224 delete iContainerMain; |
|
225 iContainerMain = NULL; |
|
226 } |
|
227 |
|
228 if( aPrevViewId.iViewUid == KCertManUIPluginUid ) |
|
229 { |
|
230 iCurrentPosition = 0; |
|
231 } |
|
232 |
|
233 iContainerMain = new (ELeave) CCertManUIContainerMain( |
|
234 *this, iKeeper ); |
|
235 |
|
236 iContainerMain->SetMopParent( this ); |
|
237 iContainerMain->ConstructL( |
|
238 ClientRect(), iCurrentPosition, iTopItem ); |
|
239 |
|
240 |
|
241 iContainerMain->DrawListBoxL( iCurrentPosition, iTopItem ); |
|
242 ((CAknViewAppUi*)iAvkonAppUi)->AddToStackL( *this, iContainerMain ); |
|
243 |
|
244 CERTMANUILOGGER_LEAVEFN( "CCertManUIViewMain::DoActivateL" ); |
|
245 } |
|
246 |
|
247 // --------------------------------------------------------- |
|
248 // CCertManUIViewMain::DoDeactivate() |
|
249 // Saves focus position when closing view |
|
250 // --------------------------------------------------------- |
|
251 // |
|
252 void CCertManUIViewMain::DoDeactivate() |
|
253 { |
|
254 CERTMANUILOGGER_ENTERFN( "CCertManUIViewMain::DoDeactivate" ); |
|
255 |
|
256 iCurrentPosition = iContainerMain->iListBox->CurrentItemIndex(); |
|
257 iTopItem = iContainerMain->iListBox->TopItemIndex(); |
|
258 |
|
259 CERTMANUILOGGER_LEAVEFN( "CCertManUIViewMain::DoDeactivate" ); |
|
260 } |
|
261 |
|
262 // --------------------------------------------------------- |
|
263 // CCertManUIViewMain::Container() |
|
264 // Returns iContainerMain to be used in CertManUIContainerMain |
|
265 // --------------------------------------------------------- |
|
266 // |
|
267 CCoeControl* CCertManUIViewMain::Container() |
|
268 { |
|
269 return iContainerMain; |
|
270 } |
|
271 |
|
272 |
|
273 // --------------------------------------------------------- |
|
274 // CCertManUIViewMain::DynInitMenuPaneL() |
|
275 // --------------------------------------------------------- |
|
276 // |
|
277 void CCertManUIViewMain::DynInitMenuPaneL( |
|
278 TInt aResourceId, CEikMenuPane* aMenuPane ) |
|
279 { |
|
280 if ( aResourceId == R_CERTMANUI_VIEW_MENU_MAIN ) |
|
281 { |
|
282 if( !FeatureManager::FeatureSupported( KFeatureIdHelp ) ) |
|
283 { |
|
284 aMenuPane->DeleteMenuItem( EAknCmdHelp ); //remove help |
|
285 } |
|
286 } |
|
287 } |
|
288 |
|
289 // End of File |
|
290 |