|
1 /* |
|
2 * Copyright (c) 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: This file contains the header file of the CAtsLogger |
|
15 * class. |
|
16 * |
|
17 */ |
|
18 #include <msisuihandlers.h> |
|
19 |
|
20 /*@{*/ |
|
21 ///Macros |
|
22 #define KUserNameMaxLength 64 |
|
23 #define KPassword 64 |
|
24 /*@}*/ |
|
25 |
|
26 enum KMyErrCode |
|
27 { |
|
28 KErrNothing, |
|
29 KErrLanguage, |
|
30 KErrDrive, |
|
31 KErrOptions, |
|
32 KErrAbortInstall, |
|
33 KErrAbortUnInstall, |
|
34 KErrLeave, |
|
35 KErrCannotOverwriteFile, |
|
36 KErrError |
|
37 }; |
|
38 |
|
39 /** |
|
40 This represents the User Interface handler for the install engine |
|
41 The higher code should provide one of these interfaces for the engine |
|
42 to use for a UI. |
|
43 |
|
44 @publishedPartner |
|
45 @released |
|
46 */ |
|
47 using namespace Swi; |
|
48 |
|
49 class CTestSecurityInstUIHandler : public CBase, public Swi::MUiHandler |
|
50 // This represents the User Interface handler for the install engine |
|
51 // The higher code should provide one of these interfaces for the engine |
|
52 // to use for a UI |
|
53 { |
|
54 public: |
|
55 static CTestSecurityInstUIHandler* NewL(); |
|
56 |
|
57 ~CTestSecurityInstUIHandler(); |
|
58 |
|
59 /** |
|
60 * Displays a dialog at the beginning of an installation with details about the SISX package |
|
61 * being installed. This dialog must be shown in TrustedUI mode. |
|
62 * |
|
63 * @param aAppInfo Information about the application. |
|
64 * @param aLogo The logo data in the SISX file. If no logo is present it will be NULL. |
|
65 * @param aCertificates An array of end entity certificates, one for each chain in the SISX file. |
|
66 * If the SISX file is unsigned this array will have zero length. |
|
67 * |
|
68 * @note Trusted UI |
|
69 * |
|
70 * @return ETrue if the user pressed the Yes button to continue the install, |
|
71 * EFalse if the user pressed the No button, aborting the installation. |
|
72 */ |
|
73 TBool DisplayInstallL (const CAppInfo& aAppInfo, |
|
74 const CApaMaskedBitmap* aLogo, |
|
75 const RPointerArray <CCertificateInfo> & aCertificates); |
|
76 /** |
|
77 * Displays a dialog requesting that the user grants these capabilities to the SISX package |
|
78 * being installed. This dialog must be shown in TrustedUI mode. |
|
79 * |
|
80 * @param aAppInfo Information about the application. |
|
81 * @param aCapabilitySet The capabilities requested by the SISX package. |
|
82 * |
|
83 * @note Trusted UI |
|
84 * |
|
85 * @return ETrue to continue the installation, or EFalse to abort the installation. |
|
86 */ |
|
87 TBool DisplayGrantCapabilitiesL(const CAppInfo& aAppInfo, |
|
88 const TCapabilitySet& aCapabilitySet); |
|
89 |
|
90 /** |
|
91 * Requests preferred language and dialect information from the UI. |
|
92 * |
|
93 * @param aAppInfo Information about the application. |
|
94 * @param aLanguages Array of languages supported by the SIS file. |
|
95 * |
|
96 * @return Must return index in the passed array that corresponds to the user's selected |
|
97 * preferred language. If out-of-bounds value is returned, the engine will abort |
|
98 * installation. |
|
99 */ |
|
100 TInt DisplayLanguageL(const CAppInfo& aAppInfo, |
|
101 const RArray<TLanguage>& aLanguages); |
|
102 |
|
103 /** |
|
104 * Requests the drive to install the package on, from the UI. |
|
105 * |
|
106 * @param aAppInfo Information about the application. |
|
107 * @param aSize Total size of the files that will be installed on the configurable drive. |
|
108 * @param aDriveLetters Array of drive letters on which the package can be installed. |
|
109 * @param aDriveSpaces Array of space free (in bytes) on each of the drives in the aDriveLetters array. |
|
110 * |
|
111 * @return An index in the drive array. If the index is out of range the engine will abort |
|
112 * the installation. |
|
113 */ |
|
114 TInt DisplayDriveL(const CAppInfo& aAppInfo, |
|
115 TInt64 aSize, |
|
116 const RArray<TChar>& aDriveLetters, |
|
117 const RArray<TInt64>& aDriveSpaces); |
|
118 |
|
119 /** |
|
120 * Displays a dialog asking whether we want to upgrade an application present on the device. |
|
121 * |
|
122 * @param aAppInfo Information about the application being installed. |
|
123 * @param aExistingAppInfo Information about the existing application. |
|
124 * |
|
125 * @return ETrue if the user pressed the Yes button, |
|
126 * EFalse if the user pressed the No button. |
|
127 */ |
|
128 TBool DisplayUpgradeL(const CAppInfo& aAppInfo, |
|
129 const CAppInfo& aExistingAppInfo); |
|
130 |
|
131 /** |
|
132 * Displays a dialog box asking which options the user wishes to install. |
|
133 * |
|
134 * @param aAppInfo Information about the application. |
|
135 * @param aOptions An array of option names. |
|
136 * @param aSelections An array of booleans, corresponding to the aOptions array. |
|
137 * |
|
138 * @return ETrue on success, EFalse on error. |
|
139 */ |
|
140 TBool DisplayOptionsL(const CAppInfo& aAppInfo, |
|
141 const RPointerArray<TDesC>& aOptions, |
|
142 RArray<TBool>& aSelections); |
|
143 |
|
144 /** |
|
145 * Informs the UI of events occurring during installation. |
|
146 * |
|
147 * @param aEvent The event which has occurred. |
|
148 * @param aValue The value associated with the event if applicable. |
|
149 * @param aDes A descriptor associated with the event if applicable. |
|
150 */ |
|
151 TBool HandleInstallEventL(const CAppInfo& aAppInfo, |
|
152 TInstallEvent aEvent, |
|
153 TInt aValue=0, |
|
154 const TDesC& aDes=KNullDesC); |
|
155 /** |
|
156 * Informs the UI of cancellable events occurring during installation. |
|
157 * |
|
158 * @param aEvent The event which has occurred. |
|
159 * @param aCancelHandler This mix-in is used to inform Software Install that the user has |
|
160 * pressed the cancel button on the dialog. |
|
161 * @param aValue The value associated with the event if applicable. |
|
162 * @param aDes A descriptor associated with the event if applicable. |
|
163 */ |
|
164 void HandleCancellableInstallEventL(const CAppInfo& aAppInfo, |
|
165 TInstallCancellableEvent aEvent, |
|
166 MCancelHandler& aCancelHandler, |
|
167 TInt aValue=0, |
|
168 const TDesC& aDes=KNullDesC); |
|
169 /** |
|
170 * Displays a dialog indicating that the package is unsigned, or that signature validation has failed. |
|
171 * |
|
172 * @param aAppInfo Information about the application. |
|
173 * @param aSigValidationResult The result of signature validation. |
|
174 * @param aPkixResult Results of a validation of the PKIX certificate chain. |
|
175 * Note that is can be NULL, in this case no validation results are available. |
|
176 * @param aCertificates An array containing information about the certificates in the chain. |
|
177 * @param aInstallAnyway ETrue if installation is allowed to continue. |
|
178 * |
|
179 * @return ETrue to continue the installation, EFalse to abort. |
|
180 */ |
|
181 TBool DisplaySecurityWarningL(const CAppInfo& aAppInfo, |
|
182 Swi::TSignatureValidationResult aSigValidationResult, |
|
183 RPointerArray<CPKIXValidationResultBase>& aPkixResults, |
|
184 RPointerArray<CCertificateInfo>& aCertificates, |
|
185 TBool aInstallAnyway); |
|
186 |
|
187 /** |
|
188 * Displays a dialog indicating that there was an error carrying out online certificate status checking. |
|
189 * |
|
190 * @param aMessage The error which occurred during online certificate status checking |
|
191 * @param aOutcome The outcome of the OCSP check. If no outcome can be given, it will be NULL. |
|
192 * @param aWarningOnly ETrue if the installation is allowed to continue after a warning, EFalse otherwise. |
|
193 * |
|
194 * @return ETrue on success, EFalse on error. |
|
195 */ |
|
196 TBool DisplayOcspResultL(const CAppInfo& aAppInfo, |
|
197 TRevocationDialogMessage aMessage, |
|
198 RPointerArray<TOCSPOutcome>& aOutcomes, |
|
199 RPointerArray<CCertificateInfo>& aCertificates, |
|
200 TBool aWarningOnly); |
|
201 |
|
202 /** |
|
203 * Used to inform the user the installation they are attempting is trying to overwrite |
|
204 * a file that does not belong to it. Following this message installation is aborted. |
|
205 * |
|
206 * @param aAppInfo Information about the application. |
|
207 * @param aInstalledAppInfo Information about the application that owns the file in question. |
|
208 * @param aFileName The filename of the file in question |
|
209 */ |
|
210 void DisplayCannotOverwriteFileL(const CAppInfo& aAppInfo, |
|
211 const CAppInfo& aInstalledAppInfo, |
|
212 const TDesC& aFileName); |
|
213 |
|
214 /** |
|
215 * Displays a dialog at the start of the uninstallation with information about the application |
|
216 * to be uninstalled. The user may cancel the uninstallation at this stage. This dialog must |
|
217 * be shown in TrustedUI mode. |
|
218 * |
|
219 * @param aAppInfo Information about the application. |
|
220 * |
|
221 * @note Trusted UI |
|
222 * |
|
223 * @return ETrue to continue the uninstallation, or EFalse to abort the uninstallation. |
|
224 */ |
|
225 TBool DisplayUninstallL(const CAppInfo& aAppInfo); |
|
226 |
|
227 |
|
228 /** |
|
229 * Displays a dialog containing text. This dialog has only a Continue button if aOption is |
|
230 * EInstFileTextOptionContinue, or Yes and No buttons otherwise. |
|
231 * |
|
232 * @param aAppInfo Information about the application. |
|
233 * @param aOption The type of dialog box to display. |
|
234 * @param aText The text to display |
|
235 * |
|
236 * @return ETrue is the user wants to go forward, EFalse otherwise. |
|
237 */ |
|
238 TBool DisplayTextL(const CAppInfo& aAppInfo, |
|
239 TFileTextOption aOption, |
|
240 const TDesC& aText); |
|
241 |
|
242 /** |
|
243 * Displays a dialog showing an error message. |
|
244 * |
|
245 * @param aAppInfo Information about the application. |
|
246 * @param aType The error message to display. |
|
247 * @param aParam An error specific parameter. |
|
248 */ |
|
249 void DisplayErrorL(const CAppInfo& aAppInfo, |
|
250 TErrorDialog aType, |
|
251 const TDesC& aParam); |
|
252 |
|
253 /** |
|
254 * Displays a dialog indicating that a component which is being uninstalled is a dependency |
|
255 * of another component installed. |
|
256 * |
|
257 * @param aAppInfo Information about the application. |
|
258 * @param aComponents An array of components which depend on components of the application |
|
259 * |
|
260 * @return ETrue to continue the uninstallation, EFalse to abort. |
|
261 */ |
|
262 TBool DisplayDependencyBreakL(const CAppInfo& aAppInfo, |
|
263 const RPointerArray<TDesC>& aComponents); |
|
264 |
|
265 /** |
|
266 * Informs user that the applications are in use during an uninstallation. |
|
267 * Return ETrue if the user wishes to continue the removal process and |
|
268 * close the applications anyway |
|
269 * |
|
270 * @param aAppNames An array containing the name of the application in use. |
|
271 * |
|
272 * @return ETrue if the user wishes to continue with removal. |
|
273 */ |
|
274 TBool DisplayApplicationsInUseL(const CAppInfo& aAppInfo, const RPointerArray<TDesC>& aAppNames); |
|
275 |
|
276 /** |
|
277 * Displays a generic question dialog with a Yes/No answer. |
|
278 * |
|
279 * @param aAppInfo Information about the application. |
|
280 * @param aQuestion The question to ask. |
|
281 * @param aDes A descriptor associated with the question if applicable. |
|
282 * |
|
283 * @return ETrue if the user pressed the Yes button, |
|
284 * EFalse if the user pressed the No button. |
|
285 */ |
|
286 TBool DisplayQuestionL(const CAppInfo& aAppInfo, TQuestionDialog aQuestion, const TDesC& aDes=KNullDesC); |
|
287 |
|
288 /** |
|
289 * Used to inform the user of a missing dependency needed to install the |
|
290 * current package. It is up to the UI implementors and/or the user whether |
|
291 * or not this warning can be overridden. |
|
292 * |
|
293 * @param aAppInfo Info about the current application. |
|
294 * @param aDependencyName Name of the missing dependency. |
|
295 * @param aWantedVersionFrom Starting suitable version number of the mising |
|
296 * dependency. Can be all zeros, meaning it is |
|
297 * unknown. |
|
298 * @param aWantedVersionFrom Ending suitable version number of the mising |
|
299 * dependency. Can be all zeros, meaning it is |
|
300 * unknown. |
|
301 * @param aInstalledVersion The installed (unsuitable) version of the |
|
302 * missing dependency. Can be all zeros, meaning |
|
303 * the missing dependency is not installed. |
|
304 * |
|
305 * @return \e ETrue to continue installation, \e EFalse to abort. |
|
306 */ |
|
307 TBool DisplayMissingDependencyL( |
|
308 const CAppInfo& aAppInfo, |
|
309 const TDesC& aDependencyName, |
|
310 TVersion aWantedVersionFrom, |
|
311 TVersion aWantedVersionTo, |
|
312 TVersion aInstalledVersion); |
|
313 |
|
314 |
|
315 |
|
316 |
|
317 TBool iDispInstall; |
|
318 TBool iDispGrantCapabilities; |
|
319 TBool iDispUnInstall; |
|
320 TInt iDispLanguage; |
|
321 TInt iDispDialect; |
|
322 TChar iDispDrive; |
|
323 TBool iDispUpgrade; |
|
324 TBool iDispDependencyBreak; |
|
325 TBool iDispQuestion; |
|
326 TBool iDispSecurityWarning; |
|
327 TBool iDispRevocationQuery; |
|
328 TBool iDispApplicationInUse; |
|
329 TBool iDispTextDialog; |
|
330 TInt iDispOptions; |
|
331 TInt iAppUID; |
|
332 |
|
333 KMyErrCode iErrCode; |
|
334 |
|
335 private: |
|
336 CTestSecurityInstUIHandler(); |
|
337 void ConstructL(); |
|
338 }; |
|
339 |
|
340 |