|
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: Declaration of the CCertManUIContainerTrust class |
|
15 * Maintains correct list of trusted clients depending |
|
16 * on the certificate that was in focus in Authority |
|
17 * certificates view when Trust Settings view was entered. |
|
18 * Shows and changes correct Yes/No text for the Trusted client. |
|
19 * |
|
20 */ |
|
21 |
|
22 |
|
23 #ifndef CERTMANUICONTAINERTRUST_H |
|
24 #define CERTMANUICONTAINERTRUST_H |
|
25 |
|
26 // INCLUDES |
|
27 #include <aknradiobuttonsettingpage.h> |
|
28 |
|
29 // CONSTANTS |
|
30 const TInt KTrustSettingsResourceIndexWAP = 0; |
|
31 const TInt KTrustSettingsResourceIndexMailAndImageConn = 1; |
|
32 const TInt KTrustSettingsResourceIndexAppCtrl = 2; |
|
33 const TInt KTrustSettingsResourceIndexJavaInstall = 3; |
|
34 const TInt KTrustSettingsResourceIndexOCSPCheck = 4; |
|
35 const TInt KTrustSettingsResourceIndexVPN = 5; |
|
36 const TInt KTrustSettingsResourceIndexValueYes = 0; |
|
37 const TInt KTrustSettingsResourceIndexValueNo = 1; |
|
38 |
|
39 // FORWARD DECLARATIONS |
|
40 class CCertificateAppInfoManager; |
|
41 |
|
42 // CLASS DECLARATION |
|
43 |
|
44 /** |
|
45 * CCertManUIContainerTrust container control class. |
|
46 * |
|
47 * @lib certmanui.lib |
|
48 */ |
|
49 NONSHARABLE_CLASS( CCertManUIContainerTrust ): |
|
50 public CCoeControl, public MCoeControlObserver, public MEikListBoxObserver |
|
51 { |
|
52 |
|
53 /** |
|
54 * Container trust needs to get access to CertManUIViewTrust's DoActivateL |
|
55 */ |
|
56 friend void CCertManUIViewTrust::DoActivateL( const TVwsViewId&, TUid, const TDesC8& ); |
|
57 |
|
58 public: // functions |
|
59 |
|
60 /** |
|
61 * Overrided Default constructor |
|
62 */ |
|
63 CCertManUIContainerTrust( CCertManUIViewTrust& aParent, CCertManUIKeeper& aKeeper ); |
|
64 |
|
65 /** |
|
66 * Destructor. |
|
67 */ |
|
68 ~CCertManUIContainerTrust(); |
|
69 |
|
70 /** |
|
71 * Change focus |
|
72 */ |
|
73 void FocusChanged( TDrawNow aDrawNow ); |
|
74 |
|
75 /** |
|
76 * Draws listbox |
|
77 */ |
|
78 void DrawListBoxL( TInt aCurrentPosition, TInt aTopItem, TInt aCertificateIndex ); |
|
79 |
|
80 /** |
|
81 * Puts correct Trust Settings text to listbox and correct value (yes/no) to the setting, |
|
82 * asks the value from CheckCertificateClientTrustL |
|
83 * For X509 certificates, only one Application is currently supported (Application controller), |
|
84 * more applications maybe added later however, so one additional application has been left |
|
85 * in comments as an example. |
|
86 * WAP connection and Application installer have their names from resources and are thus localized, |
|
87 * other additional application get their names from the CertMan API with Name() function |
|
88 */ |
|
89 void UpdateListBoxL( TInt aCertificateIndex ); |
|
90 |
|
91 /** |
|
92 * Handles listbox events |
|
93 * Cannot be changed to non-leaving function. |
|
94 * L-function is required by the class definition, even if empty. |
|
95 */ |
|
96 void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType ); |
|
97 |
|
98 /** |
|
99 * Changes the Trust Settings text from Yes to No and Vice versa |
|
100 * Updates the Trust Settings Listbox item value |
|
101 * Can be called only for those certificates that are located in ECrCertLocationCertMan !!! |
|
102 * Cannot be called for certificates located in ECrCertLocationWIMCard, |
|
103 * ECrCertLocationWIMURL, |
|
104 * ECrCertLocationPhoneMemory |
|
105 * ECrCertLocationPhoneMemoryURL |
|
106 * Certificate formats ECrX968Certificate ECrCertificateURL |
|
107 * are not visible in the Trust View |
|
108 */ |
|
109 void UpdateTrustListboxItemL( CCTCertInfo& aEntry, TInt aCurrentTruster ); |
|
110 |
|
111 /** |
|
112 * Puts correct client name and trust state to radiobutton setting page |
|
113 * Finds out which client was focused in Trust Settings view and calls ShowTrustChangeSettingPageL |
|
114 * This is accessed only by X509 certificates, located in CertMan |
|
115 * and having one or more clients |
|
116 * Must be public so that viewTrust can access |
|
117 */ |
|
118 void PopupTrustChangeSettingPageL( TInt aCertificateIndex ); |
|
119 |
|
120 /** |
|
121 * Checks if a certificate trusts a client |
|
122 * * Certificate format == ECrX509Certificate ECrX968Certificate ECrCertificateURL |
|
123 * are not supported if certificate location == ECrCertLocationWIMCard |
|
124 * * Certificate format == ECrX968Certificate ECrCertificateURL are not supported |
|
125 * if certificate location == ECrCertLocationCertMan |
|
126 * * Certificate location == ECrCertLocationWIMURL ECrCertLocationPhoneMemory |
|
127 * ECrCertLocationPhoneMemoryURL are not supported |
|
128 */ |
|
129 TBool CheckCertificateClientTrustL( const TUid aClientTUid, CCTCertInfo& aEntry ) const; |
|
130 |
|
131 /** |
|
132 * Changes the Trust state of client in the CertManAPI |
|
133 */ |
|
134 void ChangeTrustValueL( CCTCertInfo& aEntry, const TUid aClientUid ); |
|
135 |
|
136 /** |
|
137 * Handles resource change |
|
138 */ |
|
139 void HandleResourceChange( TInt aType ); |
|
140 |
|
141 public: // data |
|
142 |
|
143 /** |
|
144 * To get hold of ViewTrust |
|
145 */ |
|
146 CCertManUIViewTrust& iParent; |
|
147 |
|
148 /** |
|
149 * To get hold of CertManUIKeeper |
|
150 */ |
|
151 CCertManUIKeeper& iKeeper; |
|
152 |
|
153 /** |
|
154 * To handle listbox |
|
155 * Must be public so that viewTrust can access |
|
156 */ |
|
157 CEikTextListBox* iListBox; |
|
158 |
|
159 /** |
|
160 * To get the certificate location |
|
161 * Must be public so that viewTrust can access |
|
162 */ |
|
163 TInt iCertificateLocation; |
|
164 |
|
165 /** |
|
166 * Application manager class, used to get applications in system. |
|
167 */ |
|
168 CCertificateAppInfoManager* iAppInfoManager; |
|
169 |
|
170 /** |
|
171 * Applications registered to system. |
|
172 */ |
|
173 RArray<TCertificateAppInfo> iApps; |
|
174 |
|
175 /** |
|
176 * Client Uids of the certstore |
|
177 */ |
|
178 RArray<TUid> iClientUids; |
|
179 |
|
180 private: // functions |
|
181 |
|
182 /** |
|
183 * Default constructor |
|
184 */ |
|
185 CCertManUIContainerTrust(); |
|
186 |
|
187 /** |
|
188 * EPOC default constructor. |
|
189 * @param aRect Frame rectangle for container. |
|
190 */ |
|
191 void ConstructL(const TRect& aRect); |
|
192 |
|
193 /** |
|
194 * Creates listbox |
|
195 */ |
|
196 void CreateListBoxL(); |
|
197 |
|
198 /** |
|
199 * From CoeControl,SizeChanged. |
|
200 */ |
|
201 void SizeChanged(); |
|
202 |
|
203 /** |
|
204 * From CoeControl,CountComponentControls. |
|
205 */ |
|
206 TInt CountComponentControls() const; |
|
207 |
|
208 /** |
|
209 * From CCoeControl,ComponentControl. |
|
210 */ |
|
211 CCoeControl* ComponentControl( TInt aIndex ) const; |
|
212 |
|
213 /** |
|
214 * From CCoeControl,Draw. |
|
215 */ |
|
216 void Draw( const TRect& aRect ) const; |
|
217 |
|
218 /** |
|
219 * Handles control events |
|
220 * Cannot be changed to non-leaving function. |
|
221 * L-function is required by the class definition, even if empty. |
|
222 */ |
|
223 void HandleControlEventL( CCoeControl* aControl,TCoeEvent aEventType); |
|
224 |
|
225 /** |
|
226 * Handles the key events OK button, arrow keys. |
|
227 */ |
|
228 TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); |
|
229 |
|
230 /** |
|
231 * Sets empty list for listbox. |
|
232 */ |
|
233 void SetEmptyListL( CEikListBox* aListBox ); |
|
234 |
|
235 /** |
|
236 * Puts correct client names and yes/no state to settings page |
|
237 * Sets title text to a setting page |
|
238 */ |
|
239 void ShowTrustChangeSettingPageL( const TUid aClientUid, |
|
240 TDesC& aClientName, CCTCertInfo& aEntry ); |
|
241 |
|
242 void InsertItemToTrustListL( const TInt index, const TUid id, |
|
243 CCTCertInfo& entry, CDesCArray* itemArray, |
|
244 TInt position ); |
|
245 |
|
246 /** |
|
247 * Sets empty list for listbox. |
|
248 */ |
|
249 TInt GetTrusterResId( TUid aTrusterUid ); |
|
250 |
|
251 /** |
|
252 * This function is called when Help application is launched. |
|
253 * (other items were commented in a header). |
|
254 */ |
|
255 void GetHelpContext( TCoeHelpContext& aContext ) const; |
|
256 |
|
257 |
|
258 private: //data |
|
259 |
|
260 /** |
|
261 * To get the names of the trusted clients from the resources |
|
262 */ |
|
263 CDesCArrayFlat* iTrustedClients; |
|
264 |
|
265 /** |
|
266 * To get the yes/no trust texts from the resources |
|
267 */ |
|
268 CDesCArrayFlat* iTrustValues; |
|
269 |
|
270 }; |
|
271 |
|
272 #endif // __CERTMANUICONTAINERTRUST_H |
|
273 |
|
274 // End of File |