|
1 /* |
|
2 * Copyright (c) 2002-2008 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 implementation of CCUIDialogs |
|
15 * class member functions. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <bautils.h> |
|
22 #include <eikenv.h> |
|
23 #include <StringLoader.h> |
|
24 #include <AknQueryDialog.h> |
|
25 #include <eikprogi.h> |
|
26 #include <aknnotewrappers.h> |
|
27 #include <data_caging_path_literals.hrh> |
|
28 #include <SWInstCommonUI.rsg> |
|
29 #include <aknmessagequerydialog.h> |
|
30 #include <hlplch.h> |
|
31 #include <csxhelp/am.hlp.hrh> |
|
32 #include <coehelp.h> |
|
33 #include <featmgr.h> |
|
34 #include <sysutil.h> |
|
35 #ifdef RD_MULTIPLE_DRIVE |
|
36 #include <driveinfo.h> |
|
37 #endif //RD_MULTIPLE_DRIVE |
|
38 #include <akninputblock.h> |
|
39 |
|
40 #include "CUIDialogs.h" |
|
41 #include "CUIDriveUtils.h" |
|
42 #include "CUIWaitDialog.h" |
|
43 #include "CUIProgressDialog.h" |
|
44 #include "CUIDetailsDialog.h" |
|
45 #include "CUIUtils.h" |
|
46 #include "SWInstPrivateUid.h" |
|
47 |
|
48 using namespace SwiUI::CommonUI; |
|
49 |
|
50 _LIT( KNextLine, "\n" ); |
|
51 _LIT( KFormat, "%d\t%S\t%S" ); |
|
52 |
|
53 // ============================ MEMBER FUNCTIONS =============================== |
|
54 |
|
55 // ----------------------------------------------------------------------------- |
|
56 // CCUIDialogs::CCUIDialogs |
|
57 // C++ default constructor can NOT contain any code, that |
|
58 // might leave. |
|
59 // ----------------------------------------------------------------------------- |
|
60 // |
|
61 CCUIDialogs::CCUIDialogs() |
|
62 { |
|
63 } |
|
64 |
|
65 // ----------------------------------------------------------------------------- |
|
66 // CCUIDialogs::ConstructL |
|
67 // Symbian 2nd phase constructor can leave. |
|
68 // ----------------------------------------------------------------------------- |
|
69 // |
|
70 void CCUIDialogs::ConstructL() |
|
71 { |
|
72 iCoeEnv = CEikonEnv::Static(); |
|
73 if ( !iCoeEnv ) |
|
74 { |
|
75 User::Leave( KErrGeneral ); |
|
76 } |
|
77 |
|
78 TFileName fileName; |
|
79 fileName.Append( KDC_RESOURCE_FILES_DIR ); |
|
80 fileName.Append( KCUIResourceFileName ); |
|
81 iResourceFileOffset = CUIUtils::LoadResourceFileL( fileName, iCoeEnv ); |
|
82 |
|
83 iAbsorber = CAknInputBlock::NewLC(); |
|
84 CleanupStack::Pop( iAbsorber ); |
|
85 |
|
86 FeatureManager::InitializeLibL(); |
|
87 } |
|
88 |
|
89 // ----------------------------------------------------------------------------- |
|
90 // CCUIDialogs::NewL |
|
91 // Two-phased constructor. |
|
92 // ----------------------------------------------------------------------------- |
|
93 // |
|
94 EXPORT_C CCUIDialogs* CCUIDialogs::NewL() |
|
95 { |
|
96 CCUIDialogs* self = new ( ELeave ) CCUIDialogs(); |
|
97 CleanupStack::PushL( self ); |
|
98 self->ConstructL(); |
|
99 CleanupStack::Pop( self ); |
|
100 return self; |
|
101 } |
|
102 |
|
103 // Destructor |
|
104 EXPORT_C CCUIDialogs::~CCUIDialogs() |
|
105 { |
|
106 // Close non-modal dialogs |
|
107 TRAP_IGNORE( CloseProgressDialogL() ); |
|
108 TRAP_IGNORE( CloseWaitDialogL() ); |
|
109 |
|
110 if( iResourceFileOffset ) |
|
111 { |
|
112 iCoeEnv->DeleteResourceFile( iResourceFileOffset ); |
|
113 } |
|
114 |
|
115 delete iAbsorber; |
|
116 |
|
117 FeatureManager::UnInitializeLib(); |
|
118 } |
|
119 |
|
120 // ----------------------------------------------------------------------------- |
|
121 // CCUIDialogs::ShowWaitDialogL |
|
122 // Show a wait dialog. |
|
123 // (other items were commented in a header). |
|
124 // ----------------------------------------------------------------------------- |
|
125 // |
|
126 EXPORT_C void CCUIDialogs::ShowWaitDialogL( TInt aResourceId, |
|
127 MCUIWaitDialogCallback* aCallback, |
|
128 TInt aSoftkeyResourceId ) |
|
129 { |
|
130 HBufC* displayString = StringLoader::LoadLC( aResourceId ); |
|
131 |
|
132 if ( iWaitDialog ) |
|
133 { |
|
134 iWaitDialog->SetTextL( *displayString ); |
|
135 SetWaitDialogCallback( aCallback ); |
|
136 } |
|
137 else |
|
138 { |
|
139 iWaitDialog = new (ELeave) CCUIWaitDialog ( reinterpret_cast |
|
140 < CEikDialog** > |
|
141 ( &iWaitDialog ), |
|
142 ETrue ); |
|
143 |
|
144 iWaitDialog->PrepareLC( R_SWCOMMON_GENERAL_WAIT_DIALOG ); |
|
145 iWaitDialog->SetTextL( *displayString ); |
|
146 SetWaitDialogCallback( aCallback ); |
|
147 iWaitDialog->ButtonGroupContainer().SetCommandSetL( aSoftkeyResourceId ); |
|
148 iWaitDialog->RunLD(); |
|
149 } |
|
150 |
|
151 CleanupStack::PopAndDestroy( displayString ); |
|
152 } |
|
153 |
|
154 // ----------------------------------------------------------------------------- |
|
155 // CCUIDialogs::CloseWaitDialogL |
|
156 // Closes the wait dialog |
|
157 // (other items were commented in a header). |
|
158 // ----------------------------------------------------------------------------- |
|
159 // |
|
160 EXPORT_C void CCUIDialogs::CloseWaitDialogL() |
|
161 { |
|
162 if ( iWaitDialog ) |
|
163 { |
|
164 // Set callback to NULL as we want no callbacks from this. |
|
165 delete iWaitDialog; |
|
166 iWaitDialog = NULL; |
|
167 } |
|
168 } |
|
169 |
|
170 // ----------------------------------------------------------------------------- |
|
171 // CCUIDialogs::ShowProgressDialog |
|
172 // Show a progress dialog. |
|
173 // (other items were commented in a header). |
|
174 // ----------------------------------------------------------------------------- |
|
175 // |
|
176 EXPORT_C void CCUIDialogs::ShowProgressDialogL( TInt aResourceId, |
|
177 MCUIWaitDialogCallback* aCallback, |
|
178 TInt aSoftkeyResourceId ) |
|
179 { |
|
180 HBufC* displayString = StringLoader::LoadLC( aResourceId ); |
|
181 ShowProgressDialogL( *displayString, aCallback, aSoftkeyResourceId ); |
|
182 CleanupStack::PopAndDestroy( displayString ); |
|
183 } |
|
184 |
|
185 EXPORT_C void CCUIDialogs::ShowProgressDialogL( const TDesC& aText, |
|
186 MCUIWaitDialogCallback* aCallback, |
|
187 TInt aSoftkeyResourceId ) |
|
188 { |
|
189 if ( iProgressDialog ) |
|
190 { |
|
191 iProgressDialog->SetTextL( aText ); |
|
192 SetProgressDialogCallback( aCallback ); |
|
193 } |
|
194 else |
|
195 { |
|
196 iProgressDialog = new (ELeave) CCUIProgressDialog ( reinterpret_cast |
|
197 < CEikDialog** > |
|
198 ( &iProgressDialog ), |
|
199 ETrue ); |
|
200 |
|
201 iProgressDialog->PrepareLC( R_SWCOMMON_GENERAL_PROGRESS_DIALOG ); |
|
202 iProgressDialog->SetTextL( aText ); |
|
203 SetProgressDialogCallback( aCallback ); |
|
204 iProgressDialog->ButtonGroupContainer().SetCommandSetL( aSoftkeyResourceId ); |
|
205 iProgressDialog->RunLD(); |
|
206 } |
|
207 } |
|
208 |
|
209 // ----------------------------------------------------------------------------- |
|
210 // CCUIDialogs::SetProgressDialogFinalValueL |
|
211 // Set final value for the progress bar in progress dialog. |
|
212 // (other items were commented in a header). |
|
213 // ----------------------------------------------------------------------------- |
|
214 // |
|
215 EXPORT_C void CCUIDialogs::SetProgressDialogFinalValueL( TInt aValue ) |
|
216 { |
|
217 if ( iProgressDialog ) |
|
218 { |
|
219 CEikProgressInfo* progressInfo = iProgressDialog->GetProgressInfoL(); |
|
220 progressInfo->SetFinalValue( aValue ); |
|
221 } |
|
222 } |
|
223 |
|
224 // ----------------------------------------------------------------------------- |
|
225 // CCUIDialogs::UpdateProgressDialogValuL |
|
226 // Increments the progress bar in progress dialog. |
|
227 // (other items were commented in a header). |
|
228 // ----------------------------------------------------------------------------- |
|
229 // |
|
230 EXPORT_C void CCUIDialogs::UpdateProgressDialogValueL( TInt aValue ) |
|
231 { |
|
232 if ( iProgressDialog ) |
|
233 { |
|
234 CEikProgressInfo* progressInfo = iProgressDialog->GetProgressInfoL(); |
|
235 progressInfo->IncrementAndDraw( aValue ); |
|
236 User::ResetInactivityTime(); // keep lights on and screensaver disabled |
|
237 } |
|
238 } |
|
239 |
|
240 // ----------------------------------------------------------------------------- |
|
241 // CCUIDialogs::CloseProgressDialogL |
|
242 // Closes the progress dialog |
|
243 // (other items were commented in a header). |
|
244 // ----------------------------------------------------------------------------- |
|
245 // |
|
246 EXPORT_C void CCUIDialogs::CloseProgressDialogL() |
|
247 { |
|
248 if ( iProgressDialog ) |
|
249 { |
|
250 // Set callback to NULL as we want no callbacks from this. |
|
251 iProgressDialog->SetCallback( NULL ); |
|
252 iProgressDialog->ProcessFinishedL(); |
|
253 delete iProgressDialog; |
|
254 iProgressDialog = NULL; |
|
255 } |
|
256 } |
|
257 |
|
258 // ----------------------------------------------------------------------------- |
|
259 // SwiUI::CSWCUIDialogs::ShowConfirmationQueryL |
|
260 // Show confirmation dialog. |
|
261 // (other items were commented in a header). |
|
262 // ----------------------------------------------------------------------------- |
|
263 // |
|
264 EXPORT_C TBool CCUIDialogs::ShowConfirmationQueryL( TInt aResourceId, |
|
265 TInt aSoftkeyResourceId ) const |
|
266 { |
|
267 TBool response( EFalse ); |
|
268 |
|
269 HBufC* displayString = StringLoader::LoadLC( aResourceId ); |
|
270 |
|
271 response = ShowConfirmationQueryL( *displayString, aSoftkeyResourceId ); |
|
272 |
|
273 CleanupStack::PopAndDestroy( displayString ); |
|
274 |
|
275 return response; |
|
276 } |
|
277 |
|
278 // ----------------------------------------------------------------------------- |
|
279 // SwiUI::CSWCUIDialogs::ShowConfirmationQueryL |
|
280 // Show confirmation dialog. |
|
281 // (other items were commented in a header). |
|
282 // ----------------------------------------------------------------------------- |
|
283 // |
|
284 EXPORT_C TBool CCUIDialogs::ShowConfirmationQueryL( const TDesC& aDisplayString, |
|
285 TInt aSoftkeyResourceId ) const |
|
286 { |
|
287 TBool response( EFalse ); |
|
288 |
|
289 CAknQueryDialog* note = |
|
290 CAknQueryDialog::NewL( CAknQueryDialog::EConfirmationTone ); |
|
291 |
|
292 note->PrepareLC( R_SWCOMMON_GENERAL_CONFIRMATION_QUERY ); |
|
293 note->SetPromptL( aDisplayString ); |
|
294 note->ButtonGroupContainer().SetCommandSetL( aSoftkeyResourceId ); |
|
295 |
|
296 if ( note->RunLD() ) |
|
297 { |
|
298 response = ETrue; |
|
299 } |
|
300 |
|
301 return response; |
|
302 } |
|
303 |
|
304 // ----------------------------------------------------------------------------- |
|
305 // CCUIDialogs::ShowDriveSelectionDialogL |
|
306 // Show a drive / memory selection dialog. |
|
307 // (other items were commented in a header). |
|
308 // ----------------------------------------------------------------------------- |
|
309 // |
|
310 EXPORT_C TInt CCUIDialogs::ShowDriveSelectionDialogL( |
|
311 TInt64 aSize, |
|
312 const RArray<TDriveUnit>& aDriveUnits, |
|
313 const RArray<TInt64>& aDriveSpaces, |
|
314 TInt& aSelectionResult ) |
|
315 { |
|
316 TInt result( KErrNone ); |
|
317 |
|
318 // Sanity check |
|
319 if ( aSize <= 0 ) |
|
320 { |
|
321 aSize = 1; |
|
322 } |
|
323 |
|
324 CCUIDriveUtils* driveUtils = |
|
325 CCUIDriveUtils::NewL( aSize, |
|
326 aDriveUnits, |
|
327 aDriveSpaces ); |
|
328 CleanupStack::PushL( driveUtils ); |
|
329 |
|
330 aSelectionResult = -1; |
|
331 |
|
332 #ifdef RD_MULTIPLE_DRIVE |
|
333 TDriveList driveList; |
|
334 TInt driveCount = 0; |
|
335 DriveInfo::GetUserVisibleDrives( iCoeEnv->FsSession(), |
|
336 driveList, |
|
337 driveCount ); |
|
338 TInt driveCountWithoutRemoteDrives = driveCount; |
|
339 |
|
340 |
|
341 TUint driveStatus = 0; |
|
342 TInt firstFoundDrive = 0; |
|
343 for ( TInt i = 0; i < KMaxDrives; i++ ) |
|
344 { |
|
345 if ( driveList[i] ) |
|
346 { |
|
347 User::LeaveIfError( DriveInfo::GetDriveStatus( iCoeEnv->FsSession(), |
|
348 i, |
|
349 driveStatus ) ); |
|
350 TFileName path; |
|
351 TDriveUnit driveUnit( i ); |
|
352 if ( ( driveStatus & DriveInfo::EDriveRemote ) ) |
|
353 { |
|
354 driveCountWithoutRemoteDrives--; |
|
355 } |
|
356 else |
|
357 { |
|
358 if ( !firstFoundDrive ) |
|
359 { |
|
360 firstFoundDrive = (TInt) driveUnit; |
|
361 } |
|
362 } |
|
363 } |
|
364 } |
|
365 |
|
366 if ( driveCountWithoutRemoteDrives == 1 ) |
|
367 { |
|
368 // Only one drive available, force install to available drive |
|
369 for ( TInt index = 0; index < aDriveUnits.Count(); index++ ) |
|
370 { |
|
371 if ( firstFoundDrive == (TInt)aDriveUnits[index] ) |
|
372 { |
|
373 aSelectionResult = index; |
|
374 break; |
|
375 } |
|
376 } |
|
377 } |
|
378 #else |
|
379 // See if the whole device has enough memory |
|
380 if ( SysUtil::FFSSpaceBelowCriticalLevelL( &iCoeEnv->FsSession(), aSize ) && |
|
381 ( !driveUtils->IsCardDrivePresent() || |
|
382 SysUtil::MMCSpaceBelowCriticalLevelL( &iCoeEnv->FsSession(), aSize ) ) ) |
|
383 { |
|
384 result = KErrNoMemory; |
|
385 } |
|
386 |
|
387 // See if the memory card is present |
|
388 else if ( !driveUtils->IsCardDrivePresent() ) |
|
389 { |
|
390 // No memory card present, force install to phone memory |
|
391 aSelectionResult = driveUtils->GetInternalDriveIndex(); |
|
392 } |
|
393 |
|
394 // Show the dialog until user selects valid memory or cancels it |
|
395 #endif //RD_MULTIPLE_DRIVE |
|
396 else |
|
397 { |
|
398 while ( ETrue ) |
|
399 { |
|
400 if ( !driveUtils->ShowSelectionDialogL( aSelectionResult ) ) |
|
401 { |
|
402 // User canceled the query |
|
403 result = KErrCancel; |
|
404 aSelectionResult = -1; |
|
405 break; |
|
406 } |
|
407 #ifdef RD_MULTIPLE_DRIVE |
|
408 // See if there is enough space in the selected drive |
|
409 // Internal memory selected? |
|
410 if ( !SysUtil::DiskSpaceBelowCriticalLevelL( &iCoeEnv->FsSession(), aSize, aDriveUnits[aSelectionResult] ) ) |
|
411 { |
|
412 break; |
|
413 } |
|
414 #else |
|
415 // See if there is enough space in the selected drive |
|
416 // Internal memory selected? |
|
417 if ( driveUtils->GetInternalDriveIndex() == aSelectionResult ) |
|
418 { |
|
419 if ( !SysUtil::FFSSpaceBelowCriticalLevelL( &iCoeEnv->FsSession(), aSize ) ) |
|
420 { |
|
421 break; |
|
422 } |
|
423 } |
|
424 // The user selected the card. Check the free space from there |
|
425 else if ( !SysUtil::MMCSpaceBelowCriticalLevelL( &iCoeEnv->FsSession(), aSize ) ) |
|
426 { |
|
427 break; |
|
428 } |
|
429 #endif //RD_MULTIPLE_DRIVE |
|
430 |
|
431 // Show error and let user try again |
|
432 HBufC* string = StringLoader::LoadLC( R_SWCOMMON_NOT_ENOUGH_MEMORY_IN_DRIVE ); |
|
433 |
|
434 CAknErrorNote* note = new( ELeave )CAknErrorNote( ETrue ); |
|
435 note->ExecuteLD( string->Des() ); |
|
436 |
|
437 CleanupStack::PopAndDestroy( string ); |
|
438 } |
|
439 } |
|
440 |
|
441 CleanupStack::PopAndDestroy( driveUtils ); |
|
442 |
|
443 return result; |
|
444 } |
|
445 |
|
446 // ----------------------------------------------------------------------------- |
|
447 // CCUIDialogs::ShowSecurityWarningDialogL |
|
448 // Show a security warning dialog. |
|
449 // (other items were commented in a header). |
|
450 // ----------------------------------------------------------------------------- |
|
451 // |
|
452 EXPORT_C TBool CCUIDialogs::ShowSecurityWarningDialogL() |
|
453 { |
|
454 TBool result( EFalse ); |
|
455 |
|
456 // Load resources |
|
457 HBufC* text = StringLoader::LoadLC( R_SWCOMMON_SECURITY_WARNING ); |
|
458 HBufC* linkText = NULL; |
|
459 if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) ) |
|
460 { |
|
461 linkText = StringLoader::LoadLC( R_SWCOMMON_SECURITY_WARNING_MORE_INFO ); |
|
462 } |
|
463 else |
|
464 { |
|
465 linkText = KNullDesC().AllocLC(); |
|
466 } |
|
467 |
|
468 HBufC* message = HBufC::NewLC( text->Length() + linkText->Length() + 1 ); |
|
469 TPtr msgPtr( message->Des() ); |
|
470 msgPtr += *text; |
|
471 msgPtr += KNextLine; |
|
472 msgPtr += *linkText; |
|
473 |
|
474 // Show the dialog |
|
475 CAknMessageQueryDialog* dlg = |
|
476 CAknMessageQueryDialog::NewL( *message, CAknQueryDialog::EWarningTone ); |
|
477 dlg->PrepareLC( R_SWCOMMON_SECURITY_WARNING_DIALOG ); |
|
478 CleanupStack::PushL( dlg ); |
|
479 if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) ) |
|
480 { |
|
481 dlg->SetLinkTextL( *linkText ); |
|
482 TCallBack callback( ShowSecurityWarningHelp, this ); |
|
483 dlg->SetLink( callback ); |
|
484 } |
|
485 CleanupStack::Pop( dlg ); |
|
486 |
|
487 if ( dlg->RunLD() ) |
|
488 { |
|
489 result = ETrue; |
|
490 } |
|
491 |
|
492 CleanupStack::PopAndDestroy( 3, text ); // message, linkText, text |
|
493 |
|
494 return result; |
|
495 } |
|
496 |
|
497 // ----------------------------------------------------------------------------- |
|
498 // CCUIDialogs::ShowErrorNoteL |
|
499 // Show an error note. |
|
500 // (other items were commented in a header). |
|
501 // ----------------------------------------------------------------------------- |
|
502 // |
|
503 EXPORT_C void CCUIDialogs::ShowErrorNoteL( TInt aResourceId ) const |
|
504 { |
|
505 HBufC* errorString = StringLoader::LoadLC( aResourceId ); |
|
506 ShowErrorNoteL( *errorString ); |
|
507 CleanupStack::PopAndDestroy( errorString ); |
|
508 } |
|
509 |
|
510 // ----------------------------------------------------------------------------- |
|
511 // CCUIDialogs::ShowErrorNoteL |
|
512 // Show an error note. |
|
513 // (other items were commented in a header). |
|
514 // ----------------------------------------------------------------------------- |
|
515 // |
|
516 EXPORT_C void CCUIDialogs::ShowErrorNoteL( const TDesC& aErrorText ) const |
|
517 { |
|
518 CAknErrorNote* note = new (ELeave) CAknErrorNote( ETrue ); |
|
519 note->ExecuteLD( aErrorText ); |
|
520 } |
|
521 |
|
522 // ----------------------------------------------------------------------------- |
|
523 // CCUIDialogs::ResetProgressDialogL |
|
524 // Resets the progress bar in the progress dialog. |
|
525 // (other items were commented in a header). |
|
526 // ----------------------------------------------------------------------------- |
|
527 // |
|
528 EXPORT_C void CCUIDialogs::ResetProgressDialogL() |
|
529 { |
|
530 if ( iProgressDialog ) |
|
531 { |
|
532 CEikProgressInfo* progressInfo = iProgressDialog->GetProgressInfoL(); |
|
533 progressInfo->SetAndDraw( 0 ); |
|
534 } |
|
535 } |
|
536 |
|
537 // ----------------------------------------------------------------------------- |
|
538 // CCUIDialogs::LaunchHelpL |
|
539 // Launches a help with the given context. |
|
540 // (other items were commented in a header). |
|
541 // ----------------------------------------------------------------------------- |
|
542 // |
|
543 EXPORT_C void CCUIDialogs::LaunchHelpL( const TDesC& aContext ) |
|
544 { |
|
545 CArrayFix<TCoeHelpContext>* contexts = |
|
546 new(ELeave) CArrayFixFlat<TCoeHelpContext>( 1 ); |
|
547 CleanupStack::PushL( contexts ); |
|
548 TCoeHelpContext context; |
|
549 context.iMajor = TUid::Uid( KSWInstHelpUid ); |
|
550 context.iContext = aContext; |
|
551 contexts->AppendL( context ); |
|
552 CleanupStack::Pop(); // contexts |
|
553 HlpLauncher::LaunchHelpApplicationL( iCoeEnv->WsSession(), contexts ); |
|
554 } |
|
555 |
|
556 // ----------------------------------------------------------------------------- |
|
557 // CCUIDialogs::ShowDelayedWaitDialogL |
|
558 // Show a wait dialog. |
|
559 // (other items were commented in a header). |
|
560 // ----------------------------------------------------------------------------- |
|
561 // |
|
562 EXPORT_C void CCUIDialogs::ShowDelayedWaitDialogL( TInt aResourceId, |
|
563 MCUIWaitDialogCallback* aCallback, |
|
564 TInt aSoftkeyResourceId ) |
|
565 { |
|
566 if ( iWaitDialog ) |
|
567 { |
|
568 ShowWaitDialogL( aResourceId, aCallback, aSoftkeyResourceId ); |
|
569 } |
|
570 else |
|
571 { |
|
572 HBufC* displayString = StringLoader::LoadLC( aResourceId ); |
|
573 iWaitDialog = new (ELeave) CCUIWaitDialog ( reinterpret_cast |
|
574 < CEikDialog** > |
|
575 ( &iWaitDialog ), |
|
576 EFalse ); |
|
577 |
|
578 iWaitDialog->PrepareLC( R_SWCOMMON_GENERAL_WAIT_DIALOG ); |
|
579 iWaitDialog->SetTextL( *displayString ); |
|
580 SetWaitDialogCallback( aCallback ); |
|
581 iWaitDialog->ButtonGroupContainer().SetCommandSetL( aSoftkeyResourceId ); |
|
582 iWaitDialog->RunLD(); |
|
583 CleanupStack::PopAndDestroy( displayString ); |
|
584 } |
|
585 } |
|
586 |
|
587 // ----------------------------------------------------------------------------- |
|
588 // CCUIDialogs::ShowInstallationCompleteQueryL |
|
589 // Show an installation complete query. |
|
590 // (other items were commented in a header). |
|
591 // ----------------------------------------------------------------------------- |
|
592 // |
|
593 EXPORT_C TBool CCUIDialogs::ShowInstallationCompleteQueryL( |
|
594 const MDesCArray& aApplicationArray, |
|
595 const MDesCArray& aInstalledFolderArray, |
|
596 const CAknIconArray& aIconArray, |
|
597 TInt& aIndexOfAppToBeStarted ) const |
|
598 |
|
599 { |
|
600 aIndexOfAppToBeStarted = KErrNotFound; |
|
601 |
|
602 // Prepare for showing the installation complete query |
|
603 CDesCArray *itemArray = new( ELeave ) CDesCArrayFlat( 1 ); |
|
604 CleanupStack::PushL( itemArray ); |
|
605 CAknIconArray* iconArray = new( ELeave ) CAknIconArray( 1 ); |
|
606 CleanupStack::PushL( iconArray ); |
|
607 |
|
608 for ( TInt i = 0; i <= aApplicationArray.MdcaCount() - 1; i++ ) |
|
609 { |
|
610 HBufC* firstLine = aApplicationArray.MdcaPoint( i ).AllocLC(); |
|
611 HBufC* secondLine = NULL; |
|
612 if ( !(aInstalledFolderArray.MdcaCount() < (i + 1 ) ) ) |
|
613 { |
|
614 if ( aInstalledFolderArray.MdcaPoint( i ).Length() > 0 ) |
|
615 { |
|
616 secondLine = StringLoader::LoadLC( |
|
617 R_SWCOMMON_INSTALLED_FOLDER_HEAD, |
|
618 aInstalledFolderArray.MdcaPoint( i ) ); |
|
619 } |
|
620 else |
|
621 { |
|
622 // show just empty second lines for empty folder names |
|
623 secondLine = KNullDesC().AllocLC(); |
|
624 } |
|
625 } |
|
626 if ( secondLine == NULL ) |
|
627 { |
|
628 // default folder is used |
|
629 secondLine = StringLoader::LoadLC( R_SWCOMMON_INSTALLED_FOLDER ); |
|
630 } |
|
631 HBufC* listItem = HBufC::NewLC( firstLine->Length() + |
|
632 secondLine->Length() + 10 ); |
|
633 listItem->Des().Format( KFormat, i, firstLine, secondLine ); |
|
634 |
|
635 itemArray->AppendL( listItem->Des() ); |
|
636 CleanupStack::PopAndDestroy( listItem ); |
|
637 CleanupStack::PopAndDestroy( secondLine ); |
|
638 CleanupStack::PopAndDestroy( firstLine ); |
|
639 |
|
640 |
|
641 // Check first that there is an item in array |
|
642 if ( !( aIconArray.Count() < ( i + 1 ) ) ) |
|
643 { |
|
644 CGulIcon* icon = CGulIcon::NewL(); |
|
645 CleanupStack::PushL( icon ); |
|
646 icon->SetBitmapsOwnedExternally( ETrue ); |
|
647 icon->SetBitmap( aIconArray.At(i)->Bitmap() ); |
|
648 icon->SetMask( aIconArray.At(i)->Mask() ); |
|
649 iconArray->AppendL( icon ); |
|
650 CleanupStack::Pop( icon ); |
|
651 } |
|
652 } |
|
653 |
|
654 // show list query |
|
655 CAknListQueryDialog* dlg = new ( ELeave ) CAknListQueryDialog( |
|
656 &aIndexOfAppToBeStarted ); |
|
657 dlg->PrepareLC( R_SWCOMMON_START_QUERY ); |
|
658 dlg->SetItemTextArray( itemArray ); |
|
659 dlg->SetIconArrayL( iconArray ); |
|
660 |
|
661 dlg->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
|
662 |
|
663 TInt retQuery = dlg->RunLD(); |
|
664 CleanupStack::Pop( iconArray ); |
|
665 |
|
666 CleanupStack::PopAndDestroy( itemArray ); |
|
667 |
|
668 TBool appIsStarted = EFalse; |
|
669 if ( retQuery == EAknSoftkeyOk ) |
|
670 { |
|
671 appIsStarted = ETrue; |
|
672 } |
|
673 else |
|
674 { |
|
675 aIndexOfAppToBeStarted = KErrNotFound; |
|
676 } |
|
677 |
|
678 return appIsStarted; |
|
679 } |
|
680 |
|
681 // ----------------------------------------------------------------------------- |
|
682 // CCUIDialogs::ShowUninstallConfirmationForSeveralAppsL |
|
683 // Show an installation complete query. |
|
684 // (other items were commented in a header). |
|
685 // ----------------------------------------------------------------------------- |
|
686 // |
|
687 EXPORT_C TBool CCUIDialogs::ShowUninstallConfirmationForSeveralAppsL( |
|
688 const TDesC& aApplicationGroup, |
|
689 const MDesCArray& aApplicationArray, |
|
690 TInt aSoftkeyResourceId ) const |
|
691 { |
|
692 HBufC* appList = HBufC::NewLC( 0 ); |
|
693 TInt count = aApplicationArray.MdcaCount(); |
|
694 for ( TInt i = 0; i < count; i++ ) |
|
695 { |
|
696 HBufC* tmp = appList; |
|
697 appList = appList->ReAllocL( |
|
698 tmp->Length() + |
|
699 aApplicationArray.MdcaPoint( i ).Length() + |
|
700 KNextLine().Length() ); |
|
701 CleanupStack::Pop( tmp ); |
|
702 CleanupStack::PushL( appList ); |
|
703 appList->Des().Append( aApplicationArray.MdcaPoint( i ) ); |
|
704 if ( (i+1) < count ) |
|
705 { |
|
706 appList->Des().Append( KNextLine() ); |
|
707 } |
|
708 } |
|
709 CDesCArray* stringArray = new( ELeave ) CDesCArrayFlat( 2 ); |
|
710 CleanupStack::PushL( stringArray ); |
|
711 stringArray->AppendL( aApplicationGroup ); |
|
712 stringArray->AppendL( *appList ); |
|
713 CleanupStack::Pop( stringArray ); |
|
714 CleanupStack::PopAndDestroy( appList ); |
|
715 CleanupStack::PushL( stringArray ); |
|
716 HBufC* message = StringLoader::LoadLC( |
|
717 R_SWCOMMON_QUERY_UNINST_MIDLET_SUITE, |
|
718 *stringArray ); |
|
719 CleanupStack::Pop( message ); |
|
720 CleanupStack::PopAndDestroy( stringArray ); |
|
721 CleanupStack::PushL( message ); |
|
722 |
|
723 CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL( *message ); |
|
724 dlg->PrepareLC( R_SWCOMMON_MULTI_UNINSTALL_DIALOG ); |
|
725 dlg->ButtonGroupContainer().SetCommandSetL( aSoftkeyResourceId ); |
|
726 |
|
727 TBool response( EFalse ); |
|
728 if ( dlg->RunLD() ) |
|
729 { |
|
730 response = ETrue; |
|
731 } |
|
732 CleanupStack::PopAndDestroy( message ); |
|
733 return response; |
|
734 } |
|
735 |
|
736 |
|
737 // |
|
738 // ----------------------------------------------------------------------------- |
|
739 // CCUIDialogs::SetWaitDialogCallback |
|
740 // Set callback for the wait dialog. |
|
741 // (other items were commented in a header). |
|
742 // ----------------------------------------------------------------------------- |
|
743 // |
|
744 void CCUIDialogs::SetWaitDialogCallback( MCUIWaitDialogCallback* aCallback ) |
|
745 { |
|
746 if ( aCallback ) |
|
747 { |
|
748 iWaitDialog->SetCallback( aCallback ); |
|
749 } |
|
750 } |
|
751 |
|
752 // ----------------------------------------------------------------------------- |
|
753 // CCUIDialogs::SetProgressDialogCallback |
|
754 // Set callback for the progress dialog. |
|
755 // (other items were commented in a header). |
|
756 // ----------------------------------------------------------------------------- |
|
757 // |
|
758 void CCUIDialogs::SetProgressDialogCallback( MCUIWaitDialogCallback* aCallback ) |
|
759 { |
|
760 if ( aCallback ) |
|
761 { |
|
762 iProgressDialog->SetCallback( aCallback ); |
|
763 } |
|
764 } |
|
765 |
|
766 // ----------------------------------------------------------------------------- |
|
767 // CCUIDialogs::ShowSecurityWarningHelp |
|
768 // Used as a callback function in message query. Launches help for security |
|
769 // warning. |
|
770 // (other items were commented in a header). |
|
771 // ----------------------------------------------------------------------------- |
|
772 // |
|
773 TInt CCUIDialogs::ShowSecurityWarningHelp( TAny* aPtr ) |
|
774 { |
|
775 TRAP_IGNORE( reinterpret_cast<CCUIDialogs*>(aPtr)->LaunchHelpL( KAM_HLP_INSTALL_UNTRUSTED ) ); |
|
776 |
|
777 return KErrNone; |
|
778 } |
|
779 |
|
780 |
|
781 |
|
782 |
|
783 |