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