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 |
|
317 TInt result( KErrNone ); |
|
318 /* |
|
319 // Sanity check |
|
320 if ( aSize <= 0 ) |
|
321 { |
|
322 aSize = 1; |
|
323 } |
|
324 |
|
325 CCUIDriveUtils* driveUtils = |
|
326 CCUIDriveUtils::NewL( aSize, |
|
327 aDriveUnits, |
|
328 aDriveSpaces ); |
|
329 CleanupStack::PushL( driveUtils ); |
|
330 |
|
331 aSelectionResult = -1; |
|
332 |
|
333 #ifdef RD_MULTIPLE_DRIVE |
|
334 TDriveList driveList; |
|
335 TInt driveCount = 0; |
|
336 DriveInfo::GetUserVisibleDrives( iCoeEnv->FsSession(), |
|
337 driveList, |
|
338 driveCount ); |
|
339 TInt driveCountWithoutRemoteDrives = driveCount; |
|
340 |
|
341 |
|
342 TUint driveStatus = 0; |
|
343 TInt firstFoundDrive = 0; |
|
344 for ( TInt i = 0; i < KMaxDrives; i++ ) |
|
345 { |
|
346 if ( driveList[i] ) |
|
347 { |
|
348 User::LeaveIfError( DriveInfo::GetDriveStatus( iCoeEnv->FsSession(), |
|
349 i, |
|
350 driveStatus ) ); |
|
351 TFileName path; |
|
352 TDriveUnit driveUnit( i ); |
|
353 if ( ( driveStatus & DriveInfo::EDriveRemote ) ) |
|
354 { |
|
355 driveCountWithoutRemoteDrives--; |
|
356 } |
|
357 else |
|
358 { |
|
359 if ( !firstFoundDrive ) |
|
360 { |
|
361 firstFoundDrive = (TInt) driveUnit; |
|
362 } |
|
363 } |
|
364 } |
|
365 } |
|
366 |
|
367 if ( driveCountWithoutRemoteDrives == 1 ) |
|
368 { |
|
369 // Only one drive available, force install to available drive |
|
370 for ( TInt index = 0; index < aDriveUnits.Count(); index++ ) |
|
371 { |
|
372 if ( firstFoundDrive == (TInt)aDriveUnits[index] ) |
|
373 { |
|
374 aSelectionResult = index; |
|
375 break; |
|
376 } |
|
377 } |
|
378 } |
|
379 #else |
|
380 // See if the whole device has enough memory |
|
381 if ( SysUtil::FFSSpaceBelowCriticalLevelL( &iCoeEnv->FsSession(), aSize ) && |
|
382 ( !driveUtils->IsCardDrivePresent() || |
|
383 SysUtil::MMCSpaceBelowCriticalLevelL( &iCoeEnv->FsSession(), aSize ) ) ) |
|
384 { |
|
385 result = KErrNoMemory; |
|
386 } |
|
387 |
|
388 // See if the memory card is present |
|
389 else if ( !driveUtils->IsCardDrivePresent() ) |
|
390 { |
|
391 // No memory card present, force install to phone memory |
|
392 aSelectionResult = driveUtils->GetInternalDriveIndex(); |
|
393 } |
|
394 |
|
395 // Show the dialog until user selects valid memory or cancels it |
|
396 #endif //RD_MULTIPLE_DRIVE |
|
397 else |
|
398 { |
|
399 while ( ETrue ) |
|
400 { |
|
401 if ( !driveUtils->ShowSelectionDialogL( aSelectionResult ) ) |
|
402 { |
|
403 // User canceled the query |
|
404 result = KErrCancel; |
|
405 aSelectionResult = -1; |
|
406 break; |
|
407 } |
|
408 #ifdef RD_MULTIPLE_DRIVE |
|
409 // See if there is enough space in the selected drive |
|
410 // Internal memory selected? |
|
411 if ( !SysUtil::DiskSpaceBelowCriticalLevelL( &iCoeEnv->FsSession(), aSize, aDriveUnits[aSelectionResult] ) ) |
|
412 { |
|
413 break; |
|
414 } |
|
415 #else |
|
416 // See if there is enough space in the selected drive |
|
417 // Internal memory selected? |
|
418 if ( driveUtils->GetInternalDriveIndex() == aSelectionResult ) |
|
419 { |
|
420 if ( !SysUtil::FFSSpaceBelowCriticalLevelL( &iCoeEnv->FsSession(), aSize ) ) |
|
421 { |
|
422 break; |
|
423 } |
|
424 } |
|
425 // The user selected the card. Check the free space from there |
|
426 else if ( !SysUtil::MMCSpaceBelowCriticalLevelL( &iCoeEnv->FsSession(), aSize ) ) |
|
427 { |
|
428 break; |
|
429 } |
|
430 #endif //RD_MULTIPLE_DRIVE |
|
431 |
|
432 // Show error and let user try again |
|
433 HBufC* string = StringLoader::LoadLC( R_SWCOMMON_NOT_ENOUGH_MEMORY_IN_DRIVE ); |
|
434 |
|
435 CAknErrorNote* note = new( ELeave )CAknErrorNote( ETrue ); |
|
436 note->ExecuteLD( string->Des() ); |
|
437 |
|
438 CleanupStack::PopAndDestroy( string ); |
|
439 } |
|
440 } |
|
441 |
|
442 CleanupStack::PopAndDestroy( driveUtils ); |
|
443 */ |
|
444 return result; |
|
445 } |
|
446 |
|
447 // ----------------------------------------------------------------------------- |
|
448 // CCUIDialogs::ShowSecurityWarningDialogL |
|
449 // Show a security warning dialog. |
|
450 // (other items were commented in a header). |
|
451 // ----------------------------------------------------------------------------- |
|
452 // |
|
453 EXPORT_C TBool CCUIDialogs::ShowSecurityWarningDialogL() |
|
454 { |
|
455 |
|
456 TBool result( EFalse ); |
|
457 /* |
|
458 // Load resources |
|
459 HBufC* text = StringLoader::LoadLC( R_SWCOMMON_SECURITY_WARNING ); |
|
460 HBufC* linkText = NULL; |
|
461 if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) ) |
|
462 { |
|
463 linkText = StringLoader::LoadLC( R_SWCOMMON_SECURITY_WARNING_MORE_INFO ); |
|
464 } |
|
465 else |
|
466 { |
|
467 linkText = KNullDesC().AllocLC(); |
|
468 } |
|
469 |
|
470 HBufC* message = HBufC::NewLC( text->Length() + linkText->Length() + 1 ); |
|
471 TPtr msgPtr( message->Des() ); |
|
472 msgPtr += *text; |
|
473 msgPtr += KNextLine; |
|
474 msgPtr += *linkText; |
|
475 |
|
476 // Show the dialog |
|
477 CAknMessageQueryDialog* dlg = |
|
478 CAknMessageQueryDialog::NewL( *message, CAknQueryDialog::EWarningTone ); |
|
479 dlg->PrepareLC( R_SWCOMMON_SECURITY_WARNING_DIALOG ); |
|
480 CleanupStack::PushL( dlg ); |
|
481 if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) ) |
|
482 { |
|
483 dlg->SetLinkTextL( *linkText ); |
|
484 TCallBack callback( ShowSecurityWarningHelp, this ); |
|
485 dlg->SetLink( callback ); |
|
486 } |
|
487 CleanupStack::Pop( dlg ); |
|
488 |
|
489 if ( dlg->RunLD() ) |
|
490 { |
|
491 result = ETrue; |
|
492 } |
|
493 |
|
494 CleanupStack::PopAndDestroy( 3, text ); // message, linkText, text |
|
495 */ |
|
496 return result; |
|
497 } |
|
498 |
|
499 // ----------------------------------------------------------------------------- |
|
500 // CCUIDialogs::ShowErrorNoteL |
|
501 // Show an error note. |
|
502 // (other items were commented in a header). |
|
503 // ----------------------------------------------------------------------------- |
|
504 // |
|
505 EXPORT_C void CCUIDialogs::ShowErrorNoteL( TInt aResourceId ) const |
|
506 { |
|
507 HBufC* errorString = StringLoader::LoadLC( aResourceId ); |
|
508 ShowErrorNoteL( *errorString ); |
|
509 CleanupStack::PopAndDestroy( errorString ); |
|
510 } |
|
511 |
|
512 // ----------------------------------------------------------------------------- |
|
513 // CCUIDialogs::ShowErrorNoteL |
|
514 // Show an error note. |
|
515 // (other items were commented in a header). |
|
516 // ----------------------------------------------------------------------------- |
|
517 // |
|
518 EXPORT_C void CCUIDialogs::ShowErrorNoteL( const TDesC& aErrorText ) const |
|
519 { |
|
520 /* |
|
521 CAknErrorNote* note = new (ELeave) CAknErrorNote( ETrue ); |
|
522 note->ExecuteLD( aErrorText ); |
|
523 */ |
|
524 } |
|
525 |
|
526 // ----------------------------------------------------------------------------- |
|
527 // CCUIDialogs::ResetProgressDialogL |
|
528 // Resets the progress bar in the progress dialog. |
|
529 // (other items were commented in a header). |
|
530 // ----------------------------------------------------------------------------- |
|
531 // |
|
532 EXPORT_C void CCUIDialogs::ResetProgressDialogL() |
|
533 { |
|
534 if ( iProgressDialog ) |
|
535 { |
|
536 CEikProgressInfo* progressInfo = iProgressDialog->GetProgressInfoL(); |
|
537 progressInfo->SetAndDraw( 0 ); |
|
538 } |
|
539 } |
|
540 |
|
541 // ----------------------------------------------------------------------------- |
|
542 // CCUIDialogs::LaunchHelpL |
|
543 // Launches a help with the given context. |
|
544 // (other items were commented in a header). |
|
545 // ----------------------------------------------------------------------------- |
|
546 // |
|
547 EXPORT_C void CCUIDialogs::LaunchHelpL( const TDesC& aContext ) |
|
548 { |
|
549 CArrayFix<TCoeHelpContext>* contexts = |
|
550 new(ELeave) CArrayFixFlat<TCoeHelpContext>( 1 ); |
|
551 CleanupStack::PushL( contexts ); |
|
552 TCoeHelpContext context; |
|
553 context.iMajor = TUid::Uid( KSWInstHelpUid ); |
|
554 context.iContext = aContext; |
|
555 contexts->AppendL( context ); |
|
556 CleanupStack::Pop(); // contexts |
|
557 HlpLauncher::LaunchHelpApplicationL( iCoeEnv->WsSession(), contexts ); |
|
558 } |
|
559 |
|
560 // ----------------------------------------------------------------------------- |
|
561 // CCUIDialogs::ShowDelayedWaitDialogL |
|
562 // Show a wait dialog. |
|
563 // (other items were commented in a header). |
|
564 // ----------------------------------------------------------------------------- |
|
565 // |
|
566 EXPORT_C void CCUIDialogs::ShowDelayedWaitDialogL( TInt aResourceId, |
|
567 MCUIWaitDialogCallback* aCallback, |
|
568 TInt aSoftkeyResourceId ) |
|
569 { |
|
570 if ( iWaitDialog ) |
|
571 { |
|
572 ShowWaitDialogL( aResourceId, aCallback, aSoftkeyResourceId ); |
|
573 } |
|
574 else |
|
575 { |
|
576 HBufC* displayString = StringLoader::LoadLC( aResourceId ); |
|
577 iWaitDialog = new (ELeave) CCUIWaitDialog ( reinterpret_cast |
|
578 < CEikDialog** > |
|
579 ( &iWaitDialog ), |
|
580 EFalse ); |
|
581 |
|
582 iWaitDialog->PrepareLC( R_SWCOMMON_GENERAL_WAIT_DIALOG ); |
|
583 iWaitDialog->SetTextL( *displayString ); |
|
584 SetWaitDialogCallback( aCallback ); |
|
585 iWaitDialog->ButtonGroupContainer().SetCommandSetL( aSoftkeyResourceId ); |
|
586 iWaitDialog->RunLD(); |
|
587 CleanupStack::PopAndDestroy( displayString ); |
|
588 } |
|
589 } |
|
590 |
|
591 // ----------------------------------------------------------------------------- |
|
592 // CCUIDialogs::ShowInstallationCompleteQueryL |
|
593 // Show an installation complete query. |
|
594 // (other items were commented in a header). |
|
595 // ----------------------------------------------------------------------------- |
|
596 // |
|
597 EXPORT_C TBool CCUIDialogs::ShowInstallationCompleteQueryL( |
|
598 const MDesCArray& aApplicationArray, |
|
599 const MDesCArray& aInstalledFolderArray, |
|
600 const CAknIconArray& aIconArray, |
|
601 TInt& aIndexOfAppToBeStarted ) const |
|
602 |
|
603 { |
|
604 /* |
|
605 aIndexOfAppToBeStarted = KErrNotFound; |
|
606 |
|
607 // Prepare for showing the installation complete query |
|
608 CDesCArray *itemArray = new( ELeave ) CDesCArrayFlat( 1 ); |
|
609 CleanupStack::PushL( itemArray ); |
|
610 CAknIconArray* iconArray = new( ELeave ) CAknIconArray( 1 ); |
|
611 CleanupStack::PushL( iconArray ); |
|
612 |
|
613 for ( TInt i = 0; i <= aApplicationArray.MdcaCount() - 1; i++ ) |
|
614 { |
|
615 HBufC* firstLine = aApplicationArray.MdcaPoint( i ).AllocLC(); |
|
616 HBufC* secondLine = NULL; |
|
617 if ( !(aInstalledFolderArray.MdcaCount() < (i + 1 ) ) ) |
|
618 { |
|
619 if ( aInstalledFolderArray.MdcaPoint( i ).Length() > 0 ) |
|
620 { |
|
621 secondLine = StringLoader::LoadLC( |
|
622 R_SWCOMMON_INSTALLED_FOLDER_HEAD, |
|
623 aInstalledFolderArray.MdcaPoint( i ) ); |
|
624 } |
|
625 else |
|
626 { |
|
627 // show just empty second lines for empty folder names |
|
628 secondLine = KNullDesC().AllocLC(); |
|
629 } |
|
630 } |
|
631 if ( secondLine == NULL ) |
|
632 { |
|
633 // default folder is used |
|
634 secondLine = StringLoader::LoadLC( R_SWCOMMON_INSTALLED_FOLDER ); |
|
635 } |
|
636 HBufC* listItem = HBufC::NewLC( firstLine->Length() + |
|
637 secondLine->Length() + 10 ); |
|
638 listItem->Des().Format( KFormat, i, firstLine, secondLine ); |
|
639 |
|
640 itemArray->AppendL( listItem->Des() ); |
|
641 CleanupStack::PopAndDestroy( listItem ); |
|
642 CleanupStack::PopAndDestroy( secondLine ); |
|
643 CleanupStack::PopAndDestroy( firstLine ); |
|
644 |
|
645 |
|
646 // Check first that there is an item in array |
|
647 if ( !( aIconArray.Count() < ( i + 1 ) ) ) |
|
648 { |
|
649 CGulIcon* icon = CGulIcon::NewL(); |
|
650 CleanupStack::PushL( icon ); |
|
651 icon->SetBitmapsOwnedExternally( ETrue ); |
|
652 icon->SetBitmap( aIconArray.At(i)->Bitmap() ); |
|
653 icon->SetMask( aIconArray.At(i)->Mask() ); |
|
654 iconArray->AppendL( icon ); |
|
655 CleanupStack::Pop( icon ); |
|
656 } |
|
657 } |
|
658 |
|
659 // show list query |
|
660 CAknListQueryDialog* dlg = new ( ELeave ) CAknListQueryDialog( |
|
661 &aIndexOfAppToBeStarted ); |
|
662 dlg->PrepareLC( R_SWCOMMON_START_QUERY ); |
|
663 dlg->SetItemTextArray( itemArray ); |
|
664 dlg->SetIconArrayL( iconArray ); |
|
665 |
|
666 dlg->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
|
667 |
|
668 TInt retQuery = dlg->RunLD(); |
|
669 CleanupStack::Pop( iconArray ); |
|
670 |
|
671 CleanupStack::PopAndDestroy( itemArray ); |
|
672 |
|
673 TBool appIsStarted = EFalse; |
|
674 if ( retQuery == EAknSoftkeyOk ) |
|
675 { |
|
676 appIsStarted = ETrue; |
|
677 } |
|
678 else |
|
679 { |
|
680 aIndexOfAppToBeStarted = KErrNotFound; |
|
681 } |
|
682 |
|
683 return appIsStarted; |
|
684 */ |
|
685 return EFalse; |
|
686 } |
|
687 |
|
688 // ----------------------------------------------------------------------------- |
|
689 // CCUIDialogs::ShowUninstallConfirmationForSeveralAppsL |
|
690 // Show an installation complete query. |
|
691 // (other items were commented in a header). |
|
692 // ----------------------------------------------------------------------------- |
|
693 // |
|
694 EXPORT_C TBool CCUIDialogs::ShowUninstallConfirmationForSeveralAppsL( |
|
695 const TDesC& aApplicationGroup, |
|
696 const MDesCArray& aApplicationArray, |
|
697 TInt aSoftkeyResourceId ) const |
|
698 { |
|
699 /* |
|
700 HBufC* appList = HBufC::NewLC( 0 ); |
|
701 TInt count = aApplicationArray.MdcaCount(); |
|
702 for ( TInt i = 0; i < count; i++ ) |
|
703 { |
|
704 HBufC* tmp = appList; |
|
705 appList = appList->ReAllocL( |
|
706 tmp->Length() + |
|
707 aApplicationArray.MdcaPoint( i ).Length() + |
|
708 KNextLine().Length() ); |
|
709 CleanupStack::Pop( tmp ); |
|
710 CleanupStack::PushL( appList ); |
|
711 appList->Des().Append( aApplicationArray.MdcaPoint( i ) ); |
|
712 if ( (i+1) < count ) |
|
713 { |
|
714 appList->Des().Append( KNextLine() ); |
|
715 } |
|
716 } |
|
717 CDesCArray* stringArray = new( ELeave ) CDesCArrayFlat( 2 ); |
|
718 CleanupStack::PushL( stringArray ); |
|
719 stringArray->AppendL( aApplicationGroup ); |
|
720 stringArray->AppendL( *appList ); |
|
721 CleanupStack::Pop( stringArray ); |
|
722 CleanupStack::PopAndDestroy( appList ); |
|
723 CleanupStack::PushL( stringArray ); |
|
724 HBufC* message = StringLoader::LoadLC( |
|
725 R_SWCOMMON_QUERY_UNINST_MIDLET_SUITE, |
|
726 *stringArray ); |
|
727 CleanupStack::Pop( message ); |
|
728 CleanupStack::PopAndDestroy( stringArray ); |
|
729 CleanupStack::PushL( message ); |
|
730 |
|
731 CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL( *message ); |
|
732 dlg->PrepareLC( R_SWCOMMON_MULTI_UNINSTALL_DIALOG ); |
|
733 dlg->ButtonGroupContainer().SetCommandSetL( aSoftkeyResourceId ); |
|
734 |
|
735 TBool response( EFalse ); |
|
736 if ( dlg->RunLD() ) |
|
737 { |
|
738 response = ETrue; |
|
739 } |
|
740 CleanupStack::PopAndDestroy( message ); |
|
741 return response; |
|
742 */ |
|
743 return EFalse; |
|
744 } |
|
745 |
|
746 |
|
747 // |
|
748 // ----------------------------------------------------------------------------- |
|
749 // CCUIDialogs::SetWaitDialogCallback |
|
750 // Set callback for the wait dialog. |
|
751 // (other items were commented in a header). |
|
752 // ----------------------------------------------------------------------------- |
|
753 // |
|
754 void CCUIDialogs::SetWaitDialogCallback( MCUIWaitDialogCallback* aCallback ) |
|
755 { |
|
756 if ( aCallback ) |
|
757 { |
|
758 iWaitDialog->SetCallback( aCallback ); |
|
759 } |
|
760 } |
|
761 |
|
762 // ----------------------------------------------------------------------------- |
|
763 // CCUIDialogs::SetProgressDialogCallback |
|
764 // Set callback for the progress dialog. |
|
765 // (other items were commented in a header). |
|
766 // ----------------------------------------------------------------------------- |
|
767 // |
|
768 void CCUIDialogs::SetProgressDialogCallback( MCUIWaitDialogCallback* aCallback ) |
|
769 { |
|
770 if ( aCallback ) |
|
771 { |
|
772 iProgressDialog->SetCallback( aCallback ); |
|
773 } |
|
774 } |
|
775 |
|
776 // ----------------------------------------------------------------------------- |
|
777 // CCUIDialogs::ShowSecurityWarningHelp |
|
778 // Used as a callback function in message query. Launches help for security |
|
779 // warning. |
|
780 // (other items were commented in a header). |
|
781 // ----------------------------------------------------------------------------- |
|
782 // |
|
783 TInt CCUIDialogs::ShowSecurityWarningHelp( TAny* aPtr ) |
|
784 { |
|
785 //TRAP_IGNORE( reinterpret_cast<CCUIDialogs*>(aPtr)->LaunchHelpL( KAM_HLP_INSTALL_UNTRUSTED ) ); |
|
786 |
|
787 return KErrNone; |
|
788 } |
|
789 |
|
790 |
|
791 |
|
792 |
|
793 |
|