1 /* |
|
2 * Copyright (c) 2008-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 the License "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 #define __INCLUDE_CAPABILITY_NAMES__ |
|
20 |
|
21 #include <e32test.h> |
|
22 #include <f32file.h> |
|
23 #include <test/testexecutelogger.h> |
|
24 #include "tuiscriptadaptors.h" |
|
25 #include "languagetable.h" |
|
26 |
|
27 #include <swi/launcher.h> |
|
28 #include <e32capability.h> |
|
29 #include <utf.h> |
|
30 |
|
31 using namespace Swi; |
|
32 using namespace Swi::Test; |
|
33 using namespace Xml; |
|
34 |
|
35 _LIT8(KParserDataType, "text/xml"); |
|
36 _LIT8(KTrueValue, "true"); |
|
37 _LIT8(KFalseValue, "false"); |
|
38 _LIT8(KIndexType, "item"); |
|
39 _LIT8(KReturnType, "return"); |
|
40 _LIT8(KDialogName, "dialog"); |
|
41 _LIT8(KUpdateProgressReturn, "updateprogressreturn"); |
|
42 _LIT8(KUpdateProgressFinalReturn, "updateprogressfinalreturn"); |
|
43 |
|
44 |
|
45 enum TDialogs |
|
46 { |
|
47 KDisplayInstall1 = 1, |
|
48 KDisplayLanguage1, |
|
49 KDisplayDrive1, |
|
50 KDisplayUpgrade1, |
|
51 KDisplayOptions1, |
|
52 KDisplaySecurityWarning1, |
|
53 KDisplayOcspResult1, |
|
54 KDisplayCannotOverwriteFile1, |
|
55 KDisplayUninstall1, |
|
56 KDisplayText1, |
|
57 KDisplayError1, |
|
58 KDisplayDependencyBreak1, |
|
59 KDisplayApplicationsInUse1, |
|
60 KDisplayQuestion1, |
|
61 KDisplayMissingDependency1, |
|
62 KInstallEvenDialogSetProgressBar, |
|
63 KInstallEvenDialogUpdateProgressBar, |
|
64 KInstallEvenDialogCompletedInstall, |
|
65 KInstallEvenDialogOcspCheckEnd, |
|
66 KInstallEvenDialogCompletedUnInstall, |
|
67 KInstallEvenDevCert, |
|
68 KCancelInstallRemoving, |
|
69 KCancelInstallShuttingDown, |
|
70 KCancelInstallCopyingFiles, |
|
71 KCancelInstallOcspCheckStart |
|
72 }; |
|
73 /* Functions Literals */ |
|
74 _LIT8(KDisplayInstall, "DisplayInstall"); |
|
75 _LIT8(KDisplayGrantCapabilities, "DisplayGrantCapabilities"); |
|
76 _LIT8(KDisplayLanguage, "DisplayLanguage"); |
|
77 _LIT8(KDisplayDrive, "DisplayDrive"); |
|
78 _LIT8(KDisplayUpgrade, "DisplayUpgrade"); |
|
79 _LIT8(KDisplayOptions, "DisplayOptions"); |
|
80 _LIT8(KHandleInstallEvent, "HandleInstallEvent"); |
|
81 _LIT8(KHandleCancellableInstallEvent,"HandleCancellableInstallEvent"); |
|
82 _LIT8(KDisplaySecurityWarning, "DisplaySecurityWarning"); |
|
83 _LIT8(KDisplayOcspResult, "DisplayOcspResult"); |
|
84 _LIT8(KDisplayCannotOverwriteFile, "DisplayCannotOverwriteFile"); |
|
85 _LIT8(KDisplayUninstall, "DisplayUninstall"); |
|
86 _LIT8(KDisplayText, "DisplayText"); |
|
87 _LIT8(KDisplayError, "DisplayError"); |
|
88 _LIT8(KDisplayDependencyBreak, "DisplayDependencyBreak"); |
|
89 _LIT8(KDisplayApplicationsInUse, "DisplayApplicationsInUse"); |
|
90 _LIT8(KDisplayQuestion, "DisplayQuestion"); |
|
91 _LIT8(KDisplayMissingDependency, "DisplayMissingDependency"); |
|
92 _LIT8(KDisplaySIDMismatch, "DisplaySIDMismatch"); |
|
93 |
|
94 #define KGenericBufferSize 100 |
|
95 |
|
96 // Init defaults which will be overridden by script data (or not) |
|
97 TXmlFileData::TXmlFileData() |
|
98 : InstallResult(ETrue) |
|
99 , CapabilitiesResult(ETrue) |
|
100 , LanguagesResult(0) |
|
101 , DriveResult('c'-'a') // Default to installing to C: |
|
102 , UpgradeResult(ETrue) |
|
103 , OptionsResult(ETrue) |
|
104 , WarningResult(ETrue) |
|
105 , OcspResult(ETrue) |
|
106 , UninstallResult(ETrue) |
|
107 , TextResult(ETrue) |
|
108 , DependencyResult(EFalse) |
|
109 , ApplicationsInUseResult(ETrue) |
|
110 , QuestionResult(EFalse) |
|
111 , MissingDependencyResult(EFalse) |
|
112 , DevCertsResult(ETrue) |
|
113 , UpdateProgressBarResult(ETrue) |
|
114 , ProgressBarFinalValueResult(ETrue) |
|
115 { |
|
116 } |
|
117 |
|
118 CUIScriptAdaptor::CUIScriptAdaptor(const TFileName& aXmlFileName, CTestExecuteLogger& aLogger, |
|
119 RArray<TTableOfInstallSizes>* aExpectedValue) |
|
120 : |
|
121 iXmlFileName(aXmlFileName), |
|
122 iLogger(aLogger), |
|
123 iExpectedValue(aExpectedValue), |
|
124 iDelayDialogNumber(-1) |
|
125 { |
|
126 } |
|
127 |
|
128 CUIScriptAdaptor* CUIScriptAdaptor::NewLC(const TFileName& aXmlFileName, CTestExecuteLogger& aLogger, |
|
129 RArray<TTableOfInstallSizes>* aExpectedValue) |
|
130 { |
|
131 CUIScriptAdaptor* self = new(ELeave) CUIScriptAdaptor(aXmlFileName, aLogger, aExpectedValue); |
|
132 CleanupStack::PushL(self); |
|
133 self->ConstructL(); |
|
134 return self; |
|
135 } |
|
136 |
|
137 CUIScriptAdaptor* CUIScriptAdaptor::NewL(const TFileName& aXmlFileName, CTestExecuteLogger& aLogger, |
|
138 RArray<TTableOfInstallSizes>* aExpectedValue) |
|
139 { |
|
140 CUIScriptAdaptor* self = NewLC(aXmlFileName, aLogger, aExpectedValue); |
|
141 CleanupStack::Pop(self); |
|
142 return self; |
|
143 } |
|
144 |
|
145 CUIScriptAdaptor::CUIScriptAdaptor(const TFileName& aXmlFileName, CTestExecuteLogger& aLogger, |
|
146 TPtrC aExpectedText, |
|
147 TPtrC aTextIsHash, |
|
148 TInt aExpectedDailog, |
|
149 TInt aKerrCode) |
|
150 : |
|
151 iXmlFileName(aXmlFileName), |
|
152 iLogger(aLogger), |
|
153 iExpectedDisplayText(aExpectedText), |
|
154 iExpectedHash(aTextIsHash), |
|
155 iExpectedDialog(aExpectedDailog), |
|
156 iKerrCode(aKerrCode), |
|
157 iDelayDialogNumber(-1), |
|
158 iDisplayedTextActual(NULL) |
|
159 { |
|
160 } |
|
161 |
|
162 CUIScriptAdaptor* CUIScriptAdaptor::NewLC(const TFileName& aXmlFileName, CTestExecuteLogger& aLogger, |
|
163 TPtrC aExpectedText, |
|
164 TPtrC aTextIsHash, |
|
165 TInt aExpectedDailog, |
|
166 TInt aKerrCode |
|
167 ) |
|
168 { |
|
169 CUIScriptAdaptor* self = new(ELeave) CUIScriptAdaptor(aXmlFileName, aLogger, aExpectedText, aTextIsHash, aExpectedDailog, aKerrCode); |
|
170 CleanupStack::PushL(self); |
|
171 self->ConstructL(); |
|
172 return self; |
|
173 } |
|
174 |
|
175 CUIScriptAdaptor* CUIScriptAdaptor::NewL(const TFileName& aXmlFileName, CTestExecuteLogger& aLogger, |
|
176 TPtrC aExpectedText, |
|
177 TPtrC aTextIsHash, |
|
178 TInt aExpectedDailog, |
|
179 TInt aKerrCode |
|
180 ) |
|
181 { |
|
182 CUIScriptAdaptor* self = NewLC(aXmlFileName, aLogger, aExpectedText,aTextIsHash, aExpectedDailog, aKerrCode); |
|
183 CleanupStack::Pop(self); |
|
184 return self; |
|
185 } |
|
186 void CUIScriptAdaptor::ConstructL() |
|
187 { |
|
188 User::LeaveIfError(iFs.Connect()); |
|
189 ScriptParseL(); |
|
190 } |
|
191 |
|
192 CUIScriptAdaptor::~CUIScriptAdaptor() |
|
193 { |
|
194 iResult.OptionSelection.Close(); |
|
195 iFs.Close(); |
|
196 iObservedOcspOutcomes.ResetAndDestroy(); |
|
197 delete iFileOwner; |
|
198 delete iDisplayedTextActual; |
|
199 } |
|
200 |
|
201 /** |
|
202 * The function is called to parse the XML file. |
|
203 */ |
|
204 void CUIScriptAdaptor::ScriptParseL() |
|
205 { |
|
206 CRebuildingContentHandler* contentHandler = |
|
207 CRebuildingContentHandler::NewLC(iLogger); |
|
208 |
|
209 // Open parser session |
|
210 CParser* parser = CParser::NewLC(KParserDataType, *contentHandler); |
|
211 |
|
212 // Starts parser session and active scheduler. |
|
213 INFO_PRINTF1(_L("Parsing XML...")); |
|
214 ParseL(*parser, iFs, iXmlFileName); |
|
215 |
|
216 iResult = contentHandler->GetOptions(); |
|
217 CleanupStack::PopAndDestroy(2, contentHandler); // parser, contentHandler |
|
218 } |
|
219 |
|
220 /** |
|
221 * Extracts the nPos command line argument. |
|
222 */ |
|
223 |
|
224 HBufC* GetArgumentL(TInt nPos) |
|
225 { |
|
226 HBufC *argv = HBufC::NewLC(User::CommandLineLength()); |
|
227 TPtr cmd(argv->Des()); |
|
228 User::CommandLine(cmd); |
|
229 |
|
230 TLex arguments(cmd); |
|
231 |
|
232 // finds nth parameter |
|
233 while(nPos && !arguments.Eos()) |
|
234 { |
|
235 TPtrC token = arguments.NextToken(); |
|
236 if(token.Length() > 0) |
|
237 { |
|
238 nPos--; |
|
239 } |
|
240 } |
|
241 |
|
242 HBufC* result = NULL; |
|
243 |
|
244 if(!arguments.Eos()) |
|
245 { |
|
246 TPtrC testfile(arguments.NextToken()); |
|
247 |
|
248 if(testfile.Length() > 0) |
|
249 { |
|
250 result = testfile.AllocL(); |
|
251 } |
|
252 }; |
|
253 |
|
254 // no parameter found, but must return something so.. |
|
255 if(!result) |
|
256 { |
|
257 result = HBufC::NewL(0); |
|
258 } |
|
259 |
|
260 CleanupStack::PopAndDestroy(argv); |
|
261 |
|
262 return result; |
|
263 } |
|
264 |
|
265 CRebuildingContentHandler* CRebuildingContentHandler::NewLC( |
|
266 CTestExecuteLogger& aLogger) |
|
267 { |
|
268 CRebuildingContentHandler* self = new(ELeave) CRebuildingContentHandler( |
|
269 aLogger); |
|
270 CleanupStack::PushL(self); |
|
271 return self; |
|
272 } |
|
273 |
|
274 CRebuildingContentHandler* CRebuildingContentHandler::NewL( |
|
275 CTestExecuteLogger& aLogger) |
|
276 { |
|
277 CRebuildingContentHandler* self = new(ELeave) CRebuildingContentHandler( |
|
278 aLogger); |
|
279 return self; |
|
280 } |
|
281 |
|
282 CRebuildingContentHandler::CRebuildingContentHandler( |
|
283 CTestExecuteLogger& aLogger) |
|
284 : |
|
285 iError(KErrNone), |
|
286 iLogger(aLogger), |
|
287 iLevel1(EScript) |
|
288 { |
|
289 } |
|
290 |
|
291 CRebuildingContentHandler::~CRebuildingContentHandler() |
|
292 { |
|
293 } |
|
294 |
|
295 void CRebuildingContentHandler::OnStartDocumentL(const RDocumentParameters& |
|
296 /*aDocParam*/, TInt aErrorCode) |
|
297 { |
|
298 User::LeaveIfError(aErrorCode); |
|
299 } |
|
300 |
|
301 void CRebuildingContentHandler::OnEndDocumentL(TInt aErrorCode) |
|
302 { |
|
303 User::LeaveIfError(aErrorCode); |
|
304 } |
|
305 |
|
306 void CRebuildingContentHandler::OnStartElementL(const RTagInfo& aElement, |
|
307 const RAttributeArray& aAttributes, TInt aErrorCode) |
|
308 { |
|
309 User::LeaveIfError(aErrorCode); |
|
310 |
|
311 TInt nAttributes = aAttributes.Count(); |
|
312 for(TInt i=0; i<nAttributes; i++) |
|
313 { |
|
314 const RAttribute& attribute = aAttributes[i]; |
|
315 const TDesC8& value8 = attribute.Value().DesC(); |
|
316 const TDesC8& tagname8 = aElement.LocalName().DesC(); |
|
317 switch(iLevel1) |
|
318 { |
|
319 case EScript: |
|
320 if(value8.Compare(KDisplaySIDMismatch)==KErrNone) |
|
321 { |
|
322 iLevel1 = EDisplaySIDMismatch; |
|
323 break; |
|
324 } |
|
325 else if (value8.Compare(KDisplayInstall) == KErrNone ) |
|
326 { |
|
327 iLevel1 = EDisplayInstall; |
|
328 break; |
|
329 } |
|
330 else if (value8.Compare(KDisplayGrantCapabilities) == KErrNone) |
|
331 { |
|
332 iLevel1 = EDisplayGrantCapabilities; |
|
333 break; |
|
334 } |
|
335 else if (value8.Compare(KDisplayLanguage) == KErrNone ) |
|
336 { |
|
337 iLevel1 = EDisplayLanguage; |
|
338 break; |
|
339 } |
|
340 else if (value8.Compare(KDisplayDrive) == KErrNone ) |
|
341 { |
|
342 iLevel1 = EDisplayDrive; |
|
343 break; |
|
344 } |
|
345 else if (value8.Compare(KDisplayUpgrade) == KErrNone ) |
|
346 { |
|
347 iLevel1 = EDisplayUpgrade; |
|
348 break; |
|
349 } |
|
350 else if (value8.Compare(KDisplayOptions) == KErrNone ) |
|
351 { |
|
352 iLevel1 = EDisplayOptions; |
|
353 break; |
|
354 } |
|
355 else if (value8.Compare(KHandleInstallEvent) == KErrNone ) |
|
356 { |
|
357 iLevel1 = EHandleInstallEvent; |
|
358 break; |
|
359 } |
|
360 else if (value8.Compare(KHandleCancellableInstallEvent) == KErrNone ) |
|
361 { |
|
362 iLevel1 = EHandleCancellableInstallEvent; |
|
363 break; |
|
364 } |
|
365 else if (value8.Compare(KDisplaySecurityWarning) == KErrNone ) |
|
366 { |
|
367 iLevel1 = EDisplaySecurityWarning; |
|
368 break; |
|
369 } |
|
370 else if (value8.Compare(KDisplayOcspResult) == KErrNone ) |
|
371 { |
|
372 iLevel1 = EDisplayOcspResult; |
|
373 break; |
|
374 } |
|
375 else if (value8.Compare(KDisplayCannotOverwriteFile) == KErrNone ) |
|
376 { |
|
377 iLevel1 = EDisplayCannotOverwriteFile; |
|
378 break; |
|
379 } |
|
380 else if (value8.Compare(KDisplayUninstall) == KErrNone ) |
|
381 { |
|
382 iLevel1 = EDisplayUninstall; |
|
383 break; |
|
384 } |
|
385 else if (value8.Compare(KDisplayText) == KErrNone ) |
|
386 { |
|
387 iLevel1 = EDisplayText; |
|
388 break; |
|
389 } |
|
390 else if (value8.Compare(KDisplayError) == KErrNone ) |
|
391 { |
|
392 iLevel1 = EDisplayError; |
|
393 break; |
|
394 } |
|
395 else if (value8.Compare(KDisplayDependencyBreak) == KErrNone ) |
|
396 { |
|
397 iLevel1 = EDisplayDependencyBreak; |
|
398 break; |
|
399 } |
|
400 else if (value8.Compare(KDisplayApplicationsInUse) == KErrNone ) |
|
401 { |
|
402 iLevel1 = EDisplayApplicationsInUse; |
|
403 break; |
|
404 } |
|
405 else if (value8.Compare(KDisplayQuestion) == KErrNone ) |
|
406 { |
|
407 iLevel1 = EDisplayQuestion; |
|
408 break; |
|
409 } |
|
410 else if (value8.Compare(KDisplayMissingDependency) == KErrNone ) |
|
411 { |
|
412 iLevel1 = EDisplayMissingDependency; |
|
413 break; |
|
414 } |
|
415 case EDisplayInstall: |
|
416 case EDisplayGrantCapabilities: |
|
417 case EDisplayLanguage: |
|
418 case EDisplayDrive: |
|
419 case EDisplayUpgrade: |
|
420 case EHandleCancellableInstallEvent: |
|
421 case EDisplaySecurityWarning: |
|
422 case EDisplayOcspResult: |
|
423 case EDisplayCannotOverwriteFile: |
|
424 case EDisplayUninstall: |
|
425 case EDisplayText: |
|
426 case EDisplayError: |
|
427 case EDisplayDependencyBreak: |
|
428 case EDisplayApplicationsInUse: |
|
429 case EDisplayQuestion: |
|
430 case EDisplayMissingDependency: |
|
431 case EDisplaySIDMismatch: |
|
432 if ( tagname8.Compare(KReturnType) == KErrNone ) |
|
433 { |
|
434 iLevel2 = EReturn; |
|
435 } |
|
436 break; |
|
437 case EDisplayOptions: |
|
438 if ( tagname8.Compare(KIndexType) == KErrNone ) |
|
439 { |
|
440 iLevel3 = EItemIndex; |
|
441 } |
|
442 else if ( tagname8.Compare(KReturnType) == KErrNone ) |
|
443 { |
|
444 iLevel2 = EReturn; |
|
445 } |
|
446 break; |
|
447 case EHandleInstallEvent: |
|
448 if ( tagname8.Compare(KUpdateProgressReturn) == KErrNone ) |
|
449 { |
|
450 iLevel2 = EUpdateProgress; |
|
451 } |
|
452 else if (tagname8.Compare(KUpdateProgressFinalReturn) == KErrNone ) |
|
453 { |
|
454 iLevel2 = EUpdateProgressFinal; |
|
455 } |
|
456 else if ( tagname8.Compare(KReturnType) == KErrNone ) |
|
457 { |
|
458 iLevel2 = EReturn; |
|
459 } |
|
460 break; |
|
461 default: |
|
462 break; |
|
463 } |
|
464 } |
|
465 } |
|
466 |
|
467 void CRebuildingContentHandler::OnEndElementL(const RTagInfo& aElement, |
|
468 TInt aErrorCode) |
|
469 { |
|
470 User::LeaveIfError(aErrorCode); |
|
471 const TDesC8& localPart8 = aElement.LocalName().DesC(); |
|
472 if ( localPart8.Compare(KDialogName) == KErrNone ) |
|
473 { |
|
474 iLevel1 = EScript; |
|
475 iLevel2 = KErrNone; |
|
476 iLevel3 = KErrNone; |
|
477 } |
|
478 } |
|
479 |
|
480 void CRebuildingContentHandler::OnContentL(const TDesC8& aData8, |
|
481 TInt aErrorCode) |
|
482 { |
|
483 User::LeaveIfError(aErrorCode); |
|
484 |
|
485 switch(iLevel1) |
|
486 { |
|
487 case EDisplayInstall: |
|
488 if ( iLevel2 == EReturn ) |
|
489 { |
|
490 if ( aData8.Compare(KTrueValue) == KErrNone ) |
|
491 { |
|
492 INFO_PRINTF1(_L("DisplayInstallL will return ETrue")); |
|
493 iResult.InstallResult = ETrue; |
|
494 } |
|
495 else if ( aData8.Compare(KFalseValue) == KErrNone ) |
|
496 { |
|
497 INFO_PRINTF1(_L("DisplayInstallL will return EFalse")); |
|
498 iResult.InstallResult = EFalse; |
|
499 } |
|
500 } |
|
501 break; |
|
502 case EDisplayGrantCapabilities: |
|
503 if ( iLevel2 == EReturn ) |
|
504 { |
|
505 if ( aData8.Compare(KTrueValue) == KErrNone ) |
|
506 { |
|
507 INFO_PRINTF1(_L("DisplayGrantCapabilitiesL will return ETrue")); |
|
508 iResult.CapabilitiesResult = ETrue; |
|
509 } |
|
510 else if ( aData8.Compare(KFalseValue) == KErrNone ) |
|
511 { |
|
512 INFO_PRINTF1(_L("DisplayGrantCapabilitiesL will return EFalse")); |
|
513 iResult.CapabilitiesResult = EFalse; |
|
514 } |
|
515 } |
|
516 break; |
|
517 case EDisplayLanguage: |
|
518 if ( iLevel2 == EReturn ) |
|
519 { |
|
520 TName tagdata; |
|
521 TInt lang=0; |
|
522 tagdata.Copy(aData8); |
|
523 tagdata.Trim(); |
|
524 TLex value(tagdata); |
|
525 value.Val(lang); |
|
526 if (!iLangLogged) |
|
527 { |
|
528 INFO_PRINTF2(_L("DisplayLanguageL will return %d"), lang); |
|
529 iResult.LanguagesResult = lang; |
|
530 iLangLogged = ETrue; |
|
531 } |
|
532 } |
|
533 break; |
|
534 case EDisplayDrive: |
|
535 if ( iLevel2 == EReturn ) |
|
536 { |
|
537 TInt drive=-1; |
|
538 TName tagdata; |
|
539 tagdata.Copy(aData8); |
|
540 tagdata.Trim(); |
|
541 |
|
542 if (tagdata.Size() && TChar(tagdata[0]).IsAlphaDigit()) |
|
543 { |
|
544 drive=tagdata[0]-'a'; |
|
545 } |
|
546 if (!iDriveLogged) |
|
547 { |
|
548 INFO_PRINTF2(_L("DisplayDriveL will return drive '%c'"), drive+'A'); |
|
549 iResult.DriveResult = drive; |
|
550 iDriveLogged = ETrue; |
|
551 } |
|
552 } |
|
553 break; |
|
554 case EDisplayUpgrade: |
|
555 if ( iLevel2 == EReturn ) |
|
556 { |
|
557 if ( aData8.Compare(KTrueValue) == KErrNone ) |
|
558 { |
|
559 INFO_PRINTF1(_L("DisplayUpgradeL will return ETrue")); |
|
560 iResult.UpgradeResult = ETrue; |
|
561 } |
|
562 else if ( aData8.Compare(KFalseValue) == KErrNone ) |
|
563 { |
|
564 INFO_PRINTF1(_L("DisplayUpgradeL will return EFalse")); |
|
565 iResult.UpgradeResult = EFalse; |
|
566 } |
|
567 } |
|
568 break; |
|
569 case EDisplayOptions: |
|
570 if ( iLevel3 == EItemIndex && iLevel2 != EReturn) |
|
571 { |
|
572 if ( aData8.Compare(KTrueValue) == KErrNone ) |
|
573 { |
|
574 /* |
|
575 TBuf8<KGenericBufferSize> text; |
|
576 text.Format(_L8 ("\015\012The Selection Index of the DisplayOptionsL : ")); |
|
577 iOutFile.Write(text); |
|
578 iOutFile.Write(aData8); |
|
579 */ |
|
580 iResult.OptionSelection.Append(ETrue); |
|
581 } |
|
582 else if ( aData8.Compare(KFalseValue) == KErrNone ) |
|
583 { |
|
584 /* |
|
585 TBuf8<KGenericBufferSize> text; |
|
586 text.Format(_L8 ("\015\012The Selection Index of the DisplayOptionsL : ")); |
|
587 iOutFile.Write(text); |
|
588 iOutFile.Write(aData8); |
|
589 */ |
|
590 iResult.OptionSelection.Append(EFalse); |
|
591 } |
|
592 } |
|
593 else if ( iLevel2 == EReturn ) |
|
594 { |
|
595 if ( aData8.Compare(KTrueValue) == KErrNone ) |
|
596 { |
|
597 /* |
|
598 TBuf8<KGenericBufferSize> text; |
|
599 text.Format(_L8 ("\015\012The Input value of the DisplayOptionsL : ")); |
|
600 iOutFile.Write(text); |
|
601 iOutFile.Write(aData8); |
|
602 */ |
|
603 iResult.OptionsResult = ETrue; |
|
604 } |
|
605 else if ( aData8.Compare(KFalseValue) == KErrNone ) |
|
606 { |
|
607 /* |
|
608 TBuf8<KGenericBufferSize> text; |
|
609 text.Format(_L8 ("\015\012The Input value of the DisplayOptionsL : ")); |
|
610 iOutFile.Write(text); |
|
611 iOutFile.Write(aData8); |
|
612 */ |
|
613 iResult.OptionsResult = EFalse; |
|
614 } |
|
615 } |
|
616 break; |
|
617 |
|
618 case EHandleInstallEvent: |
|
619 if (iLevel2 == EUpdateProgress) |
|
620 { |
|
621 if (aData8.Compare(KTrueValue) == KErrNone) |
|
622 { |
|
623 INFO_PRINTF1(_L("HandleInstallEvent-UpdateProgress will return ETrue")); |
|
624 iResult.UpdateProgressBarResult = ETrue; |
|
625 } |
|
626 else if (aData8.Compare(KFalseValue) == KErrNone) |
|
627 { |
|
628 INFO_PRINTF1(_L("HandleInstallEvent-UpdateProgress will return EFalse")); |
|
629 iResult.UpdateProgressBarResult = EFalse; |
|
630 } |
|
631 } |
|
632 else if (iLevel2 == EUpdateProgressFinal) |
|
633 { |
|
634 if (aData8.Compare(KTrueValue) == KErrNone) |
|
635 { |
|
636 INFO_PRINTF1(_L("HandleInstallEvent-UpdateProgressFinal will return ETrue")); |
|
637 iResult.ProgressBarFinalValueResult = ETrue; |
|
638 } |
|
639 else if (aData8.Compare(KFalseValue) == KErrNone) |
|
640 { |
|
641 INFO_PRINTF1(_L("HandleInstallEvent-UpdateProgressFinal will return EFalse")); |
|
642 iResult.ProgressBarFinalValueResult = EFalse; |
|
643 } |
|
644 } |
|
645 else if (iLevel2 == EReturn) |
|
646 { |
|
647 if (aData8.Compare(KTrueValue) == KErrNone) |
|
648 { |
|
649 INFO_PRINTF1(_L("HandleInstallEvent-DevCert will return ETrue")); |
|
650 iResult.DevCertsResult = ETrue; |
|
651 } |
|
652 else if (aData8.Compare(KFalseValue) == KErrNone) |
|
653 { |
|
654 INFO_PRINTF1(_L("HandleInstallEvent-DevCert will return EFalse")); |
|
655 iResult.DevCertsResult = EFalse; |
|
656 } |
|
657 } |
|
658 break; |
|
659 |
|
660 case EHandleCancellableInstallEvent: |
|
661 // No return values for these events. |
|
662 break; |
|
663 |
|
664 case EDisplaySecurityWarning: |
|
665 if (iLevel2 == EReturn) |
|
666 { |
|
667 TBool found=EFalse; |
|
668 if (aData8.Compare(KTrueValue) == KErrNone) |
|
669 { |
|
670 iResult.WarningResult = ETrue; |
|
671 found=ETrue; |
|
672 } |
|
673 else if (aData8.Compare(KFalseValue) == KErrNone) |
|
674 { |
|
675 iResult.WarningResult = EFalse; |
|
676 found=ETrue; |
|
677 } |
|
678 |
|
679 if (found && !iSecWarnLogged) |
|
680 { |
|
681 _LIT(KETrue, "ETrue"); |
|
682 _LIT(KEFalse, "EFalse"); |
|
683 INFO_PRINTF2( |
|
684 _L("DisplaySecurityWarningL will return '%S'"), |
|
685 iResult.WarningResult ? &KETrue : &KEFalse); |
|
686 iSecWarnLogged=ETrue; |
|
687 } |
|
688 } |
|
689 break; |
|
690 |
|
691 case EDisplayOcspResult: |
|
692 if ( iLevel2 == EReturn ) |
|
693 { |
|
694 if ( aData8.Compare(KTrueValue) == KErrNone ) |
|
695 iResult.OcspResult = ETrue; |
|
696 else if ( aData8.Compare(KFalseValue) == KErrNone ) |
|
697 iResult.OcspResult = EFalse; |
|
698 _LIT(KETrue, "ETrue"); |
|
699 _LIT(KEFalse, "EFalse"); |
|
700 INFO_PRINTF2( |
|
701 _L("DisplayOcspResultL will return '%S'"), |
|
702 iResult.OcspResult ? &KETrue : &KEFalse); |
|
703 } |
|
704 break; |
|
705 case EDisplayCannotOverwriteFile: |
|
706 break; |
|
707 |
|
708 case EDisplayUninstall: |
|
709 if ( iLevel2 == EReturn ) |
|
710 { |
|
711 if ( aData8.Compare(KTrueValue) == KErrNone ) |
|
712 { |
|
713 INFO_PRINTF1(_L("DisplayUninstallL will return ETrue")); |
|
714 iResult.UninstallResult = ETrue; |
|
715 } |
|
716 else if ( aData8.Compare(KFalseValue) == KErrNone ) |
|
717 { |
|
718 INFO_PRINTF1(_L("DisplayUninstallL will return EFalse")); |
|
719 iResult.UninstallResult = EFalse; |
|
720 } |
|
721 } |
|
722 break; |
|
723 |
|
724 case EDisplayText: |
|
725 if ( iLevel2 == EReturn ) |
|
726 { |
|
727 if ( aData8.Compare(KTrueValue) == KErrNone ) |
|
728 { |
|
729 /* |
|
730 TBuf8<KGenericBufferSize> text; |
|
731 text.Format(_L8 ("\015\012The Input value of the DisplayTextL : ")); |
|
732 iOutFile.Write(text); |
|
733 iOutFile.Write(aData8); |
|
734 */ |
|
735 iResult.TextResult = ETrue; |
|
736 } |
|
737 else if ( aData8.Compare(KFalseValue) == KErrNone ) |
|
738 { |
|
739 /* |
|
740 TBuf8<KGenericBufferSize> text; |
|
741 text.Format(_L8 ("\015\012The Input value of the DisplayTextL : ")); |
|
742 iOutFile.Write(text); |
|
743 iOutFile.Write(aData8); |
|
744 */ |
|
745 iResult.TextResult = EFalse; |
|
746 } |
|
747 } |
|
748 break; |
|
749 case EDisplayError: |
|
750 break; |
|
751 case EDisplayDependencyBreak: |
|
752 if ( iLevel2 == EReturn ) |
|
753 { |
|
754 if ( aData8.Compare(KTrueValue) == KErrNone ) |
|
755 { |
|
756 /* |
|
757 TBuf8<KGenericBufferSize> text; |
|
758 text.Format(_L8 ("\015\012The Input value of the DisplayDependencyBreakL : ")); |
|
759 iOutFile.Write(text); |
|
760 iOutFile.Write(aData8); |
|
761 */ |
|
762 iResult.DependencyResult = ETrue; |
|
763 } |
|
764 else if ( aData8.Compare(KFalseValue) == KErrNone ) |
|
765 { |
|
766 /* |
|
767 TBuf8<KGenericBufferSize> text; |
|
768 text.Format(_L8 ("\015\012The Input value of the DisplayDependencyBreakL : ")); |
|
769 iOutFile.Write(text); |
|
770 iOutFile.Write(aData8); |
|
771 */ |
|
772 iResult.DependencyResult = EFalse; |
|
773 } |
|
774 } |
|
775 break; |
|
776 case EDisplayApplicationsInUse: |
|
777 if ( iLevel2 == EReturn ) |
|
778 { |
|
779 if ( aData8.Compare(KTrueValue) == KErrNone ) |
|
780 { |
|
781 /* |
|
782 TBuf8<KGenericBufferSize> text; |
|
783 text.Format(_L8 ("\015\012The Input value of the DisplayApplicationsInUseL : ")); |
|
784 iOutFile.Write(text); |
|
785 iOutFile.Write(aData8); |
|
786 */ |
|
787 iResult.ApplicationsInUseResult = ETrue; |
|
788 } |
|
789 else if ( aData8.Compare(KFalseValue) == KErrNone ) |
|
790 { |
|
791 /* |
|
792 TBuf8<KGenericBufferSize> text; |
|
793 text.Format(_L8 ("\015\012The Input value of the DisplayApplicationsInUseL : ")); |
|
794 iOutFile.Write(text); |
|
795 iOutFile.Write(aData8); |
|
796 */ |
|
797 iResult.ApplicationsInUseResult = EFalse; |
|
798 } |
|
799 } |
|
800 break; |
|
801 case EDisplayQuestion: |
|
802 if ( iLevel2 == EReturn ) |
|
803 { |
|
804 if ( aData8.Compare(KTrueValue) == KErrNone ) |
|
805 { |
|
806 /* |
|
807 TBuf8<KGenericBufferSize> text; |
|
808 text.Format(_L8 ("\015\012The Input value of the DisplayQuestionL : ")); |
|
809 iOutFile.Write(text); |
|
810 iOutFile.Write(aData8); |
|
811 */ |
|
812 iResult.QuestionResult = ETrue; |
|
813 } |
|
814 else if ( aData8.Compare(KFalseValue) == KErrNone ) |
|
815 { |
|
816 /* |
|
817 TBuf8<KGenericBufferSize> text; |
|
818 text.Format(_L8 ("\015\012The Input value of the DisplayQuestionL : ")); |
|
819 iOutFile.Write(text); |
|
820 iOutFile.Write(aData8); |
|
821 */ |
|
822 iResult.QuestionResult = EFalse; |
|
823 } |
|
824 } |
|
825 break; |
|
826 case EDisplayMissingDependency: |
|
827 if (iLevel2 == EReturn) |
|
828 { |
|
829 if (aData8.Compare(KTrueValue)==KErrNone) |
|
830 { |
|
831 INFO_PRINTF1(_L("DisplayMissingDependencyL will return ETrue")); |
|
832 iResult.MissingDependencyResult = ETrue; |
|
833 } |
|
834 else if ( aData8.Compare(KFalseValue) == KErrNone ) |
|
835 { |
|
836 INFO_PRINTF1(_L("DisplayMissingDependencyL will return EFalse")); |
|
837 iResult.MissingDependencyResult = EFalse; |
|
838 } |
|
839 } |
|
840 break; |
|
841 default: |
|
842 break; |
|
843 } |
|
844 } |
|
845 |
|
846 void CRebuildingContentHandler::OnStartPrefixMappingL(const RString& /*aPrefix*/, |
|
847 const RString& /*aUri*/, TInt aErrorCode) |
|
848 { |
|
849 User::LeaveIfError(aErrorCode); |
|
850 } |
|
851 |
|
852 void CRebuildingContentHandler::OnEndPrefixMappingL(const RString& /*aPrefix*/, |
|
853 TInt aErrorCode) |
|
854 { |
|
855 User::LeaveIfError(aErrorCode); |
|
856 } |
|
857 |
|
858 void CRebuildingContentHandler::OnIgnorableWhiteSpaceL(const TDesC8& /*aBytes*/, |
|
859 TInt /*aErrorCode*/) |
|
860 { |
|
861 } |
|
862 |
|
863 void CRebuildingContentHandler::OnSkippedEntityL(const RString& /*aName*/, |
|
864 TInt /*aErrorCode*/) |
|
865 { |
|
866 } |
|
867 |
|
868 void CRebuildingContentHandler::OnProcessingInstructionL(const TDesC8& /*aTarget8*/, |
|
869 const TDesC8& /*aData8*/, TInt aErrorCode) |
|
870 { |
|
871 User::LeaveIfError(aErrorCode); |
|
872 } |
|
873 |
|
874 void CRebuildingContentHandler::OnExtensionL(const RString& /*aData*/, |
|
875 TInt /*aToken*/, TInt /*aErrorCode*/) |
|
876 { |
|
877 /* |
|
878 _LIT(KUnsupportedFeature,"Illegal call to TRebuildingContentHandler:: \ |
|
879 OnExtensionL - aborting\n"); |
|
880 test.Panic(KErrNotSupported, KUnsupportedFeature); |
|
881 */ |
|
882 } |
|
883 |
|
884 void CRebuildingContentHandler::OnOutOfData() |
|
885 { |
|
886 //_LIT(KUnexpectedOutOfData,"Unexpected call to OnOutOfData - aborting\n"); |
|
887 } |
|
888 |
|
889 void CRebuildingContentHandler::OnError(TInt aError) |
|
890 { |
|
891 iError = aError; |
|
892 // test.Printf(_L("TRebuildingContentHandler::OnError - ERROR: code=%d - \ |
|
893 // Aborting parsing process\n"), aError); |
|
894 } |
|
895 |
|
896 TAny* CRebuildingContentHandler::GetExtendedInterface(const TInt32) |
|
897 { |
|
898 return NULL; |
|
899 } |
|
900 |
|
901 |
|
902 TXmlFileData& CRebuildingContentHandler::GetOptions() |
|
903 { |
|
904 return iResult; |
|
905 } |
|
906 |
|
907 // CUISCriptAdaptor functions |
|
908 void CUIScriptAdaptor::DialogReached() |
|
909 { |
|
910 |
|
911 if ((iDialogDelay.Int() != 0) && |
|
912 (iDelayDialogNumber < 0 || iDelayDialogNumber == iCurrentDialogNumber)) |
|
913 { |
|
914 // We need to make sure that (un)installation is not too quick, |
|
915 // otherwise the async cancel tests will fail. |
|
916 User::After(iDialogDelay); |
|
917 } |
|
918 |
|
919 if ((iCurrentDialogNumber++ == iCancelDialogNumber) && |
|
920 (iDialogCancelType == ECancelFromDialog || |
|
921 iDialogCancelType == ECancelAfterDialog)) |
|
922 { |
|
923 iInstallationCancelled=ETrue; |
|
924 // Cancel the installation |
|
925 |
|
926 if (iDialogCancelType == ECancelFromDialog) |
|
927 { |
|
928 if(iCancelHandler) |
|
929 { |
|
930 INFO_PRINTF1(_L("Canceling via CancellableInstallEvent callback")); |
|
931 iCancelHandler->HandleCancel(); |
|
932 } |
|
933 else |
|
934 { |
|
935 INFO_PRINTF1(_L("Cancelling via static Cancel API")); |
|
936 Launcher::Cancel(); |
|
937 } |
|
938 } |
|
939 else |
|
940 { |
|
941 // Cancelling after a dialog is done for the async install |
|
942 // and uninstall steps. Stopping the active scheduler will let |
|
943 // CSwisAsyncStep::RunOperation start a cancel delay timer, and |
|
944 // the cancel will actually be invoked when the timer expires. |
|
945 // The install or uninstall will carry on until this happens. |
|
946 INFO_PRINTF1(_L("Calling CActiveScheduler::Stop()")); |
|
947 CActiveScheduler::Stop(); |
|
948 } |
|
949 } |
|
950 |
|
951 if (iCurrentDialogNumber > iCancelDialogNumber && |
|
952 (iDialogCancelType == ECancelFromDialog || |
|
953 iDialogCancelType == ECancelAfterDialog)) |
|
954 { |
|
955 ERR_PRINTF3(_L("Reached an unexpected dialog. Dialogs expected: %d, dialog reached: %d"), iCancelDialogNumber, iCurrentDialogNumber); |
|
956 } |
|
957 } |
|
958 |
|
959 |
|
960 void CUIScriptAdaptor::DisplayAppInfo(const TDesC& aPreText, const CAppInfo& aAppInfo) |
|
961 { |
|
962 INFO_PRINTF7(_L("\t%S {\"%S\", \"%S\", V%u.%u.%u}"), |
|
963 &aPreText, |
|
964 &aAppInfo.AppName(), &aAppInfo.AppVendor(), |
|
965 aAppInfo.AppVersion().iMajor, |
|
966 aAppInfo.AppVersion().iMinor, |
|
967 aAppInfo.AppVersion().iBuild); |
|
968 } |
|
969 |
|
970 void CUIScriptAdaptor::DisplayBoolReturn(TBool aReturn) |
|
971 { |
|
972 _LIT(KTrue, "True"); |
|
973 _LIT(KFalse, "False"); |
|
974 INFO_PRINTF2(_L("\tReturning %S"), aReturn ? &KTrue : &KFalse); |
|
975 } |
|
976 |
|
977 void CUIScriptAdaptor::DisplayIntReturn(TInt aReturn) |
|
978 { |
|
979 INFO_PRINTF2(_L("\tReturning %d"), aReturn); |
|
980 } |
|
981 |
|
982 void CUIScriptAdaptor::CheckFinalProgressBarL() |
|
983 { |
|
984 if (iProgressBarCurrent != iProgressBarFinal) |
|
985 { |
|
986 INFO_PRINTF3(_L("\tProgress for installation not finished %d out of %d"), iProgressBarCurrent, iProgressBarFinal); |
|
987 User::Leave(KErrAbort); |
|
988 } |
|
989 } |
|
990 |
|
991 void CUIScriptAdaptor::CheckExpectedAndCalculatedInstallSizesL(const TDesC& aAppInfoName, TInt64 aSize) |
|
992 { |
|
993 TInt i=0; |
|
994 TBool foundExpectedInstallSize = EFalse; |
|
995 |
|
996 RArray<TTableOfInstallSizes> arrayOfExpectedValues = *iExpectedValue; |
|
997 |
|
998 while ((!foundExpectedInstallSize) && (i<arrayOfExpectedValues.Count())) |
|
999 { |
|
1000 if (arrayOfExpectedValues[i].iPkgFileName == aAppInfoName) |
|
1001 { |
|
1002 if (arrayOfExpectedValues[i].iInstallSize != aSize) |
|
1003 { |
|
1004 INFO_PRINTF3(_L("\tThe calculated install size (%D bytes) does not match the expected install size (%D bytes)."), |
|
1005 I64LOW(aSize), arrayOfExpectedValues[i].iInstallSize); |
|
1006 User::Leave(KErrAbort); |
|
1007 } |
|
1008 else |
|
1009 { |
|
1010 INFO_PRINTF2(_L("\tSize (calculated value matches expected value): %D bytes."), I64LOW(aSize)); |
|
1011 foundExpectedInstallSize = ETrue; |
|
1012 } |
|
1013 } |
|
1014 else |
|
1015 { |
|
1016 i = i + 1; |
|
1017 } |
|
1018 } |
|
1019 if (!foundExpectedInstallSize) |
|
1020 { |
|
1021 INFO_PRINTF2(_L("\tThe calculated install size (%D bytes) does not match any of the expected install sizes."), |
|
1022 I64LOW(aSize)); |
|
1023 User::Leave(KErrAbort); |
|
1024 } |
|
1025 } |
|
1026 |
|
1027 |
|
1028 // |
|
1029 // Implementation for the virtual functions for the MUiHandler class. |
|
1030 // |
|
1031 |
|
1032 /** |
|
1033 * Displays Install dialog and logs all incoming information. |
|
1034 * |
|
1035 * @param aAppInfo Application information. |
|
1036 * @param aLogo Optional bitmap logo. |
|
1037 * @param aCertificates Array of end-entity certificates (can be empty). |
|
1038 * |
|
1039 * @return A value from script: \b ETrue to continue, \b EFalse to abort |
|
1040 * installation. |
|
1041 */ |
|
1042 TBool CUIScriptAdaptor::DisplayInstallL(const CAppInfo& aAppInfo, |
|
1043 const CApaMaskedBitmap* aLogo, |
|
1044 const RPointerArray<CCertificateInfo>& aCertificates) |
|
1045 { |
|
1046 INFO_PRINTF1(_L("DisplayInstallL():")); |
|
1047 DisplayAppInfo(_L("AppInfo:"), aAppInfo); |
|
1048 TInt bootMode = 0; |
|
1049 User::LeaveIfError(RProperty::Get(KUidSystemCategory, KSystemStartupModeKey, bootMode)); |
|
1050 (void) aLogo; |
|
1051 if (aCertificates.Count()) |
|
1052 { |
|
1053 INFO_PRINTF2(_L("\tCertificate(s): %u"),aCertificates.Count()); |
|
1054 for (TInt i=0; i<aCertificates.Count(); i++) |
|
1055 { |
|
1056 INFO_PRINTF4(_L("\t[%02u] Subj: \"%S\", Issuer: \"%S\""),i, |
|
1057 &aCertificates[i]->SubjectName(), |
|
1058 &aCertificates[i]->IssuerName()); |
|
1059 |
|
1060 TTime validFrom(aCertificates[i]->ValidFrom()); |
|
1061 TTime validTo(aCertificates[i]->ValidTo()); |
|
1062 TBuf<KMaxLongDateFormatSpec> validFromBuf, validToBuf; |
|
1063 validFrom.FormatL(validFromBuf, TLongDateFormatSpec()); |
|
1064 validTo.FormatL(validToBuf, TLongDateFormatSpec()); |
|
1065 INFO_PRINTF3(_L("\t ValidFrom: \"%S\", ValidTo: \"%S\""), |
|
1066 &validFromBuf, &validToBuf); |
|
1067 } |
|
1068 } |
|
1069 |
|
1070 LeaveError(KDisplayInstall1); |
|
1071 DialogReached(); |
|
1072 DisplayBoolReturn(iResult.InstallResult); |
|
1073 return iResult.InstallResult; |
|
1074 } |
|
1075 |
|
1076 TBool CUIScriptAdaptor::DisplayGrantCapabilitiesL(const CAppInfo& aAppInfo, |
|
1077 const TCapabilitySet& aCapabilitySet) |
|
1078 { |
|
1079 iGrantUserCapsDialogCalled=ETrue; |
|
1080 |
|
1081 INFO_PRINTF1(_L("DisplayGrantCapabilitiesL():")); |
|
1082 DisplayAppInfo(_L("AppInfo:"), aAppInfo); |
|
1083 |
|
1084 // Build requested capabilities string. |
|
1085 const TInt KMaxBufSize=512; // should be enough for all capability names |
|
1086 const TInt KMaxCapName=64; // should be enough for one capability name |
|
1087 _LIT(KSpace," "); |
|
1088 HBufC* buf=HBufC::NewLC(KMaxBufSize); |
|
1089 TPtr p=buf->Des(); |
|
1090 TInt capsAppended=0; |
|
1091 TBuf8<KMaxCapName> capName8; |
|
1092 TBuf<KMaxCapName> capName; |
|
1093 |
|
1094 for (TInt i=0; i<ECapability_HardLimit; i++) |
|
1095 { |
|
1096 if (aCapabilitySet.HasCapability(static_cast<TCapability>(i))) |
|
1097 { |
|
1098 if (capsAppended) |
|
1099 p.Append(KSpace); |
|
1100 capName8=reinterpret_cast<const TUint8*>(CapabilityNames[i]); |
|
1101 capName.Copy(capName8); |
|
1102 p.Append(capName); |
|
1103 capsAppended++; |
|
1104 } |
|
1105 } |
|
1106 |
|
1107 INFO_PRINTF2(_L("\tRequesting capabilities: %S"),&p); |
|
1108 CleanupStack::PopAndDestroy(buf); |
|
1109 |
|
1110 DialogReached(); |
|
1111 DisplayBoolReturn(iResult.CapabilitiesResult); |
|
1112 return iResult.CapabilitiesResult; |
|
1113 } |
|
1114 |
|
1115 |
|
1116 TInt CUIScriptAdaptor::DisplayLanguageL(const CAppInfo& aAppInfo, |
|
1117 const RArray<TLanguage>& aLanguages) |
|
1118 { |
|
1119 INFO_PRINTF1(_L("DisplayLanguageL():")); |
|
1120 DisplayAppInfo(_L("AppInfo:"), aAppInfo); |
|
1121 |
|
1122 HBufC* languages=HBufC::NewLC(1024); |
|
1123 TPtr pLanguages(languages->Des()); |
|
1124 |
|
1125 for (TInt i=0; i < aLanguages.Count();) |
|
1126 { |
|
1127 pLanguages.AppendFormat(_L("%S"), &KLanguageTable[aLanguages[i]]); |
|
1128 if (++i >= aLanguages.Count()) |
|
1129 break; |
|
1130 pLanguages.Append(_L(", ")); |
|
1131 } |
|
1132 INFO_PRINTF2(_L("\tLanguages: %S"), &pLanguages); |
|
1133 CleanupStack::PopAndDestroy(languages); |
|
1134 |
|
1135 LeaveError(KDisplayLanguage1); |
|
1136 DialogReached(); |
|
1137 DisplayIntReturn(iResult.LanguagesResult); |
|
1138 return iResult.LanguagesResult; |
|
1139 } |
|
1140 |
|
1141 |
|
1142 TInt CUIScriptAdaptor::DisplayDriveL(const CAppInfo& aAppInfo, |
|
1143 TInt64 aSize,const RArray<TChar>& aDriveLetters, |
|
1144 const RArray<TInt64>& aDriveSpaces) |
|
1145 { |
|
1146 iDisplayDriveDialogCalled = ETrue; |
|
1147 INFO_PRINTF1(_L("DisplayDriveL():")); |
|
1148 DisplayAppInfo(_L("AppInfo:"), aAppInfo); |
|
1149 |
|
1150 HBufC* drives=HBufC::NewLC(1024); |
|
1151 TPtr pDrives(drives->Des()); |
|
1152 TInt letter; |
|
1153 for (TInt i=0; i < aDriveLetters.Count();) |
|
1154 { |
|
1155 letter = aDriveLetters[i]; |
|
1156 pDrives.AppendFormat(_L("%c"),letter); |
|
1157 pDrives.AppendFormat(_L(" (%U bytes)"), I64LOW(aDriveSpaces[i])); |
|
1158 if (++i >= aDriveLetters.Count()) |
|
1159 break; |
|
1160 pDrives.Append(_L(", ")); |
|
1161 } |
|
1162 INFO_PRINTF2(_L("\tDrives: %S"), &pDrives); |
|
1163 CleanupStack::PopAndDestroy(drives); |
|
1164 |
|
1165 // If the test case contains information about expected install sizes, |
|
1166 // then compare them against the calculated install size. Otherwise, |
|
1167 // just print out the calculated install size. |
|
1168 if (iExpectedValue != NULL) |
|
1169 { |
|
1170 CheckExpectedAndCalculatedInstallSizesL(aAppInfo.AppName(), aSize); |
|
1171 } |
|
1172 else |
|
1173 { |
|
1174 INFO_PRINTF2(_L("\tSize: %d"), I64LOW(aSize)); |
|
1175 } |
|
1176 |
|
1177 LeaveError(KDisplayDrive1); |
|
1178 DialogReached(); |
|
1179 |
|
1180 // Drive result is the drive we want to return so we need to go through the list |
|
1181 // looking for it |
|
1182 for (TInt i=0; i < aDriveLetters.Count() ; ++i) |
|
1183 { |
|
1184 if (TChar(iResult.DriveResult+'a') == TChar(aDriveLetters[i]).GetLowerCase()) |
|
1185 { |
|
1186 DisplayIntReturn(i); |
|
1187 return i; |
|
1188 } |
|
1189 } |
|
1190 |
|
1191 DisplayIntReturn(-1); |
|
1192 return -1; // Could not find drive we want, cancelling installation |
|
1193 } |
|
1194 |
|
1195 |
|
1196 TBool CUIScriptAdaptor::DisplayUpgradeL(const CAppInfo& aAppInfo, |
|
1197 const CAppInfo& aExistingAppInfo) |
|
1198 { |
|
1199 INFO_PRINTF1(_L("DisplayUpgradeL():")); |
|
1200 DisplayAppInfo(_L("From App:"), aExistingAppInfo); |
|
1201 DisplayAppInfo(_L("To App:"), aAppInfo); |
|
1202 LeaveError(KDisplayUpgrade1); |
|
1203 DialogReached(); |
|
1204 DisplayBoolReturn(iResult.UpgradeResult); |
|
1205 return iResult.UpgradeResult; |
|
1206 } |
|
1207 |
|
1208 TBool CUIScriptAdaptor::DisplayOptionsL(const CAppInfo& aAppInfo, |
|
1209 const RPointerArray<TDesC>& aOptions, |
|
1210 RArray<TBool>& aSelections) |
|
1211 { |
|
1212 INFO_PRINTF1(_L("DisplayOptionsL():")); |
|
1213 DisplayAppInfo(_L("AppInfo:"), aAppInfo); |
|
1214 |
|
1215 HBufC* options=HBufC::NewLC(4096); |
|
1216 TPtr pOptions(options->Des()); |
|
1217 |
|
1218 for (TInt i=0; i < aOptions.Count();) |
|
1219 { |
|
1220 pOptions.AppendFormat(_L("%S"), aOptions[i]); |
|
1221 |
|
1222 if (i >= iResult.OptionSelection.Count()) |
|
1223 { |
|
1224 pOptions.Append(_L(" (?)")); |
|
1225 } |
|
1226 else if (iResult.OptionSelection[i]) |
|
1227 { |
|
1228 pOptions.Append(_L(" (*)")); |
|
1229 } |
|
1230 else |
|
1231 { |
|
1232 pOptions.Append(_L(" ( )")); |
|
1233 } |
|
1234 |
|
1235 if (++i >= aOptions.Count()) |
|
1236 break; |
|
1237 pOptions.Append(_L(", ")); |
|
1238 } |
|
1239 INFO_PRINTF2(_L("\tOptions: %S"), &pOptions); |
|
1240 CleanupStack::PopAndDestroy(options); |
|
1241 |
|
1242 TInt count = iResult.OptionSelection.Count(); |
|
1243 for (TInt index=0; index < count; index++) |
|
1244 { |
|
1245 aSelections[index]=iResult.OptionSelection[index]; |
|
1246 } |
|
1247 LeaveError(KDisplayOptions1); |
|
1248 DialogReached(); |
|
1249 DisplayBoolReturn(iResult.OptionsResult); |
|
1250 return iResult.OptionsResult; |
|
1251 } |
|
1252 |
|
1253 TBool CUIScriptAdaptor::HandleInstallEventL( |
|
1254 const CAppInfo& aAppInfo, |
|
1255 TInstallEvent aEvent, |
|
1256 TInt aValue, |
|
1257 const TDesC& aDes) |
|
1258 { |
|
1259 INFO_PRINTF1(_L("HandleInstallEventL")); |
|
1260 DisplayAppInfo(_L("AppInfo:"), aAppInfo); |
|
1261 |
|
1262 TBool ret(ETrue); |
|
1263 // update progress |
|
1264 // We shouldn't cancel on the last dialog, since installation/uninstallation has |
|
1265 // finished, and the tests will fail due to cancellation being flagged, but the |
|
1266 // installation/uninstallation completing with no error, as expected. |
|
1267 switch (aEvent) |
|
1268 { |
|
1269 case EEventSetProgressBarFinalValue: |
|
1270 INFO_PRINTF2(_L("\tEvent:\tEEventSetProgressBarFinalValue %d"), aValue); |
|
1271 |
|
1272 // Keep track of progress bar values |
|
1273 iProgressBarFinal=aValue; |
|
1274 iProgressBarCurrent=0; |
|
1275 LeaveError(KInstallEvenDialogSetProgressBar); |
|
1276 DialogReached(); |
|
1277 ret = iResult.ProgressBarFinalValueResult; |
|
1278 break; |
|
1279 |
|
1280 case EEventUpdateProgressBar: |
|
1281 // Keep track of progress bar values |
|
1282 iProgressBarCurrent+=aValue; |
|
1283 INFO_PRINTF4(_L("\tEvent:\tEEventUpdateProgressBar %d - %d/%d"), aValue, iProgressBarCurrent, iProgressBarFinal); |
|
1284 LeaveError(KInstallEvenDialogUpdateProgressBar); |
|
1285 DialogReached(); |
|
1286 ret = iResult.UpdateProgressBarResult; |
|
1287 break; |
|
1288 |
|
1289 case EEventAbortedInstall: |
|
1290 INFO_PRINTF1(_L("\tEvent:\tEEventAbortedInstall")); |
|
1291 break; |
|
1292 |
|
1293 case EEventCompletedInstall: |
|
1294 INFO_PRINTF1(_L("\tEvent:\tEEventCompletedInstall")); |
|
1295 LeaveError(KInstallEvenDialogCompletedInstall); |
|
1296 CheckFinalProgressBarL(); |
|
1297 break; |
|
1298 |
|
1299 case EEventOcspCheckEnd: |
|
1300 INFO_PRINTF1(_L("\tEvent:\tEEventOcspCheckEnd")); |
|
1301 LeaveError(KInstallEvenDialogOcspCheckEnd); |
|
1302 DialogReached(); |
|
1303 break; |
|
1304 |
|
1305 case EEventCompletedNoMessage: |
|
1306 INFO_PRINTF1(_L("\tEvent:\tEEventCompletedNoMessage")); |
|
1307 break; |
|
1308 |
|
1309 case EEventAbortedUnInstall: |
|
1310 INFO_PRINTF1(_L("\tEvent:\tEEventAbortedUnInstall")); |
|
1311 break; |
|
1312 |
|
1313 case EEventCompletedUnInstall: |
|
1314 INFO_PRINTF1(_L("\tEvent:\tEEventCompletedUnInstall")); |
|
1315 LeaveError(KInstallEvenDialogCompletedUnInstall); |
|
1316 CheckFinalProgressBarL(); |
|
1317 break; |
|
1318 |
|
1319 case EEventLeave: |
|
1320 INFO_PRINTF2(_L("\tEvent:\tEEventLeave %d"), aValue); |
|
1321 INFO_PRINTF1(_L("\tEvent:\tEEventCompletedUnInstall")); |
|
1322 DialogReached(); |
|
1323 break; |
|
1324 |
|
1325 case EEventDevCert: |
|
1326 INFO_PRINTF2(_L("\tEvent:\tEEventDevCert %S"), &aDes); |
|
1327 LeaveError(KInstallEvenDevCert); |
|
1328 DialogReached(); |
|
1329 ret=iResult.DevCertsResult; |
|
1330 break; |
|
1331 |
|
1332 default: |
|
1333 INFO_PRINTF4(_L("\tResult:\tUnknown (%d) Value: %d Des %S"), aEvent, aValue, &aDes); |
|
1334 ASSERT(false); |
|
1335 } |
|
1336 |
|
1337 return ret; |
|
1338 } |
|
1339 |
|
1340 void CUIScriptAdaptor::HandleCancellableInstallEventL( |
|
1341 const CAppInfo& aAppInfo, |
|
1342 TInstallCancellableEvent aEvent, |
|
1343 MCancelHandler& aCancelHandler, |
|
1344 TInt aValue, |
|
1345 const TDesC& aDes) |
|
1346 { |
|
1347 iCancelHandler = &aCancelHandler; |
|
1348 |
|
1349 INFO_PRINTF1(_L("HandleCancellableInstallEventL")); |
|
1350 DisplayAppInfo(_L("AppInfo:"), aAppInfo); |
|
1351 |
|
1352 switch (aEvent) |
|
1353 { |
|
1354 case EEventRemovingFiles: |
|
1355 INFO_PRINTF1(_L("\tEvent:\tEEventRemovingFiles")); |
|
1356 LeaveError(KCancelInstallRemoving); |
|
1357 break; |
|
1358 case EEventShuttingDownApps: |
|
1359 INFO_PRINTF1(_L("\tEvent:\tEEventShuttingDownApps")); |
|
1360 LeaveError(KCancelInstallShuttingDown); |
|
1361 break; |
|
1362 case EEventCopyingFiles: |
|
1363 INFO_PRINTF1(_L("\tEvent:\tEEventCopyingFiles")); |
|
1364 LeaveError(KCancelInstallCopyingFiles); |
|
1365 break; |
|
1366 case EEventOcspCheckStart: |
|
1367 INFO_PRINTF1(_L("\tEvent:\tEEventOcspCheckStart")); |
|
1368 LeaveError(KCancelInstallOcspCheckStart); |
|
1369 break; |
|
1370 |
|
1371 default: |
|
1372 INFO_PRINTF4(_L("\tEvent:\tUnknown (%d) Value: %d Des %S"), aEvent, aValue, &aDes); |
|
1373 } |
|
1374 DialogReached(); |
|
1375 } |
|
1376 |
|
1377 TBool CUIScriptAdaptor::DisplaySecurityWarningL( |
|
1378 const CAppInfo& aAppInfo, |
|
1379 TSignatureValidationResult aSigValidationResult, |
|
1380 RPointerArray<CPKIXValidationResultBase>& /*aPkixResults*/, |
|
1381 RPointerArray<CCertificateInfo>& /*aCertificates*/, |
|
1382 TBool aInstallAnyway) |
|
1383 { |
|
1384 _LIT(KTrue, "True"); |
|
1385 _LIT(KFalse, "False"); |
|
1386 |
|
1387 INFO_PRINTF1(_L("DisplaySecurityWarningL():")); |
|
1388 DisplayAppInfo(_L("AppInfo:"), aAppInfo); |
|
1389 |
|
1390 switch (aSigValidationResult) |
|
1391 { |
|
1392 case EValidationSucceeded: |
|
1393 INFO_PRINTF1(_L("\tResult:\tEValidationSucceeded")); |
|
1394 break; |
|
1395 case ESignatureSelfSigned: |
|
1396 INFO_PRINTF1(_L("\tResult:\tESignatureSelfSigned")); |
|
1397 break; |
|
1398 case ENoCertificate: |
|
1399 INFO_PRINTF1(_L("\tResult:\tENoCertificate")); |
|
1400 break; |
|
1401 case ECertificateValidationError: |
|
1402 INFO_PRINTF1(_L("\tResult:\tECertificateValidationError")); |
|
1403 break; |
|
1404 case ESignatureNotPresent: |
|
1405 INFO_PRINTF1(_L("\tResult:\tESignatureNotPresent")); |
|
1406 break; |
|
1407 case ESignatureCouldNotBeValidated: |
|
1408 INFO_PRINTF1(_L("\tResult:\tESignatureCouldNotBeValidated")); |
|
1409 break; |
|
1410 case ENoCodeSigningExtension: |
|
1411 INFO_PRINTF1(_L("\tResult:\tENoCodeSigningExtension")); |
|
1412 break; |
|
1413 case ENoSupportedPolicyExtension: |
|
1414 INFO_PRINTF1(_L("\tResult:\tENoSupportedPolicyExtension")); |
|
1415 break; |
|
1416 case EMandatorySignatureMissing: |
|
1417 INFO_PRINTF1(_L("\tResult:\tEMandatorySignatureMissing")); |
|
1418 break; |
|
1419 default: |
|
1420 INFO_PRINTF2(_L("\tResult:\tUnknown (%d)"), aSigValidationResult); |
|
1421 break; |
|
1422 }; |
|
1423 |
|
1424 LeaveError(KDisplaySecurityWarning1); |
|
1425 DialogReached(); |
|
1426 |
|
1427 ++iSecurityWarningDialogsInvoked; |
|
1428 |
|
1429 INFO_PRINTF3( |
|
1430 _L("\tReturning %S (override possible: %S)"), |
|
1431 iResult.WarningResult ? &KTrue : &KFalse, |
|
1432 aInstallAnyway ? &KTrue : &KFalse); |
|
1433 return iResult.WarningResult; |
|
1434 } |
|
1435 |
|
1436 TBool CUIScriptAdaptor::DisplayOcspResultL(const CAppInfo& aAppInfo, |
|
1437 TRevocationDialogMessage aMessage, |
|
1438 RPointerArray<TOCSPOutcome>& aOutcomes, |
|
1439 RPointerArray<CCertificateInfo>& aCertificates, |
|
1440 TBool aWarningOnly) |
|
1441 { |
|
1442 INFO_PRINTF1(_L("DisplayOcspResultL():")); |
|
1443 INFO_PRINTF6(_L("\t App: { \"%S\" \"%S\" V%u.%u.%u }"),&aAppInfo.AppName(), |
|
1444 &aAppInfo.AppVendor(),aAppInfo.AppVersion().iMajor, |
|
1445 aAppInfo.AppVersion().iMinor,aAppInfo.AppVersion().iBuild); |
|
1446 INFO_PRINTF2(_L("\t Msg: %u"),aMessage); |
|
1447 TInt numCerts=aCertificates.Count(); |
|
1448 TInt numOutcomes=aOutcomes.Count(); |
|
1449 INFO_PRINTF3(_L("\tCerts: %u, outcomes: %u"),numCerts,numOutcomes); |
|
1450 |
|
1451 if (numCerts != numOutcomes) |
|
1452 { |
|
1453 ERR_PRINTF1(_L("\tMismatched certs and outcomes arrays!")); |
|
1454 User::Leave(KErrArgument); |
|
1455 } |
|
1456 |
|
1457 for (TInt i=0; i<numCerts; i++) |
|
1458 { |
|
1459 INFO_PRINTF3(_L("\t Cert: [%u] DN = \"%S\""), i, |
|
1460 &aCertificates[i]->SubjectName()); |
|
1461 } |
|
1462 |
|
1463 iObservedOcspOutcomes.ResetAndDestroy(); |
|
1464 for (TInt i=0; i<numOutcomes; i++) |
|
1465 { |
|
1466 INFO_PRINTF4(_L("\t outcome[%u] = {%d, %d}"), |
|
1467 i, |
|
1468 aOutcomes[i]->iStatus, |
|
1469 aOutcomes[i]->iResult); |
|
1470 TOCSPOutcome* outcome = new(ELeave) TOCSPOutcome(*aOutcomes[i]); |
|
1471 CleanupStack::PushL(outcome); |
|
1472 iObservedOcspOutcomes.AppendL(outcome); |
|
1473 CleanupStack::Pop(outcome); |
|
1474 } |
|
1475 |
|
1476 _LIT(KYes,"Yes"); |
|
1477 _LIT(KNo,"No"); |
|
1478 INFO_PRINTF2(_L("\tFatal: %S"), aWarningOnly ? &KNo : &KYes); |
|
1479 |
|
1480 if (! aWarningOnly) |
|
1481 { |
|
1482 iFatalOcspResponseEncountered = ETrue; |
|
1483 } |
|
1484 |
|
1485 LeaveError(KDisplayOcspResult1); |
|
1486 DialogReached(); |
|
1487 DisplayBoolReturn(iResult.OcspResult); |
|
1488 return iResult.OcspResult; |
|
1489 } |
|
1490 |
|
1491 void CUIScriptAdaptor::DisplayCannotOverwriteFileL(const CAppInfo& aAppInfo, |
|
1492 const CAppInfo& aInstalledAppInfo, |
|
1493 const TDesC& aFileName) |
|
1494 { |
|
1495 iCannotOverwriteFileDialogCalled = ETrue; |
|
1496 iFileOwner = aInstalledAppInfo.AppName().AllocL(); |
|
1497 INFO_PRINTF1(_L("DisplayCannotOverwriteFileL():")); |
|
1498 DisplayAppInfo(_L("AppInfo:"), aAppInfo); |
|
1499 |
|
1500 INFO_PRINTF2(_L("\tFile : %S"), &aFileName); |
|
1501 LeaveError(KDisplayCannotOverwriteFile1); |
|
1502 DisplayAppInfo(_L("From App:"), aInstalledAppInfo); |
|
1503 DialogReached(); |
|
1504 } |
|
1505 |
|
1506 TBool CUIScriptAdaptor::DisplayUninstallL(const CAppInfo& aAppInfo) |
|
1507 { |
|
1508 INFO_PRINTF1(_L("DisplayUninstallL():")); |
|
1509 DisplayAppInfo(_L("AppInfo:"), aAppInfo); |
|
1510 LeaveError(KDisplayUninstall1); |
|
1511 DialogReached(); |
|
1512 DisplayBoolReturn(iResult.UninstallResult); |
|
1513 return iResult.UninstallResult; |
|
1514 } |
|
1515 |
|
1516 TBool CUIScriptAdaptor::DisplayTextL(const CAppInfo& aAppInfo, |
|
1517 TFileTextOption aOption, const TDesC& aText) |
|
1518 { |
|
1519 INFO_PRINTF1(_L("DisplayTextL():")); |
|
1520 DisplayAppInfo(_L("AppInfo:"), aAppInfo); |
|
1521 |
|
1522 switch (aOption) |
|
1523 { |
|
1524 case EInstFileTextOptionContinue: |
|
1525 INFO_PRINTF1(_L("\tOption:\tEInstFileTextOptionContinue")); |
|
1526 break; |
|
1527 case EInstFileTextOptionSkipOneIfNo: |
|
1528 INFO_PRINTF1(_L("\tOption:\tEInstFileTextOptionSkipOneIfNo")); |
|
1529 break; |
|
1530 case EInstFileTextOptionAbortIfNo: |
|
1531 INFO_PRINTF1(_L("\tOption:\tEInstFileTextOptionAbortIfNo")); |
|
1532 break; |
|
1533 case EInstFileTextOptionExitIfNo: |
|
1534 INFO_PRINTF1(_L("\tOption:\tEInstFileTextOptionExitIfNo")); |
|
1535 break; |
|
1536 |
|
1537 default: |
|
1538 INFO_PRINTF2(_L("Option: Unknown (%d)"), aOption); |
|
1539 } |
|
1540 |
|
1541 INFO_PRINTF2(_L("Text: \"%S\""), &aText); |
|
1542 |
|
1543 // Record the displayed text so it can be compared with the |
|
1544 // ExpectedDisplayText configuration value later |
|
1545 iDisplayedText = aText.Left(Min(KMaxDisplayText, aText.Length())); |
|
1546 iDisplayedText.TrimRight(); |
|
1547 |
|
1548 // Record the displayed text (unchanged) so it can be compared with the |
|
1549 // contents of a text file |
|
1550 iDisplayedTextActual = HBufC16::NewL(aText.Length()); |
|
1551 *iDisplayedTextActual = aText; |
|
1552 |
|
1553 LeaveError(KDisplayText1); |
|
1554 DialogReached(); |
|
1555 DisplayBoolReturn(iResult.TextResult); |
|
1556 return iResult.TextResult; |
|
1557 } |
|
1558 |
|
1559 void CUIScriptAdaptor::DisplayErrorL(const CAppInfo& aAppInfo, |
|
1560 TErrorDialog aType, const TDesC& aDes) |
|
1561 { |
|
1562 INFO_PRINTF1(_L("DisplayErrorL():")); |
|
1563 DisplayAppInfo(_L("AppInfo:"), aAppInfo); |
|
1564 |
|
1565 switch (aType) |
|
1566 { |
|
1567 case EUiAlreadyInRom: |
|
1568 INFO_PRINTF2(_L("\tError:\tEUiAlreadyInRom file=%S"), &aDes); |
|
1569 break; |
|
1570 case EUiBlockingEclipsingFile: |
|
1571 INFO_PRINTF2(_L("\tError:\tEUiBlockingEclipsingFile %S"), &aDes); |
|
1572 break; |
|
1573 case EUiMissingDependency: |
|
1574 INFO_PRINTF1(_L("\tError:\tEUiMissingDependency")); |
|
1575 break; |
|
1576 case EUiRequireVer: |
|
1577 INFO_PRINTF1(_L("\tError:\tEUiRequireVer")); |
|
1578 break; |
|
1579 case EUiRequireVerOrGreater: |
|
1580 INFO_PRINTF1(_L("\tError:\tEUiRequireVerOrGreater")); |
|
1581 break; |
|
1582 case EUiFileCorrupt: |
|
1583 INFO_PRINTF1(_L("\tError:\tEUiFileCorrupt")); |
|
1584 break; |
|
1585 case EUiDiskNotPresent: |
|
1586 INFO_PRINTF1(_L("\tError:\tEUiDiskNotPresent")); |
|
1587 break; |
|
1588 case EUiCannotRead: |
|
1589 INFO_PRINTF1(_L("\tError:\tEUiCannotRead")); |
|
1590 break; |
|
1591 case EUiCannotDelete: |
|
1592 INFO_PRINTF1(_L("\tError:\tEUiCannotDelete")); |
|
1593 break; |
|
1594 case EUiInvalidFileName: |
|
1595 INFO_PRINTF1(_L("\tError:\tEUiInvalidFileName")); |
|
1596 break; |
|
1597 case EUiFileNotFound: |
|
1598 INFO_PRINTF1(_L("\tError:\tEUiFileNotFound")); |
|
1599 break; |
|
1600 case EUiInsufficientSpaceOnDrive: |
|
1601 INFO_PRINTF1(_L("\tError:\tEUiInsufficientSpaceOnDrive")); |
|
1602 break; |
|
1603 case EUiCapabilitiesCannotBeGranted: |
|
1604 INFO_PRINTF2(_L("\tError:\tEUiCapabilitiesCannotBeGranted %S"), &aDes); |
|
1605 break; |
|
1606 case EUiUnknownFile: |
|
1607 INFO_PRINTF1(_L("\tError:\tEUiUnknownFile")); |
|
1608 break; |
|
1609 case EUiMissingBasePackage: |
|
1610 INFO_PRINTF1(_L("\tError:\tEUiMissingBasePackage")); |
|
1611 break; |
|
1612 case EUiConstraintsExceeded: |
|
1613 INFO_PRINTF1(_L("\tError:\tEUiConstraintsExceeded")); |
|
1614 break; |
|
1615 case EUiSIDViolation: |
|
1616 INFO_PRINTF1(_L("\tError:\tEUiSIDViolation")); |
|
1617 break; |
|
1618 case EUiVIDViolation: |
|
1619 INFO_PRINTF1(_L("\tError:\tEUiVIDViolation")); |
|
1620 break; |
|
1621 case EUiUIDPackageViolation: |
|
1622 INFO_PRINTF1(_L("\tError:\tEUiUIDPackageViolation")); |
|
1623 break; |
|
1624 case EUiSIDMismatch: |
|
1625 INFO_PRINTF1(_L("\tError:\tEUiSIDMismatch")); |
|
1626 break; |
|
1627 default: |
|
1628 INFO_PRINTF3(_L("\tError:\tUnknown (%d) Des %S"), aType, &aDes); |
|
1629 }; |
|
1630 |
|
1631 LeaveError(KDisplayError1); |
|
1632 DialogReached(); |
|
1633 } |
|
1634 |
|
1635 TBool CUIScriptAdaptor::DisplayDependencyBreakL(const CAppInfo& aAppInfo, |
|
1636 const RPointerArray<TDesC>& aComponents) |
|
1637 { |
|
1638 INFO_PRINTF1(_L("DisplayDependencyBreakL():")); |
|
1639 DisplayAppInfo(_L("AppInfo:"), aAppInfo); |
|
1640 |
|
1641 HBufC* components=HBufC::NewLC(1024); |
|
1642 TPtr pComponents(components->Des()); |
|
1643 |
|
1644 for (TInt i=0; i < aComponents.Count();) |
|
1645 { |
|
1646 pComponents.AppendFormat(_L("%S"), aComponents[i]); |
|
1647 if (++i >= aComponents.Count()) |
|
1648 break; |
|
1649 pComponents.Append(_L(", ")); |
|
1650 } |
|
1651 INFO_PRINTF2(_L("\tComponents: %S"), &pComponents); |
|
1652 CleanupStack::PopAndDestroy(components); |
|
1653 |
|
1654 LeaveError(KDisplayDependencyBreak1); |
|
1655 DialogReached(); |
|
1656 DisplayBoolReturn(iResult.DependencyResult); |
|
1657 return iResult.DependencyResult; |
|
1658 } |
|
1659 |
|
1660 TBool CUIScriptAdaptor::DisplayApplicationsInUseL(const CAppInfo& aAppInfo, |
|
1661 const RPointerArray<TDesC>& aAppNames) |
|
1662 { |
|
1663 INFO_PRINTF1(_L("DisplayApplicationsInUseL():")); |
|
1664 DisplayAppInfo(_L("AppInfo:"), aAppInfo); |
|
1665 |
|
1666 HBufC* applications=HBufC::NewLC(1024); |
|
1667 TPtr pApplications(applications->Des()); |
|
1668 |
|
1669 for (TInt i=0; i < aAppNames.Count();) |
|
1670 { |
|
1671 pApplications.AppendFormat(_L("%S"), aAppNames[i]); |
|
1672 if (++i >= aAppNames.Count()) |
|
1673 break; |
|
1674 pApplications.Append(_L(", ")); |
|
1675 } |
|
1676 INFO_PRINTF2(_L("\tComponents: %S"), &pApplications); |
|
1677 CleanupStack::PopAndDestroy(applications); |
|
1678 |
|
1679 LeaveError(KDisplayApplicationsInUse1); |
|
1680 DialogReached(); |
|
1681 DisplayBoolReturn(iResult.ApplicationsInUseResult); |
|
1682 return iResult.ApplicationsInUseResult; |
|
1683 } |
|
1684 |
|
1685 TBool CUIScriptAdaptor::DisplayQuestionL(const CAppInfo& aAppInfo, |
|
1686 TQuestionDialog aQuestion, const TDesC& aDes) |
|
1687 { |
|
1688 INFO_PRINTF1(_L("DisplayQuestionL():")); |
|
1689 DisplayAppInfo(_L("AppInfo:"), aAppInfo); |
|
1690 |
|
1691 switch (aQuestion) |
|
1692 { |
|
1693 case EQuestionIncompatible: |
|
1694 INFO_PRINTF1(_L("\tQuestion:\tEQuestionIncompatible")); |
|
1695 break; |
|
1696 |
|
1697 case EQuestionOverwriteFile: |
|
1698 INFO_PRINTF1(_L("\tQuestion:\tEQuestionOverwriteFile")); |
|
1699 INFO_PRINTF2(_L("\tFile Name:\t%S"), &aDes); |
|
1700 break; |
|
1701 |
|
1702 default: |
|
1703 INFO_PRINTF3(_L("\tQuestion:\tUnknown (%d) Des %S"), aQuestion, &aDes); |
|
1704 } |
|
1705 |
|
1706 LeaveError(KDisplayQuestion1); |
|
1707 DialogReached(); |
|
1708 DisplayBoolReturn(iResult.QuestionResult); |
|
1709 return iResult.QuestionResult; |
|
1710 } |
|
1711 |
|
1712 |
|
1713 TBool CUIScriptAdaptor::DisplayMissingDependencyL(const CAppInfo& aAppInfo, |
|
1714 const TDesC& aDependencyName,TVersion aWantedVersionFrom, |
|
1715 TVersion aWantedVersionTo,TVersion aInstalledVersion) |
|
1716 { |
|
1717 INFO_PRINTF1(_L("DisplayMissingDependencyL():")); |
|
1718 DisplayAppInfo(_L("AppInfo:"), aAppInfo); |
|
1719 |
|
1720 INFO_PRINTF2(_L("\tMissing dependency name: %S"),&aDependencyName); |
|
1721 INFO_PRINTF7(_L("\t Wanted version: %u.%u.%u - %u.%u.%u"), |
|
1722 aWantedVersionFrom.iMajor,aWantedVersionFrom.iMinor, |
|
1723 aWantedVersionFrom.iBuild, |
|
1724 aWantedVersionTo.iMajor,aWantedVersionTo.iMinor, |
|
1725 aWantedVersionTo.iBuild); |
|
1726 INFO_PRINTF4(_L("\t Existing version: %u.%u.%u"), |
|
1727 aInstalledVersion.iMajor,aInstalledVersion.iMinor, |
|
1728 aInstalledVersion.iBuild); |
|
1729 |
|
1730 LeaveError(KDisplayMissingDependency1); |
|
1731 DialogReached(); |
|
1732 DisplayBoolReturn(iResult.MissingDependencyResult); |
|
1733 return iResult.MissingDependencyResult; |
|
1734 } |
|
1735 void CUIScriptAdaptor::LeaveError(TInt aReason) |
|
1736 { |
|
1737 if (iExpectedDialog == aReason) |
|
1738 { |
|
1739 User::Leave(iKerrCode); |
|
1740 } |
|
1741 } |
|