branch | RCL_3 |
changeset 56 | d48ab3b357f1 |
parent 55 | aecbbf00d063 |
child 59 | 978afdc0236f |
55:aecbbf00d063 | 56:d48ab3b357f1 |
---|---|
39 #include <avkon.rsg> |
39 #include <avkon.rsg> |
40 #include <avkon.hrh> |
40 #include <avkon.hrh> |
41 #include <eikdpage.h> |
41 #include <eikdpage.h> |
42 #include <eikmop.h> |
42 #include <eikmop.h> |
43 #include <aknenv.h> |
43 #include <aknenv.h> |
44 #include <touchfeedback.h> |
|
44 //<SKIN> |
45 //<SKIN> |
45 #include "eikdialogext.h" |
46 #include "eikdialogext.h" |
46 #include <AknsListBoxBackgroundControlContext.h> |
47 #include <AknsListBoxBackgroundControlContext.h> |
47 #include <AknsDrawUtils.h> |
48 #include <AknsDrawUtils.h> |
48 #include <AknUtils.h> |
49 #include <AknUtils.h> |
67 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS |
68 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS |
68 #include <akntranseffect.h> |
69 #include <akntranseffect.h> |
69 #endif |
70 #endif |
70 #include <AknQueryDialog.h> |
71 #include <AknQueryDialog.h> |
71 #include <aknQueryControl.h> |
72 #include <aknQueryControl.h> |
73 #include <aknitemactionmenuregister.h> |
|
74 #include <layoutmetadata.cdl.h> |
|
72 |
75 |
73 #include "akncbacontentobserver.h" |
76 #include "akncbacontentobserver.h" |
77 #include "akntrace.h" |
|
74 |
78 |
75 TBool IsBlankScreenDisplayed(); |
79 TBool IsBlankScreenDisplayed(); |
76 |
80 |
77 |
81 |
78 // ----------------------------------------------------------------------------- |
82 // ----------------------------------------------------------------------------- |
80 // @return ETrue if cba is embedded. |
84 // @return ETrue if cba is embedded. |
81 // ----------------------------------------------------------------------------- |
85 // ----------------------------------------------------------------------------- |
82 // |
86 // |
83 TBool CbaEmbeddedInDialog( const TInt& aFlags ) |
87 TBool CbaEmbeddedInDialog( const TInt& aFlags ) |
84 { |
88 { |
85 return AknLayoutUtils::PenEnabled() && |
89 return !( aFlags & EEikDialogFlagFillAppClientRect ) && |
86 !( aFlags & EEikDialogFlagFillAppClientRect ) && |
|
87 !( aFlags & EEikDialogFlagFillScreen ) && |
90 !( aFlags & EEikDialogFlagFillScreen ) && |
88 !( aFlags & EEikDialogFlagVirtualInput ); |
91 !( aFlags & EEikDialogFlagVirtualInput ) && |
92 !( aFlags & EEikDialogFlagNoEmbeddedSoftkeys ); |
|
89 } |
93 } |
90 |
94 |
91 |
95 |
92 // --------------------------------------------------------------------------- |
96 // --------------------------------------------------------------------------- |
93 // --------------------------------------------------------------------------- |
97 // --------------------------------------------------------------------------- |
118 // @return ETrue if the window group is in focus, otherwise EFalse |
122 // @return ETrue if the window group is in focus, otherwise EFalse |
119 // ----------------------------------------------------------------------------- |
123 // ----------------------------------------------------------------------------- |
120 // |
124 // |
121 TBool IsFocusedWindowGroup( CEikDialog* aThis ) |
125 TBool IsFocusedWindowGroup( CEikDialog* aThis ) |
122 { |
126 { |
127 _AKNTRACE_FUNC_ENTER; |
|
123 RWindowTreeNode* node = aThis->DrawableWindow(); |
128 RWindowTreeNode* node = aThis->DrawableWindow(); |
124 // this code finds out if this control belongs to window group |
129 // this code finds out if this control belongs to window group |
125 // that is in focus, there are some rare cases when the latest opened |
130 // that is in focus, there are some rare cases when the latest opened |
126 // popup goes behind another one (e.g. system lock query -> power key menu) |
131 // popup goes behind another one (e.g. system lock query -> power key menu) |
127 // we don't want transition in that case |
132 // we don't want transition in that case |
150 |
155 |
151 delete wgIds; |
156 delete wgIds; |
152 |
157 |
153 if ( focusedWindowGroupId == wgId ) |
158 if ( focusedWindowGroupId == wgId ) |
154 { |
159 { |
160 _AKNTRACE( "return ETrue;"); |
|
161 _AKNTRACE_FUNC_EXIT; |
|
155 return ETrue; |
162 return ETrue; |
156 } |
163 } |
157 } |
164 } |
165 _AKNTRACE( "return EFalse;"); |
|
166 _AKNTRACE_FUNC_EXIT; |
|
158 return EFalse; |
167 return EFalse; |
159 } |
168 } |
160 |
169 |
161 GLDEF_C void Panic(TEikDialogPanic aPanic) |
170 GLDEF_C void Panic(TEikDialogPanic aPanic) |
162 { |
171 { |
207 |
216 |
208 #endif |
217 #endif |
209 |
218 |
210 EXPORT_C CEikDialog::CEikDialog() |
219 EXPORT_C CEikDialog::CEikDialog() |
211 { |
220 { |
221 _AKNTRACE_FUNC_ENTER; |
|
212 // __DECLARE_NAME(_S("CEikDialog")); |
222 // __DECLARE_NAME(_S("CEikDialog")); |
213 // No border in Avkon |
223 // No border in Avkon |
214 iBorder=TGulBorder(TGulBorder::ENone); |
224 iBorder=TGulBorder(TGulBorder::ENone); |
215 SetMopParent(iEikonEnv->EikAppUi()); |
225 SetMopParent(iEikonEnv->EikAppUi()); |
216 #if defined (__DEBUG__) |
226 #if defined (__DEBUG__) |
219 #endif |
229 #endif |
220 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS |
230 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS |
221 GfxTransEffect::Register(this,KGfxPopupDefaultControlUid); |
231 GfxTransEffect::Register(this,KGfxPopupDefaultControlUid); |
222 #endif |
232 #endif |
223 AKNTASHOOK_ADD( this, "CEikDialog" ); |
233 AKNTASHOOK_ADD( this, "CEikDialog" ); |
234 _AKNTRACE_FUNC_EXIT; |
|
224 } |
235 } |
225 |
236 |
226 EXPORT_C CEikDialog::~CEikDialog() |
237 EXPORT_C CEikDialog::~CEikDialog() |
227 { |
238 { |
239 _AKNTRACE_FUNC_ENTER; |
|
228 AKNTASHOOK_REMOVE(); |
240 AKNTASHOOK_REMOVE(); |
241 |
|
242 AknItemActionMenuRegister::RemoveConstructingMenuBarOwner( this ); |
|
229 |
243 |
230 EnableContentObserver( EFalse ); |
244 EnableContentObserver( EFalse ); |
231 |
245 |
232 if ( GfxTransEffect::IsRegistered( this ) ) |
246 if ( GfxTransEffect::IsRegistered( this ) ) |
233 { |
247 { |
251 delete iPageSelector; |
265 delete iPageSelector; |
252 delete iButtonGroupContainer; |
266 delete iButtonGroupContainer; |
253 delete iExtension ; |
267 delete iExtension ; |
254 iExtension = NULL; |
268 iExtension = NULL; |
255 StopWaitingAsRequired(); |
269 StopWaitingAsRequired(); |
270 _AKNTRACE_FUNC_EXIT; |
|
256 } |
271 } |
257 |
272 |
258 void CEikDialog::DynamicConstructL() |
273 void CEikDialog::DynamicConstructL() |
259 { |
274 { |
275 _AKNTRACE_FUNC_ENTER; |
|
260 PreLayoutDynInitL(); |
276 PreLayoutDynInitL(); |
261 |
277 |
262 if ( iPageSelector && iPageSelector->IsForm() && Extension() ) |
278 if ( iPageSelector && iPageSelector->IsForm() && Extension() ) |
263 { |
279 { |
264 Extension()->iPublicFlags.Set( CEikDialogExtension::EFullyConstructed ); |
280 Extension()->iPublicFlags.Set( CEikDialogExtension::EFullyConstructed ); |
265 } |
281 } |
266 |
282 |
267 EnableContentObserver( ETrue ); |
283 EnableContentObserver( ETrue ); |
268 |
284 |
285 // Extension member variable iDeleteEmbeddedCba is used to track whether |
|
286 // dialog's implementation of CCoeControl::SizeChanged gets called. If it |
|
287 // isn't then embedded softkeys won't work. |
|
288 CEikDialogExtension* extension = Extension(); |
|
289 TBool checkCba = extension && iButtonGroupContainer |
|
290 && CbaEmbeddedInDialog( iDialogFlags ); |
|
291 |
|
292 if ( checkCba ) |
|
293 { |
|
294 extension->iDeleteEmbeddedCba = ETrue; |
|
295 } |
|
296 |
|
269 Layout(); |
297 Layout(); |
298 |
|
299 // At this point CBA's rect should be correctly set. If it isn't, then |
|
300 // assume that dialog didn't properly call CEikDialog::SizeChanged thus |
|
301 // embedded softkeys won't work. |
|
302 // In that case softkeys are deleted and re-created as a window-owning |
|
303 // component in "legacy" way. |
|
304 if (checkCba && extension->iButtonGroupResourceId != 0 && |
|
305 (extension->iDeleteEmbeddedCba || Size().iWidth <= 0)) |
|
306 { |
|
307 delete iButtonGroupContainer; |
|
308 iButtonGroupContainer = NULL; |
|
309 iButtonGroupContainer = CEikButtonGroupContainer::NewL( |
|
310 CEikButtonGroupContainer::ECba, |
|
311 CEikButtonGroupContainer::EHorizontal, |
|
312 iButtonCommandObserver, |
|
313 extension->iButtonGroupResourceId, |
|
314 0 ); |
|
315 |
|
316 iDialogFlags |= EEikDialogFlagNoEmbeddedSoftkeys; |
|
317 } |
|
318 |
|
270 PostLayoutDynInitL(); |
319 PostLayoutDynInitL(); |
320 _AKNTRACE_FUNC_EXIT; |
|
271 } |
321 } |
272 |
322 |
273 /** |
323 /** |
274 * Prepares the dialog, constructing it from the resource with id aResourceId. |
324 * Prepares the dialog, constructing it from the resource with id aResourceId. |
275 * |
325 * |
277 * of the stack in RunLD, the purpose is to be able to display note dialogs in OOM |
327 * of the stack in RunLD, the purpose is to be able to display note dialogs in OOM |
278 * situations. |
328 * situations. |
279 */ |
329 */ |
280 EXPORT_C void CEikDialog::PrepareLC(TInt aResourceId) |
330 EXPORT_C void CEikDialog::PrepareLC(TInt aResourceId) |
281 { |
331 { |
332 _AKNTRACE_FUNC_ENTER; |
|
282 CleanupStack::PushL(this); |
333 CleanupStack::PushL(this); |
283 BaseConstructL(); |
334 BaseConstructL(); |
284 StaticConstructL(aResourceId); |
335 StaticConstructL(aResourceId); |
285 |
336 |
286 if (!(iDialogFlags&EEikDialogFlagModeless)) |
337 if (!(iDialogFlags&EEikDialogFlagModeless)) |
287 { |
338 { |
288 AknGlobalPopupPriorityController::AddPopupToControlStackL(*this,ECoeStackPriorityDialog,ECoeStackFlagRefusesAllKeys); |
339 AknGlobalPopupPriorityController::AddPopupToControlStackL(*this,ECoeStackPriorityDialog,ECoeStackFlagRefusesAllKeys); |
289 } |
340 } |
341 _AKNTRACE_FUNC_EXIT; |
|
290 } |
342 } |
291 |
343 |
292 /** |
344 /** |
293 * Reads the dialog resources into the dialog, constructing it from the specified resource. |
345 * Reads the dialog resources into the dialog, constructing it from the specified resource. |
294 * The function is only to help loading dialog resources and |
346 * The function is only to help loading dialog resources and |
308 * it. The dialog is constructed from the resource with id aResourceId and is destroyed |
360 * it. The dialog is constructed from the resource with id aResourceId and is destroyed |
309 * on exit. |
361 * on exit. |
310 */ |
362 */ |
311 EXPORT_C TInt CEikDialog::ExecuteLD(TInt aResourceId) |
363 EXPORT_C TInt CEikDialog::ExecuteLD(TInt aResourceId) |
312 { |
364 { |
365 _AKNTRACE_FUNC_ENTER; |
|
313 PrepareLC(aResourceId); |
366 PrepareLC(aResourceId); |
367 _AKNTRACE_FUNC_EXIT; |
|
314 return(RunLD()); |
368 return(RunLD()); |
315 } |
369 } |
316 |
370 |
317 void CEikDialog::BaseConstructL() |
371 void CEikDialog::BaseConstructL() |
318 { |
372 { |
373 _AKNTRACE_FUNC_ENTER; |
|
319 CreateWindowL(); |
374 CreateWindowL(); |
320 Window().SetBackgroundColor(iEikonEnv->ControlColor(EColorDialogBackground,*this)); |
375 Window().SetBackgroundColor(iEikonEnv->ControlColor(EColorDialogBackground,*this)); |
321 EnableDragEvents(); |
376 EnableDragEvents(); |
322 Window().SetPointerGrab(ETrue); |
377 Window().SetPointerGrab(ETrue); |
323 iContext=this; |
378 iContext=this; |
326 iButtonCommandObserver=CEikDialogButtonCommandObserver::NewL(*this); |
381 iButtonCommandObserver=CEikDialogButtonCommandObserver::NewL(*this); |
327 if (!iExtension) |
382 if (!iExtension) |
328 { |
383 { |
329 iExtension = CEikDialogExtension::NewL( *this ) ; |
384 iExtension = CEikDialogExtension::NewL( *this ) ; |
330 } |
385 } |
386 _AKNTRACE_FUNC_EXIT; |
|
331 } |
387 } |
332 |
388 |
333 void CEikDialog::StaticConstructL(TInt aResourceId) |
389 void CEikDialog::StaticConstructL(TInt aResourceId) |
334 { |
390 { |
391 _AKNTRACE_FUNC_ENTER; |
|
392 AknItemActionMenuRegister::SetConstructingMenuBarOwnerL( this ); |
|
393 |
|
335 TResourceReader reader; |
394 TResourceReader reader; |
336 iCoeEnv->CreateResourceReaderLC(reader,aResourceId); |
395 iCoeEnv->CreateResourceReaderLC(reader,aResourceId); |
337 ConstructFromResourceL(reader); |
396 ConstructFromResourceL(reader); |
338 CleanupStack::PopAndDestroy(); |
397 CleanupStack::PopAndDestroy(); |
339 |
398 |
349 { |
408 { |
350 Window().SetBackgroundColor(~0); |
409 Window().SetBackgroundColor(~0); |
351 } |
410 } |
352 } |
411 } |
353 } |
412 } |
413 _AKNTRACE_FUNC_EXIT; |
|
354 } |
414 } |
355 |
415 |
356 /** |
416 /** |
357 * Constructs a sleeping dialog from the resources identified by aResourceId. |
417 * Constructs a sleeping dialog from the resources identified by aResourceId. |
358 * A sleeping dialog is one which can be displayed at any time since its memorey |
418 * A sleeping dialog is one which can be displayed at any time since its memorey |
377 void CEikDialog::CommonConstructSleepingDialogL(TInt aResourceId) |
437 void CEikDialog::CommonConstructSleepingDialogL(TInt aResourceId) |
378 // |
438 // |
379 // code common to both ConstructSleepingDialogL & ConstructSleepingAlertDialogL |
439 // code common to both ConstructSleepingDialogL & ConstructSleepingAlertDialogL |
380 // |
440 // |
381 { |
441 { |
442 _AKNTRACE_FUNC_ENTER; |
|
382 iDialogFlags|=EEikDialogFlagSleeping; |
443 iDialogFlags|=EEikDialogFlagSleeping; |
383 BaseConstructL(); |
444 BaseConstructL(); |
384 StaticConstructL(aResourceId); |
445 StaticConstructL(aResourceId); |
385 MakeVisible(EFalse); |
446 MakeVisible(EFalse); |
386 if (iButtonGroupContainer) |
447 if (iButtonGroupContainer) |
387 { |
448 { |
388 // non visible CBA's do not recieve keys |
449 // non visible CBA's do not recieve keys |
389 iButtonGroupContainer->MakeVisible(EFalse); |
450 iButtonGroupContainer->MakeVisible(EFalse); |
390 } |
451 } |
452 _AKNTRACE_FUNC_EXIT; |
|
391 } |
453 } |
392 |
454 |
393 TInt CEikDialog::WaitAsRequired() |
455 TInt CEikDialog::WaitAsRequired() |
394 { |
456 { |
457 _AKNTRACE_FUNC_ENTER; |
|
395 TInt exitConfirmed=0; |
458 TInt exitConfirmed=0; |
396 #if defined (__DEBUG__) |
459 #if defined (__DEBUG__) |
397 RDebug::ProfileEnd(PROFILE_POINT_EIKON_DIALOG_LOAD); |
460 RDebug::ProfileEnd(PROFILE_POINT_EIKON_DIALOG_LOAD); |
398 TProfile profile; |
461 TProfile profile; |
399 RDebug::ProfileResult(&profile,PROFILE_POINT_EIKON_DIALOG_LOAD,1); |
462 RDebug::ProfileResult(&profile,PROFILE_POINT_EIKON_DIALOG_LOAD,1); |
406 if (iDialogFlags&EEikDialogFlagWait) |
469 if (iDialogFlags&EEikDialogFlagWait) |
407 { |
470 { |
408 iExitConfirmed=(&exitConfirmed); |
471 iExitConfirmed=(&exitConfirmed); |
409 iWait.Start(); |
472 iWait.Start(); |
410 } |
473 } |
411 |
474 _AKNTRACE_FUNC_EXIT; |
412 return(exitConfirmed); |
475 return(exitConfirmed); |
413 } |
476 } |
414 |
477 |
415 void CEikDialog::StopWaitingAsRequired() |
478 void CEikDialog::StopWaitingAsRequired() |
416 { |
479 { |
421 * Rouses a sleeping dialog by dynamically constructing it and then |
484 * Rouses a sleeping dialog by dynamically constructing it and then |
422 * bringing it to the front. |
485 * bringing it to the front. |
423 */ |
486 */ |
424 EXPORT_C TInt CEikDialog::RouseSleepingDialog() |
487 EXPORT_C TInt CEikDialog::RouseSleepingDialog() |
425 { // none of following ...L calls to Leave |
488 { // none of following ...L calls to Leave |
489 _AKNTRACE_FUNC_ENTER; |
|
426 if (IsVisible()) |
490 if (IsVisible()) |
427 ExitSleepingDialog(); // eg for rousing an already roused Alert dialog |
491 ExitSleepingDialog(); // eg for rousing an already roused Alert dialog |
428 |
492 |
429 |
493 |
430 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS |
494 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS |
539 static_cast<CEikCba*>(cba)->SetSkinBackgroundId( KAknsIIDQsnBgAreaControlPopup ); |
603 static_cast<CEikCba*>(cba)->SetSkinBackgroundId( KAknsIIDQsnBgAreaControlPopup ); |
540 cba->MakeVisible(ETrue); |
604 cba->MakeVisible(ETrue); |
541 cba->DrawNow(); |
605 cba->DrawNow(); |
542 } |
606 } |
543 } |
607 } |
544 |
608 _AKNTRACE_FUNC_EXIT; |
545 return(WaitAsRequired()); |
609 return(WaitAsRequired()); |
546 } |
610 } |
547 |
611 |
548 /** |
612 /** |
549 * Exits a sleeping dialog without deleteing it. |
613 * Exits a sleeping dialog without deleteing it. |
550 */ |
614 */ |
551 EXPORT_C void CEikDialog::ExitSleepingDialog() |
615 EXPORT_C void CEikDialog::ExitSleepingDialog() |
552 { |
616 { |
617 _AKNTRACE_FUNC_ENTER; |
|
553 FadeBehindPopup(EFalse); |
618 FadeBehindPopup(EFalse); |
554 |
619 |
555 EnableContentObserver( EFalse ); |
620 EnableContentObserver( EFalse ); |
556 |
621 |
557 if(GfxTransEffect::IsRegistered(this) && IsVisible() |
622 if(GfxTransEffect::IsRegistered(this) && IsVisible() |
613 { |
678 { |
614 iExtension->iSleepDialogExitBeginCalled = EFalse; |
679 iExtension->iSleepDialogExitBeginCalled = EFalse; |
615 } |
680 } |
616 #endif |
681 #endif |
617 CancelMediatorCommand(this); |
682 CancelMediatorCommand(this); |
683 _AKNTRACE_FUNC_EXIT; |
|
618 } |
684 } |
619 |
685 |
620 /** |
686 /** |
621 * Returns the id of the control in the line with focus. |
687 * Returns the id of the control in the line with focus. |
622 */ |
688 */ |
636 /** |
702 /** |
637 * Constructs the dialog from resources using the resource reader aReader. |
703 * Constructs the dialog from resources using the resource reader aReader. |
638 */ |
704 */ |
639 EXPORT_C void CEikDialog::ConstructFromResourceL(TResourceReader& aReader) |
705 EXPORT_C void CEikDialog::ConstructFromResourceL(TResourceReader& aReader) |
640 { |
706 { |
707 _AKNTRACE_FUNC_ENTER; |
|
641 iDialogFlags |=aReader.ReadInt32(); |
708 iDialogFlags |=aReader.ReadInt32(); |
642 |
709 |
643 #ifdef RD_SCALABLE_UI_V2 |
710 #ifdef RD_SCALABLE_UI_V2 |
644 if ( AknLayoutUtils::PenEnabled() ) |
711 if ( AknLayoutUtils::PenEnabled() ) |
645 { |
712 { |
665 } |
732 } |
666 else |
733 else |
667 ASSERT(aReader.ReadInt16()==0); |
734 ASSERT(aReader.ReadInt16()==0); |
668 |
735 |
669 SetBorderStyle(); // Moved to the end of construction to allow access to individual lines. |
736 SetBorderStyle(); // Moved to the end of construction to allow access to individual lines. |
737 _AKNTRACE_FUNC_EXIT; |
|
670 } |
738 } |
671 |
739 |
672 void CEikDialog::SetBorderStyle() |
740 void CEikDialog::SetBorderStyle() |
673 { |
741 { |
674 if (!((iDialogFlags&EEikDialogFlagFillAppClientRect) || |
742 if (!((iDialogFlags&EEikDialogFlagFillAppClientRect) || |
684 } |
752 } |
685 } |
753 } |
686 |
754 |
687 void CEikDialog::CreatePageSelectorL() |
755 void CEikDialog::CreatePageSelectorL() |
688 { |
756 { |
757 _AKNTRACE_FUNC_ENTER; |
|
689 iPageSelector=CEikDialogPageSelector::NewL(*this,this); |
758 iPageSelector=CEikDialogPageSelector::NewL(*this,this); |
690 iPageSelector->SetObserver(this); |
759 iPageSelector->SetObserver(this); |
691 RegisterDialgWithPageSelector(); // Added JIn |
760 RegisterDialgWithPageSelector(); // Added JIn |
761 _AKNTRACE_FUNC_EXIT; |
|
692 } |
762 } |
693 |
763 |
694 void CEikDialog::CreatePageSelectorL(TInt aResourceId) |
764 void CEikDialog::CreatePageSelectorL(TInt aResourceId) |
695 { |
765 { |
766 _AKNTRACE_FUNC_ENTER; |
|
696 if (aResourceId) |
767 if (aResourceId) |
697 { |
768 { |
698 TResourceReader reader; |
769 TResourceReader reader; |
699 iCoeEnv->CreateResourceReaderLC(reader,aResourceId); |
770 iCoeEnv->CreateResourceReaderLC(reader,aResourceId); |
700 iPageSelector=CEikDialogPageSelector::NewL(*this,reader,this); |
771 iPageSelector=CEikDialogPageSelector::NewL(*this,reader,this); |
702 CleanupStack::PopAndDestroy(); |
773 CleanupStack::PopAndDestroy(); |
703 if (iDialogFlags&EEikDialogFlagDensePacking) |
774 if (iDialogFlags&EEikDialogFlagDensePacking) |
704 iPageSelector->SetAllPagesDensePacked(ETrue); |
775 iPageSelector->SetAllPagesDensePacked(ETrue); |
705 RegisterDialgWithPageSelector(); // Added JIn |
776 RegisterDialgWithPageSelector(); // Added JIn |
706 } |
777 } |
778 _AKNTRACE_FUNC_EXIT; |
|
707 } |
779 } |
708 |
780 |
709 void CEikDialog::CreateButtonGroupContainerL(TInt aResourceId) |
781 void CEikDialog::CreateButtonGroupContainerL(TInt aResourceId) |
710 { |
782 { |
711 // Avkon simplification: Always use CBA; always set buttons |
783 // Avkon simplification: Always use CBA; always set buttons |
712 // Flags: |
784 // Flags: |
713 // buttons are keen on drawing even if not actually visible yet, |
785 // buttons are keen on drawing even if not actually visible yet, |
714 // don't activate them in case of sleeping dialog |
786 // don't activate them in case of sleeping dialog |
715 // yet so extra drawings are suppressed until dialog is really |
787 // yet so extra drawings are suppressed until dialog is really |
716 // roused to screen |
788 // roused to screen |
717 |
789 _AKNTRACE_FUNC_ENTER; |
718 TUint flags = ( iDialogFlags & EEikDialogFlagSleeping ) ? |
790 TUint flags = ( iDialogFlags & EEikDialogFlagSleeping ) ? |
719 ( CEikButtonGroupContainer::EAddToStack | |
791 ( CEikButtonGroupContainer::EAddToStack | |
720 CEikButtonGroupContainer::EDelayActivation ) : |
792 CEikButtonGroupContainer::EDelayActivation ) : |
721 CEikButtonGroupContainer::EAddToStack; |
793 CEikButtonGroupContainer::EAddToStack; |
722 |
794 |
734 CEikButtonGroupContainer::ECba, |
806 CEikButtonGroupContainer::ECba, |
735 CEikButtonGroupContainer::EHorizontal, |
807 CEikButtonGroupContainer::EHorizontal, |
736 iButtonCommandObserver, aResourceId, *this, flags ); |
808 iButtonCommandObserver, aResourceId, *this, flags ); |
737 |
809 |
738 EnableContentObserver( ETrue ); |
810 EnableContentObserver( ETrue ); |
811 |
|
812 if ( Extension() ) |
|
813 { |
|
814 Extension()->iButtonGroupResourceId = aResourceId; |
|
815 } |
|
739 |
816 |
740 AknGlobalPopupPriorityController::AddSubPopupL(*this, *iButtonGroupContainer->ButtonGroup()->AsControl()); |
817 AknGlobalPopupPriorityController::AddSubPopupL(*this, *iButtonGroupContainer->ButtonGroup()->AsControl()); |
741 AknGlobalPopupPriorityController::AddPopupToControlStackL(*iButtonGroupContainer->ButtonGroup()->AsControl(), ECoeStackPriorityCba, ECoeStackFlagRefusesFocus); |
818 AknGlobalPopupPriorityController::AddPopupToControlStackL(*iButtonGroupContainer->ButtonGroup()->AsControl(), ECoeStackPriorityCba, ECoeStackFlagRefusesFocus); |
819 _AKNTRACE_FUNC_EXIT; |
|
742 } |
820 } |
743 |
821 |
744 void CEikDialog::CreateTitleBarL() |
822 void CEikDialog::CreateTitleBarL() |
745 { |
823 { |
746 iTitleBar=new(ELeave) CEikMover; |
824 iTitleBar=new(ELeave) CEikMover; |
768 * The parameter is ignored if the FlagFillAppClientRect is set. |
846 * The parameter is ignored if the FlagFillAppClientRect is set. |
769 * Otherwise it it centred and given the size asked for |
847 * Otherwise it it centred and given the size asked for |
770 */ |
848 */ |
771 EXPORT_C void CEikDialog::SetSizeAndPosition(const TSize& aSize) |
849 EXPORT_C void CEikDialog::SetSizeAndPosition(const TSize& aSize) |
772 { |
850 { |
851 _AKNTRACE_FUNC_ENTER; |
|
773 if (iDialogFlags&EEikDialogFlagFillAppClientRect) |
852 if (iDialogFlags&EEikDialogFlagFillAppClientRect) |
774 { |
853 { |
854 TRect destRect = iEikonEnv->EikAppUi()->ClientRect(); |
|
855 // if this is a view app then ask client rect from the currently active view |
|
856 TVwsViewId uid; |
|
857 if ( iAvkonAppUi->GetActiveViewId( uid ) == KErrNone ) |
|
858 { |
|
859 if ( uid.iAppUid != uid.iViewUid ) |
|
860 { |
|
861 CAknView* view = iAvkonViewAppUi->View( uid.iViewUid ); |
|
862 if ( view ) |
|
863 { |
|
864 destRect = view->ClientRect(); |
|
865 } |
|
866 } |
|
867 } |
|
868 |
|
869 if ( !Layout_Meta_Data::IsLandscapeOrientation() && iButtonGroupContainer != NULL ) |
|
870 { |
|
871 TRect controlPane; |
|
872 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EControlPane, controlPane ); |
|
873 |
|
874 if ( destRect.iBr.iY > controlPane.iTl.iY ) |
|
875 { |
|
876 destRect.iBr.iY = controlPane.iTl.iY; |
|
877 } |
|
878 } |
|
879 SetRect( destRect ); |
|
880 } |
|
881 else |
|
882 { |
|
883 SetRect( TRect( AknPopupUtils::Position( aSize, this ), aSize ) ); |
|
884 } |
|
885 _AKNTRACE_FUNC_EXIT; |
|
886 } |
|
887 |
|
888 /** |
|
889 * Returns the border style for this dialog. |
|
890 */ |
|
891 EXPORT_C TInt CEikDialog::BorderStyle() |
|
892 { |
|
893 #ifndef RD_NO_DIALOG_BORDERS |
|
894 return AknBorderId::EAknBorderNotePopup; |
|
895 #else |
|
896 return TGulBorder::ENone; |
|
897 #endif |
|
898 } |
|
899 |
|
900 /** |
|
901 * Returns the minimum size of the area that the contents of the dialog should occupy. |
|
902 */ |
|
903 EXPORT_C TSize CEikDialog::MinimumSize() |
|
904 { |
|
905 _AKNTRACE_FUNC_ENTER; |
|
906 if (iDialogFlags&EEikDialogFlagFillScreen) |
|
907 { |
|
908 TAknWindowLineLayout windowLineLayoutScreen = AknLayoutScalable_Avkon::Screen().LayoutLine(); |
|
909 TRect rectZero = TRect(0,0,0,0); |
|
910 TAknLayoutRect layoutRect; |
|
911 layoutRect.LayoutRect( rectZero, windowLineLayoutScreen ); |
|
912 TRect rectScreen( layoutRect.Rect() ); |
|
913 |
|
914 return rectScreen.Size(); |
|
915 } |
|
916 else if (iDialogFlags&EEikDialogFlagFillAppClientRect) |
|
917 { |
|
775 // if this is a view app then ask client rect from the currently active view |
918 // if this is a view app then ask client rect from the currently active view |
776 TVwsViewId uid; |
919 TVwsViewId uid; |
777 if ( iAvkonAppUi->GetActiveViewId( uid ) == KErrNone ) |
920 if ( iAvkonAppUi->GetActiveViewId( uid ) == KErrNone ) |
778 { |
921 { |
779 if ( uid.iAppUid != uid.iViewUid ) |
922 if ( uid.iAppUid != uid.iViewUid ) |
791 else |
934 else |
792 { |
935 { |
793 SetRect(iEikonEnv->EikAppUi()->ClientRect()); |
936 SetRect(iEikonEnv->EikAppUi()->ClientRect()); |
794 } |
937 } |
795 } |
938 } |
796 else |
939 else |
797 { |
940 { |
798 SetRect( iEikonEnv->EikAppUi()->ClientRect() ); |
941 SetRect( iEikonEnv->EikAppUi()->ClientRect() ); |
799 } |
942 } |
800 } |
|
801 else |
|
802 { |
|
803 SetRect( TRect( AknPopupUtils::Position( aSize, this ), aSize ) ); |
|
804 } |
|
805 } |
|
806 |
|
807 /** |
|
808 * Returns the border style for this dialog. |
|
809 */ |
|
810 EXPORT_C TInt CEikDialog::BorderStyle() |
|
811 { |
|
812 #ifndef RD_NO_DIALOG_BORDERS |
|
813 return AknBorderId::EAknBorderNotePopup; |
|
814 #else |
|
815 return TGulBorder::ENone; |
|
816 #endif |
|
817 } |
|
818 |
|
819 /** |
|
820 * Returns the minimum size of the area that the contents of the dialog should occupy. |
|
821 */ |
|
822 EXPORT_C TSize CEikDialog::MinimumSize() |
|
823 { |
|
824 if (iDialogFlags&EEikDialogFlagFillScreen) |
|
825 { |
|
826 TAknWindowLineLayout windowLineLayoutScreen = AknLayoutScalable_Avkon::Screen().LayoutLine(); |
|
827 TRect rectZero = TRect(0,0,0,0); |
|
828 TAknLayoutRect layoutRect; |
|
829 layoutRect.LayoutRect( rectZero, windowLineLayoutScreen ); |
|
830 TRect rectScreen( layoutRect.Rect() ); |
|
831 |
|
832 return rectScreen.Size(); |
|
833 } |
|
834 else if (iDialogFlags&EEikDialogFlagFillAppClientRect) |
|
835 { |
|
836 // if this is a view app then ask client rect from the currently active view |
|
837 TVwsViewId uid; |
|
838 if ( iAvkonAppUi->GetActiveViewId( uid ) == KErrNone ) |
|
839 { |
|
840 if ( uid.iAppUid != uid.iViewUid ) |
|
841 { |
|
842 CAknView* view = iAvkonViewAppUi->View(uid.iViewUid); |
|
843 if (view) |
|
844 { |
|
845 SetRect(view->ClientRect()); |
|
846 } |
|
847 else |
|
848 { |
|
849 SetRect(iEikonEnv->EikAppUi()->ClientRect()); |
|
850 } |
|
851 } |
|
852 else |
|
853 { |
|
854 SetRect(iEikonEnv->EikAppUi()->ClientRect()); |
|
855 } |
|
856 } |
|
857 else |
|
858 { |
|
859 SetRect( iEikonEnv->EikAppUi()->ClientRect() ); |
|
860 } |
|
861 } |
943 } |
862 |
944 |
863 TSize pageSelectorSize(iPageSelector->MinimumSize()); |
945 TSize pageSelectorSize(iPageSelector->MinimumSize()); |
864 |
946 _AKNTRACE_FUNC_EXIT; |
865 return pageSelectorSize; |
947 return pageSelectorSize; |
866 } |
948 } |
867 |
949 |
868 /** |
950 /** |
869 * Returns the preferred size of the dialog given that it must fit in a maximum size of aMaxSize. |
951 * Returns the preferred size of the dialog given that it must fit in a maximum size of aMaxSize. |
870 * |
952 * |
871 * @since ER5U |
953 * @since ER5U |
872 */ |
954 */ |
873 EXPORT_C TSize CEikDialog::PreferredSize(const TSize& aMaxSize) const |
955 EXPORT_C TSize CEikDialog::PreferredSize(const TSize& aMaxSize) const |
874 { |
956 { |
957 _AKNTRACE_FUNC_ENTER; |
|
875 if (iDialogFlags&EEikDialogFlagFillScreen) |
958 if (iDialogFlags&EEikDialogFlagFillScreen) |
876 return iEikonEnv->ScreenDevice()->SizeInPixels(); |
959 return iEikonEnv->ScreenDevice()->SizeInPixels(); |
877 else if (iDialogFlags&EEikDialogFlagFillAppClientRect) |
960 else if (iDialogFlags&EEikDialogFlagFillAppClientRect) |
878 |
961 |
879 { |
962 { |
884 if ( uid.iAppUid != uid.iViewUid ) |
967 if ( uid.iAppUid != uid.iViewUid ) |
885 { |
968 { |
886 CAknView* view = iAvkonViewAppUi->View(uid.iViewUid); |
969 CAknView* view = iAvkonViewAppUi->View(uid.iViewUid); |
887 if (view) |
970 if (view) |
888 { |
971 { |
972 _AKNTRACE_FUNC_EXIT; |
|
889 return view->ClientRect().Size(); |
973 return view->ClientRect().Size(); |
890 } |
974 } |
891 else |
975 else |
892 { |
976 { |
977 _AKNTRACE_FUNC_EXIT; |
|
893 return iEikonEnv->EikAppUi()->ClientRect().Size(); |
978 return iEikonEnv->EikAppUi()->ClientRect().Size(); |
894 } |
979 } |
895 } |
980 } |
896 else |
981 else |
897 { |
982 { |
983 _AKNTRACE_FUNC_EXIT; |
|
898 return iEikonEnv->EikAppUi()->ClientRect().Size(); |
984 return iEikonEnv->EikAppUi()->ClientRect().Size(); |
899 } |
985 } |
900 } |
986 } |
901 else |
987 else |
902 { |
988 { |
989 _AKNTRACE_FUNC_EXIT; |
|
903 return iEikonEnv->EikAppUi()->ClientRect().Size(); |
990 return iEikonEnv->EikAppUi()->ClientRect().Size(); |
904 } |
991 } |
905 } |
992 } |
906 |
993 |
907 |
994 |
948 |
1035 |
949 preferredSize += TSize( 0, cbaRect.Rect().Height() ); |
1036 preferredSize += TSize( 0, cbaRect.Rect().Height() ); |
950 } |
1037 } |
951 } |
1038 } |
952 |
1039 |
1040 _AKNTRACE_FUNC_EXIT; |
|
953 return preferredSize; |
1041 return preferredSize; |
954 } |
1042 } |
955 |
1043 |
956 /** |
1044 /** |
957 * Lays out the dialog's components when the size of the dialog is changed. |
1045 * Lays out the dialog's components when the size of the dialog is changed. |
959 * For Avkon, the DPSEL always stays the same size as the CEikDialog minus an optional title |
1047 * For Avkon, the DPSEL always stays the same size as the CEikDialog minus an optional title |
960 * bar. |
1048 * bar. |
961 */ |
1049 */ |
962 EXPORT_C void CEikDialog::SizeChanged() |
1050 EXPORT_C void CEikDialog::SizeChanged() |
963 { |
1051 { |
1052 _AKNTRACE_FUNC_ENTER; |
|
964 __ASSERT_DEBUG( iButtonGroupContainer->Location() == CEikButtonGroupContainer::EExternal, |
1053 __ASSERT_DEBUG( iButtonGroupContainer->Location() == CEikButtonGroupContainer::EExternal, |
965 Panic( EEikDialogPanicIllegalOption ) ); |
1054 Panic( EEikDialogPanicIllegalOption ) ); |
966 |
1055 |
967 TInt excludeCbaHeight = -1; |
1056 TInt excludeCbaHeight = -1; |
968 |
1057 |
1015 { |
1104 { |
1016 // Otherway softkeys are located out of dialog rect |
1105 // Otherway softkeys are located out of dialog rect |
1017 cba->SetRect( TRect(0, 0, 0, 0 ) ); |
1106 cba->SetRect( TRect(0, 0, 0, 0 ) ); |
1018 } |
1107 } |
1019 } |
1108 } |
1020 } |
1109 |
1110 if ( Extension() ) |
|
1111 { |
|
1112 Extension()->iDeleteEmbeddedCba = EFalse; |
|
1113 } |
|
1114 } |
|
1021 if (iTitleBar) |
1115 if (iTitleBar) |
1022 { |
1116 { |
1023 TRect nullRect(0,0,0,0); |
1117 TRect nullRect(0,0,0,0); |
1024 iTitleBar->SetRect( nullRect ); |
1118 iTitleBar->SetRect( nullRect ); |
1025 } |
1119 } |
1045 currentPage->SetFormFlag( CEikDialogPage::EFormResizeOptimisationFlag, EFalse ) ; |
1139 currentPage->SetFormFlag( CEikDialogPage::EFormResizeOptimisationFlag, EFalse ) ; |
1046 |
1140 |
1047 // <SKIN> |
1141 // <SKIN> |
1048 iExtension->iBgContext->SetParentPos( PositionRelativeToScreen() ) ; |
1142 iExtension->iBgContext->SetParentPos( PositionRelativeToScreen() ) ; |
1049 iExtension->iBgContext->SetRect( Rect() ) ; |
1143 iExtension->iBgContext->SetRect( Rect() ) ; |
1144 _AKNTRACE_FUNC_EXIT; |
|
1050 } |
1145 } |
1051 |
1146 |
1052 /** |
1147 /** |
1053 * Sets the title text for the dialog to aText. |
1148 * Sets the title text for the dialog to aText. |
1054 */ |
1149 */ |
1097 * Makes the dialog line containing the control identified by aControlId visible, i.e. sets it |
1192 * Makes the dialog line containing the control identified by aControlId visible, i.e. sets it |
1098 * to draw itself, if aVisible is ETrue. |
1193 * to draw itself, if aVisible is ETrue. |
1099 */ |
1194 */ |
1100 EXPORT_C void CEikDialog::MakeLineVisible(TInt aControlId,TBool aVisible) |
1195 EXPORT_C void CEikDialog::MakeLineVisible(TInt aControlId,TBool aVisible) |
1101 { |
1196 { |
1197 _AKNTRACE_FUNC_ENTER; |
|
1102 CEikCaptionedControl* line=Line(aControlId); |
1198 CEikCaptionedControl* line=Line(aControlId); |
1103 CCoeControl* control=line->iControl; |
1199 CCoeControl* control=line->iControl; |
1104 if (control->IsVisible()==aVisible) |
1200 if (control->IsVisible()==aVisible) |
1105 return; |
1201 return; |
1106 control->MakeVisible(aVisible); |
1202 control->MakeVisible(aVisible); |
1107 line->CheckDimmedDisplayState(); |
1203 line->CheckDimmedDisplayState(); |
1204 _AKNTRACE_FUNC_EXIT; |
|
1108 } |
1205 } |
1109 |
1206 |
1110 /** |
1207 /** |
1111 * Makes the whole dialog line containing the control identified by aControlId visible, i.e. sets it |
1208 * Makes the whole dialog line containing the control identified by aControlId visible, i.e. sets it |
1112 * to draw itself, if aVisible is ETrue. |
1209 * to draw itself, if aVisible is ETrue. |
1113 */ |
1210 */ |
1114 EXPORT_C void CEikDialog::MakeWholeLineVisible(TInt aControlId,TBool aVisible) |
1211 EXPORT_C void CEikDialog::MakeWholeLineVisible(TInt aControlId,TBool aVisible) |
1115 { |
1212 { |
1213 _AKNTRACE_FUNC_ENTER; |
|
1116 CEikCaptionedControl* line=Line(aControlId); |
1214 CEikCaptionedControl* line=Line(aControlId); |
1117 if (line->IsVisible()==aVisible) |
1215 if (line->IsVisible()==aVisible) |
1118 return; |
1216 return; |
1119 CCoeControl* control=line->iControl; |
1217 CCoeControl* control=line->iControl; |
1120 if (line->iCaption) |
1218 if (line->iCaption) |
1121 line->iCaption->MakeVisible(aVisible); |
1219 line->iCaption->MakeVisible(aVisible); |
1122 if (line->iTrailer) |
1220 if (line->iTrailer) |
1123 line->iTrailer->MakeVisible(aVisible); |
1221 line->iTrailer->MakeVisible(aVisible); |
1124 control->MakeVisible(aVisible); |
1222 control->MakeVisible(aVisible); |
1125 line->MakeVisible(aVisible); |
1223 line->MakeVisible(aVisible); |
1224 _AKNTRACE_FUNC_EXIT; |
|
1126 } |
1225 } |
1127 |
1226 |
1128 /** |
1227 /** |
1129 * Lays out the dialog, setting it to take its preferred size and position |
1228 * Lays out the dialog, setting it to take its preferred size and position |
1130 * for the screen. |
1229 * for the screen. |
1135 * |
1234 * |
1136 * @since ER5U |
1235 * @since ER5U |
1137 */ |
1236 */ |
1138 EXPORT_C void CEikDialog::Layout() |
1237 EXPORT_C void CEikDialog::Layout() |
1139 { |
1238 { |
1239 _AKNTRACE_FUNC_ENTER; |
|
1140 TAknWindowLineLayout windowLineLayoutScreen = AknLayoutScalable_Avkon::Screen().LayoutLine(); |
1240 TAknWindowLineLayout windowLineLayoutScreen = AknLayoutScalable_Avkon::Screen().LayoutLine(); |
1141 TRect rectZero = TRect(0,0,0,0); |
1241 TRect rectZero = TRect(0,0,0,0); |
1142 TAknLayoutRect layoutRect; |
1242 TAknLayoutRect layoutRect; |
1143 layoutRect.LayoutRect( rectZero, windowLineLayoutScreen ); |
1243 layoutRect.LayoutRect( rectZero, windowLineLayoutScreen ); |
1144 TRect rectScreen( layoutRect.Rect() ); |
1244 TRect rectScreen( layoutRect.Rect() ); |
1145 |
1245 |
1146 TSize maxSize = rectScreen.Size(); |
1246 TSize maxSize = rectScreen.Size(); |
1147 |
1247 |
1248 _AKNTRACE( "size = %d x %d", iSize.iWidth, iSize.iHeight ); |
|
1148 SetSizeAndPosition(PreferredSize( maxSize )); |
1249 SetSizeAndPosition(PreferredSize( maxSize )); |
1250 _AKNTRACE( "size = %d x %d", iSize.iWidth, iSize.iHeight ); |
|
1251 _AKNTRACE_FUNC_EXIT; |
|
1149 } |
1252 } |
1150 |
1253 |
1151 /** |
1254 /** |
1152 * Deletes the dialog line with the control identified by aControlId. |
1255 * Deletes the dialog line with the control identified by aControlId. |
1153 */ |
1256 */ |
1259 { |
1362 { |
1260 CEikCaptionedControl* line=Line(aControlId); |
1363 CEikCaptionedControl* line=Line(aControlId); |
1261 if (line) |
1364 if (line) |
1262 { |
1365 { |
1263 line->SetCaptionL(aText); |
1366 line->SetCaptionL(aText); |
1264 line->DrawNow(); |
1367 line->DrawDeferred(); |
1265 } |
1368 } |
1266 } |
1369 } |
1267 |
1370 |
1268 /** |
1371 /** |
1269 * Sets the caption of the control identified by aControlId by reading the caption |
1372 * Sets the caption of the control identified by aControlId by reading the caption |
1377 * |
1480 * |
1378 * @since ER5U |
1481 * @since ER5U |
1379 */ |
1482 */ |
1380 EXPORT_C void CEikDialog::SetEditableL( TBool aEditable ) |
1483 EXPORT_C void CEikDialog::SetEditableL( TBool aEditable ) |
1381 { |
1484 { |
1485 _AKNTRACE_FUNC_ENTER; |
|
1486 _AKNTRACE( "CEikDialog::SetEditableL() aEditable: [%d]", aEditable ); |
|
1382 if ( !iExtension->iFlags[CEikDialogExtension::EEditableStateInitialised] || |
1487 if ( !iExtension->iFlags[CEikDialogExtension::EEditableStateInitialised] || |
1383 iIsEditable != aEditable ) |
1488 iIsEditable != aEditable ) |
1384 { |
1489 { |
1385 iExtension->iFlags.Set(CEikDialogExtension::EEditableStateInitialised); |
1490 iExtension->iFlags.Set(CEikDialogExtension::EEditableStateInitialised); |
1386 iIsEditable = aEditable ; |
1491 iIsEditable = aEditable ; |
1387 // tell each of the pages on the dialog about the editable state... |
1492 // tell each of the pages on the dialog about the editable state... |
1388 iPageSelector->SetEditableL( aEditable ); |
1493 iPageSelector->SetEditableL( aEditable ); |
1389 DrawNow(); |
1494 DrawNow(); |
1390 } |
1495 } |
1496 _AKNTRACE_FUNC_EXIT; |
|
1391 } |
1497 } |
1392 |
1498 |
1393 /** |
1499 /** |
1394 * Returns the Editable state. This exists to support forms |
1500 * Returns the Editable state. This exists to support forms |
1395 * |
1501 * |
1396 * @since ER5U |
1502 * @since ER5U |
1397 */ |
1503 */ |
1398 EXPORT_C TBool CEikDialog::IsEditable() const |
1504 EXPORT_C TBool CEikDialog::IsEditable() const |
1399 { |
1505 { |
1506 _AKNTRACE( "CEikDialog::IsEditable(): [%d]", iIsEditable );; |
|
1400 return ( iIsEditable ) ; |
1507 return ( iIsEditable ) ; |
1401 } |
1508 } |
1402 |
1509 |
1403 /** |
1510 /** |
1404 * Returns the line index of the control aControl or KErrNotFound if the control |
1511 * Returns the line index of the control aControl or KErrNotFound if the control |
1450 * Runs the dialog and returns the id of the button used to dismiss it. |
1557 * Runs the dialog and returns the id of the button used to dismiss it. |
1451 * The dialog is destroyed on exit. |
1558 * The dialog is destroyed on exit. |
1452 */ |
1559 */ |
1453 EXPORT_C TInt CEikDialog::RunLD() |
1560 EXPORT_C TInt CEikDialog::RunLD() |
1454 { |
1561 { |
1562 _AKNTRACE_FUNC_ENTER; |
|
1455 // Moved BringForwards in the beginning to enable 1-frame animations. |
1563 // Moved BringForwards in the beginning to enable 1-frame animations. |
1456 iEikonEnv->BringForwards(ETrue); // before call to EnableBackup() |
1564 iEikonEnv->BringForwards(ETrue); // before call to EnableBackup() |
1457 AknGlobalPopupPriorityController::ShowPopup(*this, ETrue); |
1565 AknGlobalPopupPriorityController::ShowPopup(*this, ETrue); |
1458 iDialogFlags|=EEikDialogFlagBroughtForward; |
1566 iDialogFlags|=EEikDialogFlagBroughtForward; |
1459 |
1567 |
1545 CAknTransitionUtils::SetAllParents(this); |
1653 CAknTransitionUtils::SetAllParents(this); |
1546 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS |
1654 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS |
1547 GfxTransEffect::NotifyExternalState(EInternalHandleSequence, (const TDesC8*)this); |
1655 GfxTransEffect::NotifyExternalState(EInternalHandleSequence, (const TDesC8*)this); |
1548 #endif |
1656 #endif |
1549 GfxTransEffect::Begin(this, KGfxControlAppearAction); |
1657 GfxTransEffect::Begin(this, KGfxControlAppearAction); |
1658 MTouchFeedback* feedback = NULL; |
|
1659 if( AknLayoutUtils::PenEnabled() ) |
|
1660 { |
|
1661 feedback = static_cast<MTouchFeedback*>( ExtensionInterface( KExIfTactileFeedbackUid ) ); |
|
1662 } |
|
1663 if( feedback ) |
|
1664 { |
|
1665 if( CAknTransitionUtils::TransitionsEnabled( AknTransEffect::EComponentTransitionsOff ) ) |
|
1666 { |
|
1667 feedback->InstantFeedback( this, ETouchFeedbackIncreasingPopUp, |
|
1668 ETouchFeedbackVibra, TPointerEvent() ); |
|
1669 } |
|
1670 else |
|
1671 { |
|
1672 feedback->InstantFeedback( this, ETouchFeedbackPopUp, |
|
1673 ETouchFeedbackVibra, TPointerEvent() ); |
|
1674 } |
|
1675 } |
|
1550 GfxTransEffect::NotifyExternalState(ECaptureComponentsBegin, (const TDesC8*)this); |
1676 GfxTransEffect::NotifyExternalState(ECaptureComponentsBegin, (const TDesC8*)this); |
1551 |
1677 |
1552 TRect demarcation; |
1678 TRect demarcation; |
1553 CAknTransitionUtils::GetDemarcation(CAknTransitionUtils::EPopup, demarcation); |
1679 CAknTransitionUtils::GetDemarcation(CAknTransitionUtils::EPopup, demarcation); |
1554 GfxTransEffect::SetDemarcation(this, demarcation); |
1680 GfxTransEffect::SetDemarcation(this, demarcation); |
1571 } |
1697 } |
1572 |
1698 |
1573 // Claim pointer grab and send the pointer up event to the |
1699 // Claim pointer grab and send the pointer up event to the |
1574 // control that otherwise would be receiving the drag events. |
1700 // control that otherwise would be receiving the drag events. |
1575 Window().ClaimPointerGrab(ETrue); |
1701 Window().ClaimPointerGrab(ETrue); |
1576 |
1702 _AKNTRACE_FUNC_EXIT; |
1577 return(WaitAsRequired()); |
1703 return(WaitAsRequired()); |
1578 } |
1704 } |
1579 |
1705 |
1580 |
1706 |
1581 EXPORT_C void CEikDialog::Draw(const TRect& /*aRect*/) const |
1707 EXPORT_C void CEikDialog::Draw(const TRect& /*aRect*/) const |
1582 { |
1708 { |
1709 _AKNTRACE_FUNC_ENTER; |
|
1583 TRect rect=Rect(); |
1710 TRect rect=Rect(); |
1584 CWindowGc& gc=SystemGc(); //No reason to demote the gc, CWindowGc is more usable. |
1711 CWindowGc& gc=SystemGc(); //No reason to demote the gc, CWindowGc is more usable. |
1585 |
1712 |
1586 if ( iExtension->LayoutCategory() == CEikDialogExtension::EPopupLayout ) |
1713 if ( iExtension->LayoutCategory() == CEikDialogExtension::EPopupLayout ) |
1587 { |
1714 { |
1665 { |
1792 { |
1666 AknsDrawUtils::DrawFrame( skin, gc, outerRect, innerRect, |
1793 AknsDrawUtils::DrawFrame( skin, gc, outerRect, innerRect, |
1667 KAknsIIDQsnFrPopup,KAknsIIDQsnFrPopupCenter); |
1794 KAknsIIDQsnFrPopup,KAknsIIDQsnFrPopupCenter); |
1668 } |
1795 } |
1669 } |
1796 } |
1797 _AKNTRACE_FUNC_EXIT; |
|
1670 } |
1798 } |
1671 |
1799 |
1672 EXPORT_C void CEikDialog::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
1800 EXPORT_C void CEikDialog::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
1673 { |
1801 { |
1674 CEikBorderedControl::HandlePointerEventL(aPointerEvent); |
1802 CEikBorderedControl::HandlePointerEventL(aPointerEvent); |
1679 return NULL; |
1807 return NULL; |
1680 } |
1808 } |
1681 |
1809 |
1682 TKeyResponse CEikDialog::TryAnimateButtonAndExitL(TInt aKeycode) |
1810 TKeyResponse CEikDialog::TryAnimateButtonAndExitL(TInt aKeycode) |
1683 { |
1811 { |
1812 _AKNTRACE_FUNC_ENTER; |
|
1684 TInt buttonId=EEikBidCancel; |
1813 TInt buttonId=EEikBidCancel; |
1685 switch (aKeycode) |
1814 switch (aKeycode) |
1686 { |
1815 { |
1687 case EKeyEnter: |
1816 case EKeyEnter: |
1688 case EKeyOK: |
1817 case EKeyOK: |
1702 CEikButtonGroupContainer& buttonGroupContainer = ButtonGroupContainer(); |
1831 CEikButtonGroupContainer& buttonGroupContainer = ButtonGroupContainer(); |
1703 CCoeControl* button = buttonGroupContainer.ControlOrNull(buttonId); |
1832 CCoeControl* button = buttonGroupContainer.ControlOrNull(buttonId); |
1704 |
1833 |
1705 if (button) |
1834 if (button) |
1706 { |
1835 { |
1707 if (button->IsDimmed() || !button->IsVisible()) |
1836 TBool animateCommand = ( !button->IsDimmed() && button->IsVisible() ); |
1708 return EKeyWasNotConsumed; |
1837 |
1709 buttonGroupContainer.AnimateCommand(buttonId); |
1838 if ( !animateCommand && buttonId != EEikBidCancel ) |
1839 { |
|
1840 _AKNTRACE_FUNC_EXIT; |
|
1841 return EKeyWasNotConsumed; |
|
1842 } |
|
1843 else if ( animateCommand ) |
|
1844 { |
|
1845 buttonGroupContainer.AnimateCommand( buttonId ); |
|
1846 } |
|
1710 } |
1847 } |
1711 |
1848 |
1712 if (button || buttonId==EEikBidCancel || buttonId==EEikBidOk) |
1849 if (button || buttonId==EEikBidCancel || buttonId==EEikBidOk) |
1713 { |
1850 { |
1714 TryExitL(buttonId); |
1851 TryExitL(buttonId); |
1852 _AKNTRACE_FUNC_EXIT; |
|
1715 return EKeyWasConsumed; |
1853 return EKeyWasConsumed; |
1716 } |
1854 } |
1717 |
1855 _AKNTRACE_FUNC_EXIT; |
1718 return EKeyWasNotConsumed; |
1856 return EKeyWasNotConsumed; |
1719 } |
1857 } |
1720 |
1858 |
1721 /** |
1859 /** |
1722 * Prepares for a transistion in focus in the dialog. By default, calls the currently |
1860 * Prepares for a transistion in focus in the dialog. By default, calls the currently |
1733 * Handles the key event aKeyEvent with code aType. Returns EKeyWasConsumed if the control |
1871 * Handles the key event aKeyEvent with code aType. Returns EKeyWasConsumed if the control |
1734 * takes action on the key event or EKeyWasNotConsumed otherwise. |
1872 * takes action on the key event or EKeyWasNotConsumed otherwise. |
1735 */ |
1873 */ |
1736 EXPORT_C TKeyResponse CEikDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) |
1874 EXPORT_C TKeyResponse CEikDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) |
1737 { |
1875 { |
1738 |
1876 _AKNTRACE_FUNC_ENTER; |
1739 |
1877 |
1740 // Hide the tool tip (if there is one!) |
1878 // Hide the tool tip (if there is one!) |
1741 if ( ( iPageSelector->NumPages() == 1 ) && ( CurrentLine() ) && ( CurrentLine()->ToolTipText( ) ) ) |
1879 if ( ( iPageSelector->NumPages() == 1 ) && ( CurrentLine() ) && ( CurrentLine()->ToolTipText( ) ) ) |
1742 { |
1880 { |
1743 switch ( aKeyEvent.iScanCode ) |
1881 switch ( aKeyEvent.iScanCode ) |
1748 } |
1886 } |
1749 } |
1887 } |
1750 if (!(iDialogFlags&EEikDialogFlagDontEatUpDownEvents) && aKeyEvent.iScanCode != EStdKeyYes) |
1888 if (!(iDialogFlags&EEikDialogFlagDontEatUpDownEvents) && aKeyEvent.iScanCode != EStdKeyYes) |
1751 { |
1889 { |
1752 if (aType!=EEventKey) |
1890 if (aType!=EEventKey) |
1753 return(EKeyWasConsumed); |
1891 { |
1892 _AKNTRACE_FUNC_EXIT; |
|
1893 return(EKeyWasConsumed); |
|
1894 } |
|
1754 } |
1895 } |
1755 |
1896 |
1756 TInt code=aKeyEvent.iCode; |
1897 TInt code=aKeyEvent.iCode; |
1757 const TUint modifiers = aKeyEvent.iModifiers; |
1898 const TUint modifiers = aKeyEvent.iModifiers; |
1758 TKeyResponse response; |
1899 TKeyResponse response; |
1761 |
1902 |
1762 if (iDialogFlags&EEikDialogFlagAllKeysToButtons || ((modifiers & EAllStdModifiers) == EModifierCtrl) ) |
1903 if (iDialogFlags&EEikDialogFlagAllKeysToButtons || ((modifiers & EAllStdModifiers) == EModifierCtrl) ) |
1763 { |
1904 { |
1764 response = iButtonGroupContainer->OfferKeyEventL(aKeyEvent,aType); |
1905 response = iButtonGroupContainer->OfferKeyEventL(aKeyEvent,aType); |
1765 if(response==EKeyWasConsumed) |
1906 if(response==EKeyWasConsumed) |
1766 return EKeyWasConsumed; |
1907 { |
1908 _AKNTRACE_FUNC_EXIT; |
|
1909 return EKeyWasConsumed; |
|
1910 } |
|
1767 } |
1911 } |
1768 |
1912 |
1769 // |
1913 // |
1770 |
1914 |
1771 switch (code) |
1915 switch (code) |
1784 case EKeyEscape: |
1928 case EKeyEscape: |
1785 if (modifiers&EModifierShift) |
1929 if (modifiers&EModifierShift) |
1786 iPageSelector->OfferKeyEventL(aKeyEvent, aType); |
1930 iPageSelector->OfferKeyEventL(aKeyEvent, aType); |
1787 // Add to remove repeated keypress return event of OK key |
1931 // Add to remove repeated keypress return event of OK key |
1788 if (aKeyEvent.iRepeats&&EKeyOK==code) |
1932 if (aKeyEvent.iRepeats&&EKeyOK==code) |
1789 return EKeyWasConsumed; |
1933 { |
1934 _AKNTRACE_FUNC_EXIT; |
|
1935 return EKeyWasConsumed; |
|
1936 } |
|
1790 if ((!(modifiers&EModifierCtrl) || modifiers&EModifierPureKeycode) && |
1937 if ((!(modifiers&EModifierCtrl) || modifiers&EModifierPureKeycode) && |
1791 !(iDialogFlags&EEikDialogFlagModeless)) |
1938 !(iDialogFlags&EEikDialogFlagModeless)) |
1792 TryAnimateButtonAndExitL(code); |
1939 TryAnimateButtonAndExitL(code); |
1793 break; |
1940 break; |
1794 case EKeyTab: |
1941 case EKeyTab: |
1806 default: |
1953 default: |
1807 iPageSelector->OfferKeyEventL(aKeyEvent, aType); |
1954 iPageSelector->OfferKeyEventL(aKeyEvent, aType); |
1808 break; |
1955 break; |
1809 KeyToFocus: |
1956 KeyToFocus: |
1810 if(iPageSelector->OfferHotKeysKeyEventL(aKeyEvent,aType)==EKeyWasConsumed) |
1957 if(iPageSelector->OfferHotKeysKeyEventL(aKeyEvent,aType)==EKeyWasConsumed) |
1811 return EKeyWasConsumed; |
1958 { |
1812 |
1959 _AKNTRACE_FUNC_EXIT; |
1813 } |
1960 return EKeyWasConsumed; |
1814 |
1961 } |
1962 } |
|
1963 _AKNTRACE_FUNC_EXIT; |
|
1815 return (aKeyEvent.iScanCode == EStdKeyYes ? EKeyWasNotConsumed:EKeyWasConsumed); |
1964 return (aKeyEvent.iScanCode == EStdKeyYes ? EKeyWasNotConsumed:EKeyWasConsumed); |
1816 } |
1965 } |
1817 |
1966 |
1818 /** |
1967 /** |
1819 * Hands focus to current dialog line. |
1968 * Hands focus to current dialog line. |
1820 */ |
1969 */ |
1821 EXPORT_C void CEikDialog::FocusChanged(TDrawNow aDrawNow) |
1970 EXPORT_C void CEikDialog::FocusChanged(TDrawNow aDrawNow) |
1822 { |
1971 { |
1972 _AKNTRACE_FUNC_ENTER; |
|
1823 CEikBorderedControl::FocusChanged( aDrawNow ); |
1973 CEikBorderedControl::FocusChanged( aDrawNow ); |
1824 |
1974 |
1825 TInt controlID = IdOfFocusControl(); |
1975 TInt controlID = IdOfFocusControl(); |
1826 if (controlID) |
1976 if (controlID) |
1827 { |
1977 { |
1828 Line(controlID)->SetFocus(IsFocused(), aDrawNow); |
1978 Line(controlID)->SetFocus(IsFocused(), aDrawNow); |
1829 } |
1979 } |
1980 _AKNTRACE_FUNC_EXIT; |
|
1830 } |
1981 } |
1831 |
1982 |
1832 /** |
1983 /** |
1833 * Tries to initiate user exit of the dialog when the button identified |
1984 * Tries to initiate user exit of the dialog when the button identified |
1834 * by aButtonId is pressed, if this button should exit the dialog. See OkToExitL to |
1985 * by aButtonId is pressed, if this button should exit the dialog. See OkToExitL to |
1838 * If the EEikDialogFlagNotifyEsc flag is not set and the dialog has been cancelled it |
1989 * If the EEikDialogFlagNotifyEsc flag is not set and the dialog has been cancelled it |
1839 * immediately deletes itself. |
1990 * immediately deletes itself. |
1840 */ |
1991 */ |
1841 EXPORT_C void CEikDialog::TryExitL(TInt aButtonId) |
1992 EXPORT_C void CEikDialog::TryExitL(TInt aButtonId) |
1842 { |
1993 { |
1843 if ( iDialogFlags & EEikDialogFlagNoUserExit ) |
1994 _AKNTRACE("CEikDialog::TryExitL iDialogFlags = %d, buttonId = %d", iDialogFlags, aButtonId); |
1844 { |
1995 if (iDialogFlags & EEikDialogFlagNoUserExit) |
1845 return; |
1996 { |
1997 return; |
|
1846 } |
1998 } |
1847 |
1999 |
1848 // use delayed exit if pointer event handling is in progress |
2000 // use delayed exit if pointer event handling is in progress |
1849 if ( Extension()->iPublicFlags.IsSet( CEikDialogExtension::EDelayedExit ) ) |
2001 if (Extension()->iPublicFlags.IsSet(CEikDialogExtension::EDelayedExit)) |
1850 { |
2002 { |
1851 Extension()->iButtonId = aButtonId; |
2003 Extension()->iButtonId = aButtonId; |
1852 Extension()->StartDelayedExit(); |
2004 Extension()->StartDelayedExit(); |
2005 |
|
2006 _AKNTRACE("CEikDialog::TryExitL return with delayedExit"); |
|
1853 return; |
2007 return; |
1854 } |
2008 } |
1855 |
2009 |
1856 TBool effectTriggered = EFalse; |
|
1857 TBool effectButton = aButtonId == EEikBidCancel |
2010 TBool effectButton = aButtonId == EEikBidCancel |
1858 || aButtonId == EAknSoftkeyExit |
2011 || aButtonId == EAknSoftkeyExit |
1859 || aButtonId == EAknSoftkeyBack |
2012 || aButtonId == EAknSoftkeyBack |
1860 || aButtonId == EAknSoftkeyNo; |
2013 || aButtonId == EAknSoftkeyNo; |
1861 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS |
2014 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS |
1862 effectButton = effectButton |
2015 effectButton = effectButton |
1863 || aButtonId == EAknSoftkeyClose |
2016 || aButtonId == EAknSoftkeyClose |
1864 || aButtonId == EAknSoftkeyDone; |
2017 || aButtonId == EAknSoftkeyDone |
2018 || aButtonId == EAknSoftkeyOk; |
|
1865 #endif |
2019 #endif |
1866 CAknAppUi* aknAppUi = static_cast<CAknAppUi*>( iEikonEnv->EikAppUi() ); |
2020 |
1867 if ( GfxTransEffect::IsRegistered( this ) && IsVisible() && effectButton |
2021 TBool effectTriggered = EFalse; |
2022 CAknAppUi* aknAppUi = static_cast<CAknAppUi*>(iEikonEnv->EikAppUi()); |
|
2023 |
|
2024 MTouchFeedback* feedback = NULL; |
|
2025 if(AknLayoutUtils::PenEnabled()) |
|
2026 { |
|
2027 feedback = static_cast<MTouchFeedback*>(ExtensionInterface(KExIfTactileFeedbackUid)); |
|
2028 } |
|
2029 |
|
2030 if (!(iDialogFlags & EEikDialogFlagDelayEffects) |
|
2031 && IsFocusedWindowGroup( this ) |
|
2032 && GfxTransEffect::IsRegistered(this) && IsVisible() && effectButton |
|
1868 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS |
2033 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS |
1869 && !(iDialogFlags&EEikDialogFlagSleeping) |
2034 && !(iDialogFlags & EEikDialogFlagSleeping) |
1870 #endif |
2035 #endif |
1871 && ( !aknAppUi->IsFullScreenApp() || aknAppUi->IsForeground() ) |
2036 && (!aknAppUi->IsFullScreenApp() || aknAppUi->IsForeground()) |
1872 && !IsBlankScreenDisplayed() |
2037 && !IsBlankScreenDisplayed() |
1873 ) |
2038 ) |
1874 { |
2039 { |
1875 CAknTransitionUtils::SetAllParents(this); |
2040 CAknTransitionUtils::SetAllParents(this); |
1876 GfxTransEffect::Begin(this, KGfxControlDisappearAction); |
2041 GfxTransEffect::Begin(this, KGfxControlDisappearAction); |
2042 |
|
2043 if(feedback) |
|
2044 { |
|
2045 if(CAknTransitionUtils::TransitionsEnabled(AknTransEffect::EComponentTransitionsOff)) |
|
2046 { |
|
2047 feedback->InstantFeedback(this, ETouchFeedbackDecreasingPopUp, |
|
2048 ETouchFeedbackVibra, TPointerEvent()); |
|
2049 } |
|
2050 else |
|
2051 { |
|
2052 feedback->InstantFeedback(this, ETouchFeedbackPopUp, |
|
2053 ETouchFeedbackVibra, TPointerEvent()); |
|
2054 } |
|
2055 } |
|
2056 |
|
1877 GfxTransEffect::NotifyExternalState(ECaptureComponentsBegin, (const TDesC8*)this); |
2057 GfxTransEffect::NotifyExternalState(ECaptureComponentsBegin, (const TDesC8*)this); |
1878 |
|
1879 TRect demarcation; |
2058 TRect demarcation; |
1880 CAknTransitionUtils::GetDemarcation(CAknTransitionUtils::EPopup, |
2059 CAknTransitionUtils::GetDemarcation(CAknTransitionUtils::EPopup, demarcation); |
1881 demarcation); |
|
1882 GfxTransEffect::SetDemarcation(this, demarcation); |
2060 GfxTransEffect::SetDemarcation(this, demarcation); |
1883 effectTriggered = ETrue; |
2061 effectTriggered = ETrue; |
1884 } |
2062 } |
1885 |
2063 |
1886 if (aButtonId!=EEikBidCancel) |
2064 if (aButtonId != EEikBidCancel) |
2065 { |
|
1887 PrepareForFocusTransitionL(); |
2066 PrepareForFocusTransitionL(); |
1888 else if (!(iDialogFlags&EEikDialogFlagNotifyEsc)) |
2067 } |
1889 goto finished; |
2068 else if (!(iDialogFlags & EEikDialogFlagNotifyEsc)) |
1890 if (!OkToExitL(aButtonId)) |
2069 { |
1891 { |
2070 goto finished; |
1892 if ( effectTriggered ) |
2071 } |
1893 { |
2072 |
1894 GfxTransEffect::NotifyExternalState( ECaptureComponentsAbort, |
2073 if (!OkToExitL(aButtonId)) |
1895 ( const TDesC8* ) this ); |
2074 { |
1896 GfxTransEffect::Abort( this ); |
2075 if (effectTriggered) |
1897 } |
2076 { |
1898 return; |
2077 GfxTransEffect::NotifyExternalState(ECaptureComponentsAbort, (const TDesC8*)this); |
1899 } |
2078 GfxTransEffect::Abort(this); |
1900 |
2079 } |
1901 if (aButtonId!=EEikBidCancel) |
2080 |
1902 GetAutoValues(); |
2081 // Draw again in cast any content change in OkToExitL |
2082 DrawDeferred(); |
|
2083 |
|
2084 _AKNTRACE("CEikDialog::TryExitL return with OkToExitL false"); |
|
2085 return; |
|
2086 } |
|
2087 |
|
2088 if (aButtonId != EEikBidCancel) |
|
2089 { |
|
2090 GetAutoValues(); |
|
2091 } |
|
2092 |
|
1903 finished: |
2093 finished: |
2094 |
|
1904 if (iExitConfirmed) |
2095 if (iExitConfirmed) |
1905 *iExitConfirmed=((MappedCommandId( aButtonId ) ==EEikBidCancel)? 0: aButtonId); |
2096 { |
2097 *iExitConfirmed = MappedCommandId(aButtonId) == EEikBidCancel ? 0 : aButtonId; |
|
2098 } |
|
1906 |
2099 |
1907 // Remove content observer in order to prevent unnecessary layout |
2100 // Remove content observer in order to prevent unnecessary layout |
1908 // calculations in dialog shutdown. |
2101 // calculations in dialog shutdown. |
1909 EnableContentObserver( EFalse ); |
2102 EnableContentObserver(EFalse); |
1910 |
2103 |
1911 if (iDialogFlags&EEikDialogFlagSleeping) |
2104 if (iDialogFlags & EEikDialogFlagSleeping) |
1912 ExitSleepingDialog(); |
2105 { |
1913 else |
2106 ExitSleepingDialog(); |
1914 { |
2107 } |
2108 else |
|
2109 { |
|
1915 // Remove content observer in order to prevent unnecessary layout |
2110 // Remove content observer in order to prevent unnecessary layout |
1916 // calculations in dialog shutdown. |
2111 // calculations in dialog shutdown. |
1917 EnableContentObserver( EFalse ); |
2112 EnableContentObserver(EFalse); |
1918 |
2113 |
1919 if ( effectTriggered ) |
2114 // The dialog is asked to postpone the effect after OkToExitL. |
1920 { |
2115 if ((iDialogFlags & EEikDialogFlagDelayEffects) && !effectTriggered) |
1921 MakeVisible(EFalse); |
2116 { |
1922 CAknTransitionUtils::MakeVisibleSubComponents( this, |
2117 if (GfxTransEffect::IsRegistered(this) && IsVisible() && effectButton |
1923 CAknTransitionUtils::EForceInvisible ); |
2118 && (!aknAppUi->IsFullScreenApp() || aknAppUi->IsForeground()) |
1924 |
2119 && !IsBlankScreenDisplayed() |
1925 GfxTransEffect::NotifyExternalState(ECaptureComponentsEnd, (const TDesC8*)this); |
2120 ) |
1926 GfxTransEffect::End(this); |
2121 { |
1927 } |
2122 TRect demarcation; |
1928 else |
2123 CAknTransitionUtils::SetAllParents(this); |
1929 { |
2124 GfxTransEffect::Begin(this, KGfxControlDisappearAction); |
1930 MakeVisible(EFalse); |
2125 |
1931 CAknTransitionUtils::MakeVisibleSubComponents( this, |
2126 if(feedback) |
1932 CAknTransitionUtils::EForceInvisible ); |
2127 { |
1933 GfxTransEffect::NotifyExternalState( ECaptureComponentsAbort, |
2128 if(CAknTransitionUtils::TransitionsEnabled(AknTransEffect::EComponentTransitionsOff)) |
1934 ( const TDesC8* ) this ); |
2129 { |
1935 GfxTransEffect::Abort(this); |
2130 feedback->InstantFeedback(this, ETouchFeedbackDecreasingPopUp, |
1936 } |
2131 ETouchFeedbackVibra, TPointerEvent()); |
1937 delete(this); |
2132 } |
1938 } |
2133 else |
2134 { |
|
2135 feedback->InstantFeedback(this, ETouchFeedbackPopUp, |
|
2136 ETouchFeedbackVibra , TPointerEvent()); |
|
2137 } |
|
2138 } |
|
2139 |
|
2140 GfxTransEffect::NotifyExternalState(ECaptureComponentsBegin, (const TDesC8*)this); |
|
2141 CAknTransitionUtils::GetDemarcation(CAknTransitionUtils::EPopup, demarcation); |
|
2142 GfxTransEffect::SetDemarcation(this, demarcation); |
|
2143 effectTriggered = ETrue; |
|
2144 } |
|
2145 } |
|
2146 |
|
2147 if (effectTriggered) |
|
2148 { |
|
2149 MakeVisible(EFalse); |
|
2150 CAknTransitionUtils::MakeVisibleSubComponents(this, CAknTransitionUtils::EForceInvisible); |
|
2151 GfxTransEffect::NotifyExternalState(ECaptureComponentsEnd, (const TDesC8*)this); |
|
2152 GfxTransEffect::End(this); |
|
2153 } |
|
2154 else |
|
2155 { |
|
2156 // Why we need abort the effect here ?? |
|
2157 MakeVisible(EFalse); |
|
2158 CAknTransitionUtils::MakeVisibleSubComponents(this, CAknTransitionUtils::EForceInvisible); |
|
2159 GfxTransEffect::NotifyExternalState(ECaptureComponentsAbort, (const TDesC8*)this); |
|
2160 GfxTransEffect::Abort(this); |
|
2161 } |
|
2162 delete(this); |
|
2163 } |
|
2164 _AKNTRACE_FUNC_EXIT; |
|
1939 } |
2165 } |
1940 |
2166 |
1941 /** |
2167 /** |
1942 * Returns the input capabilites of the dialog. By default, the dialog is |
2168 * Returns the input capabilites of the dialog. By default, the dialog is |
1943 * capable of handling all text input. |
2169 * capable of handling all text input. |
2061 * dialog by default. Reimplementations of this method must |
2287 * dialog by default. Reimplementations of this method must |
2062 * activate a page before doing anything else. |
2288 * activate a page before doing anything else. |
2063 */ |
2289 */ |
2064 EXPORT_C void CEikDialog::SetInitialCurrentLine() |
2290 EXPORT_C void CEikDialog::SetInitialCurrentLine() |
2065 { |
2291 { |
2292 _AKNTRACE_FUNC_ENTER; |
|
2066 if ( !iExtension->iInitialMade ) |
2293 if ( !iExtension->iInitialMade ) |
2067 { |
2294 { |
2068 TRAP_IGNORE(iPageSelector->ActivateFirstPageL()); |
2295 TRAP_IGNORE(iPageSelector->ActivateFirstPageL()); |
2069 } |
2296 } |
2070 if( !iIsEditable ) |
2297 if( !iIsEditable ) |
2071 { |
2298 { |
2072 iPageSelector->SetInitialFocus(); |
2299 iPageSelector->SetInitialFocus(); |
2073 } |
2300 } |
2301 _AKNTRACE_FUNC_EXIT; |
|
2074 } |
2302 } |
2075 |
2303 |
2076 /** |
2304 /** |
2077 * Handles a dialog button press for the button with id aButtonId. |
2305 * Handles a dialog button press for the button with id aButtonId. |
2078 * The cancel button press is not passed to the handler unless EEikDialogFlagNotifyEsc |
2306 * The cancel button press is not passed to the handler unless EEikDialogFlagNotifyEsc |
2197 * |
2425 * |
2198 * @since ER5U |
2426 * @since ER5U |
2199 */ |
2427 */ |
2200 EXPORT_C void CEikDialog::HandleResourceChange(TInt aType) |
2428 EXPORT_C void CEikDialog::HandleResourceChange(TInt aType) |
2201 { |
2429 { |
2202 |
2430 _AKNTRACE_FUNC_ENTER; |
2203 if(aType==KEikDynamicLayoutVariantSwitch) |
2431 if(aType==KEikDynamicLayoutVariantSwitch) |
2204 { |
2432 { |
2205 if (IsVisible()) |
2433 if (IsVisible()) |
2206 DoResourceChangeLayout(); |
2434 DoResourceChangeLayout(); |
2207 else if (iExtension) |
2435 else if (iExtension) |
2208 iExtension->iFlags.Set(CEikDialogExtension::ELayoutChangeWhileInvisible); |
2436 iExtension->iFlags.Set(CEikDialogExtension::ELayoutChangeWhileInvisible); |
2209 |
2437 |
2210 CCoeControl::HandleResourceChange(aType); |
2438 TBool isForm = ( iPageSelector && iPageSelector->IsForm() ); |
2439 |
|
2440 if ( !isForm ) |
|
2441 { |
|
2442 CCoeControl::HandleResourceChange( aType ); |
|
2443 } |
|
2444 |
|
2445 _AKNTRACE_FUNC_EXIT; |
|
2211 return; |
2446 return; |
2212 } |
2447 } |
2213 else |
2448 else |
2214 { |
2449 { |
2215 CCoeControl::HandleResourceChange(aType); |
2450 CCoeControl::HandleResourceChange(aType); |
2216 } |
2451 } |
2217 |
2452 |
2218 if( !CAknEnv::Static()->TransparencyEnabled() && aType==KEikColorResourceChange) |
2453 _AKNTRACE_FUNC_EXIT; |
2219 { |
|
2220 Window().SetBackgroundColor(iEikonEnv->ControlColor(EColorDialogBackground,*this)); |
|
2221 } |
|
2222 } |
2454 } |
2223 |
2455 |
2224 void CEikDialog::DoResourceChangeLayout() |
2456 void CEikDialog::DoResourceChangeLayout() |
2225 { |
2457 { |
2226 // Layout must be forced through - bypass optimisations |
2458 // Layout must be forced through - bypass optimisations |
2227 // Must work through all pages |
2459 // Must work through all pages |
2460 _AKNTRACE_FUNC_ENTER; |
|
2461 Layout(); |
|
2228 |
2462 |
2229 Layout(); |
2463 TBool isForm = ( iPageSelector && iPageSelector->IsForm() ); |
2230 SizeChanged(); |
|
2231 |
2464 |
2232 TInt lastPage = ( iPageSelector->PageContainer()->NumPages() - 1 ); |
2465 if ( !isForm ) |
2233 TInt pageIndex = 0; |
2466 { |
2234 CEikDialogPage* page; |
2467 SizeChanged(); |
2235 |
2468 } |
2236 while ( pageIndex++ <= lastPage ) |
2469 |
2237 { |
2470 if( iPageSelector ) |
2238 page = iPageSelector->PageContainer()->Page( pageIndex ); |
2471 { |
2239 page->HandleResourceChange( KEikDynamicLayoutVariantSwitch ); |
2472 TInt lastPage = ( iPageSelector->PageContainer()->NumPages() - 1 ); |
2473 TInt pageIndex = 0; |
|
2474 CEikDialogPage* page( NULL ); |
|
2475 |
|
2476 while ( pageIndex++ <= lastPage ) |
|
2477 { |
|
2478 page = iPageSelector->PageContainer()->Page( pageIndex ); |
|
2479 page->HandleResourceChange( KEikDynamicLayoutVariantSwitch ); |
|
2480 } |
|
2240 } |
2481 } |
2241 |
2482 |
2242 if (iExtension) |
2483 if (iExtension) |
2243 iExtension->iFlags.Clear(CEikDialogExtension::ELayoutChangeWhileInvisible); |
2484 iExtension->iFlags.Clear(CEikDialogExtension::ELayoutChangeWhileInvisible); |
2485 _AKNTRACE_FUNC_EXIT; |
|
2244 } |
2486 } |
2245 |
2487 |
2246 /** |
2488 /** |
2247 * Returns a pointer to the dialog's internal button command observer. This is required when creating a |
2489 * Returns a pointer to the dialog's internal button command observer. This is required when creating a |
2248 * new button group container for the dialog. |
2490 * new button group container for the dialog. |
2282 EXPORT_C void CEikDialog::CEikDialog_Reserved_2() |
2524 EXPORT_C void CEikDialog::CEikDialog_Reserved_2() |
2283 {} |
2525 {} |
2284 |
2526 |
2285 EXPORT_C void CEikDialog::MakeVisible(TBool aVisible) |
2527 EXPORT_C void CEikDialog::MakeVisible(TBool aVisible) |
2286 { |
2528 { |
2529 _AKNTRACE_FUNC_ENTER; |
|
2530 _AKNTRACE( "CEikDialog::MakeVisible(): [%d]", aVisible ); |
|
2287 if (iExtension && iExtension->iFlags[CEikDialogExtension::ELayoutChangeWhileInvisible]) |
2531 if (iExtension && iExtension->iFlags[CEikDialogExtension::ELayoutChangeWhileInvisible]) |
2288 DoResourceChangeLayout(); |
2532 DoResourceChangeLayout(); |
2289 |
2533 |
2290 // only for popup dialogs |
2534 // only for popup dialogs |
2291 if ( aVisible ) |
2535 if ( aVisible ) |
2299 AknGlobalPopupPriorityController::FadeBehindPopup(*this, iPopupFader, *this, aVisible); |
2543 AknGlobalPopupPriorityController::FadeBehindPopup(*this, iPopupFader, *this, aVisible); |
2300 } |
2544 } |
2301 } |
2545 } |
2302 |
2546 |
2303 CEikBorderedControl::MakeVisible(aVisible); |
2547 CEikBorderedControl::MakeVisible(aVisible); |
2304 |
2548 _AKNTRACE_FUNC_EXIT; |
2305 } |
2549 } |
2306 |
2550 |
2307 void CEikDialog::FadeBehindPopup(TBool aFade) |
2551 void CEikDialog::FadeBehindPopup(TBool aFade) |
2308 { |
2552 { |
2309 // record the requested fade state |
2553 // record the requested fade state |
2426 CEikCaptionedControl* control = NULL; |
2670 CEikCaptionedControl* control = NULL; |
2427 do |
2671 do |
2428 { |
2672 { |
2429 control = dlgPage->LineOnPageOrNull(i++); |
2673 control = dlgPage->LineOnPageOrNull(i++); |
2430 if (control) |
2674 if (control) |
2431 aControls.Append(control); |
2675 { |
2432 } |
2676 if ( KErrNone != aControls.Append(control) ) |
2433 while (control != NULL); |
2677 { |
2678 return; |
|
2679 } |
|
2680 } |
|
2681 } |
|
2682 while (control != NULL); |
|
2434 } |
2683 } |
2435 |
2684 |
2436 EXPORT_C TInt CEikDialog::DialogFlags() |
2685 EXPORT_C TInt CEikDialog::DialogFlags() |
2437 { |
2686 { |
2438 return iDialogFlags; |
2687 return iDialogFlags; |
2502 } |
2751 } |
2503 } |
2752 } |
2504 |
2753 |
2505 EXPORT_C void CEikDialog::UpdatePageL(TBool aRedraw) |
2754 EXPORT_C void CEikDialog::UpdatePageL(TBool aRedraw) |
2506 { |
2755 { |
2756 _AKNTRACE_FUNC_ENTER; |
|
2507 if (Rect().Height()) |
2757 if (Rect().Height()) |
2508 { |
2758 { |
2509 if (iPageSelector) |
2759 if (iPageSelector) |
2510 if (iPageSelector->IsForm()) |
2760 if (iPageSelector->IsForm()) |
2511 if (iPageSelector->PageContainer()) |
2761 if (iPageSelector->PageContainer()) |
2515 TryChangeFocusToL(CurrentLine()->iId); |
2765 TryChangeFocusToL(CurrentLine()->iId); |
2516 if (aRedraw) |
2766 if (aRedraw) |
2517 DrawDeferred(); |
2767 DrawDeferred(); |
2518 } |
2768 } |
2519 } |
2769 } |
2770 _AKNTRACE_FUNC_EXIT; |
|
2520 } |
2771 } |
2521 |
2772 |
2522 |
2773 |
2523 EXPORT_C TInt CEikDialog::GetNumberOfLinesOnPage(TInt aPageIndex) const |
2774 EXPORT_C TInt CEikDialog::GetNumberOfLinesOnPage(TInt aPageIndex) const |
2524 { |
2775 { |
2776 _AKNTRACE_FUNC_ENTER; |
|
2525 if (iPageSelector) |
2777 if (iPageSelector) |
2526 { |
2778 { |
2527 CEikDialogPageContainer* pageContainer = iPageSelector->PageContainer(); |
2779 CEikDialogPageContainer* pageContainer = iPageSelector->PageContainer(); |
2528 if (pageContainer) |
2780 if (pageContainer) |
2529 { |
2781 { |
2530 CEikDialogPage* page = pageContainer->Page(aPageIndex); |
2782 CEikDialogPage* page = pageContainer->Page(aPageIndex); |
2531 if (page) |
2783 if (page) |
2532 return page->NumberOfLines(); |
2784 { |
2785 _AKNTRACE( "CEikDialog::GetNumberOfLinesOnPage(): [%d]", page->NumberOfLines() ); |
|
2786 _AKNTRACE_FUNC_EXIT; |
|
2787 return page->NumberOfLines(); |
|
2788 } |
|
2533 } |
2789 } |
2534 } |
2790 } |
2791 _AKNTRACE( "CEikDialog::GetNumberOfLinesOnPage(): 0"); |
|
2792 _AKNTRACE_FUNC_EXIT; |
|
2535 return 0; |
2793 return 0; |
2536 } |
2794 } |
2537 |
2795 |
2538 EXPORT_C TInt CEikDialog::GetNumberOfPages() const |
2796 EXPORT_C TInt CEikDialog::GetNumberOfPages() const |
2539 { |
2797 { |
2798 _AKNTRACE_FUNC_ENTER; |
|
2540 if (iPageSelector) |
2799 if (iPageSelector) |
2541 { |
2800 { |
2542 CEikDialogPageContainer* pageContainer = iPageSelector->PageContainer(); |
2801 CEikDialogPageContainer* pageContainer = iPageSelector->PageContainer(); |
2543 if (pageContainer) |
2802 if (pageContainer) |
2544 return pageContainer->NumPages(); |
2803 { |
2545 } |
2804 _AKNTRACE( "CEikDialog::GetNumberOfPages(): [%d]", pageContainer->NumPages() ); |
2805 _AKNTRACE_FUNC_EXIT; |
|
2806 return pageContainer->NumPages(); |
|
2807 } |
|
2808 } |
|
2809 _AKNTRACE( "CEikDialog::GetNumberOfPages(): return 0;" ); |
|
2810 _AKNTRACE_FUNC_EXIT; |
|
2546 return 0; |
2811 return 0; |
2547 } |
2812 } |
2548 |
2813 |
2549 //-------------------------------------------------------------------------------- |
2814 //-------------------------------------------------------------------------------- |
2550 // CEikDialog::HandleDialogPageEventL(TInt aEventID) |
2815 // CEikDialog::HandleDialogPageEventL(TInt aEventID) |
3047 { |
3312 { |
3048 // Check that dialog is constructed and actually with embedded |
3313 // Check that dialog is constructed and actually with embedded |
3049 // softkeys |
3314 // softkeys |
3050 if ( iExtension && CbaEmbeddedInDialog( iDialogFlags ) ) |
3315 if ( iExtension && CbaEmbeddedInDialog( iDialogFlags ) ) |
3051 { |
3316 { |
3052 TSize dialogSize( Rect().Size() ); |
3317 TRect oldDialogRect( Rect() ); |
3318 TSize dialogSize( oldDialogRect.Size() ); |
|
3053 CEikCba* cba = static_cast<CEikCba*>( |
3319 CEikCba* cba = static_cast<CEikCba*>( |
3054 iButtonGroupContainer->ButtonGroup() ); |
3320 iButtonGroupContainer->ButtonGroup() ); |
3055 TBool cbaVisible( cba->IsVisible() && !cba->IsEmpty() ); |
3321 TBool cbaVisible( cba->IsVisible() && !cba->IsEmpty() ); |
3056 |
3322 |
3057 TRect screenRect; |
3323 TRect screenRect; |
3072 else |
3338 else |
3073 { |
3339 { |
3074 dialogSize.iHeight -= cbaRect.Rect().Height(); |
3340 dialogSize.iHeight -= cbaRect.Rect().Height(); |
3075 } |
3341 } |
3076 |
3342 |
3077 SetRect( TRect( |
3343 TRect newDialogRect( AknPopupUtils::Position( dialogSize, cbaVisible ), |
3078 AknPopupUtils::Position( dialogSize, this ), dialogSize ) ); |
3344 dialogSize ); |
3345 SetRect( newDialogRect ); |
|
3346 |
|
3347 if ( oldDialogRect != newDialogRect ) |
|
3348 { |
|
3349 DrawDeferred(); |
|
3350 } |
|
3079 } |
3351 } |
3080 } |
3352 } |
3081 |
3353 |
3082 |
3354 |
3083 TInt CEikDialog::HandleEmbeddedSoftkeyStateChangeCallBack( TAny* aAny ) |
3355 TInt CEikDialog::HandleEmbeddedSoftkeyStateChangeCallBack( TAny* aAny ) |
3121 // Checking if the blank screen is being displayed. |
3393 // Checking if the blank screen is being displayed. |
3122 // If so, the blank screen will cover everything. |
3394 // If so, the blank screen will cover everything. |
3123 const TInt KWgPriorityOfBlankScreen = 10000; // copied from akncapserverentry.cpp |
3395 const TInt KWgPriorityOfBlankScreen = 10000; // copied from akncapserverentry.cpp |
3124 TBool IsBlankScreenDisplayed() |
3396 TBool IsBlankScreenDisplayed() |
3125 { |
3397 { |
3398 _AKNTRACE_FUNC_ENTER; |
|
3126 TBool isBlankScreenDisplayed(EFalse); |
3399 TBool isBlankScreenDisplayed(EFalse); |
3127 RWsSession& wsSession = CEikonEnv::Static()->WsSession(); |
3400 RWsSession& wsSession = CEikonEnv::Static()->WsSession(); |
3128 |
3401 |
3129 CArrayFixFlat<TInt> *wgIds = new CArrayFixFlat<TInt>(2); |
3402 CArrayFixFlat<TInt> *wgIds = new CArrayFixFlat<TInt>(2); |
3130 if (wgIds != NULL) |
3403 if (wgIds != NULL) |
3131 { |
3404 { |
3132 if (KErrNone == wsSession.WindowGroupList(wgIds) && wgIds->Count() > 0) |
3405 if (KErrNone == wsSession.WindowGroupList(wgIds) && wgIds->Count() > 0) |
3133 { |
3406 { |
3134 TInt priority = wsSession.GetWindowGroupOrdinalPriority(wgIds->At(0)); |
3407 TInt priority = wsSession.GetWindowGroupOrdinalPriority(wgIds->At(0)); |
3135 RDebug::Printf("IsBlankScreenDisplayed():priority:%d",priority); |
3408 _AKNTRACE( "IsBlankScreenDisplayed():priority: [%d]", priority ); |
3136 if (priority == KWgPriorityOfBlankScreen) |
3409 if (priority == KWgPriorityOfBlankScreen) |
3137 { |
3410 { |
3138 isBlankScreenDisplayed = ETrue; |
3411 isBlankScreenDisplayed = ETrue; |
3139 } |
3412 } |
3140 } |
3413 } |
3141 } |
3414 } |
3142 delete wgIds; |
3415 delete wgIds; |
3143 RDebug::Printf("IsBlankScreenDisplayed():isBlankScreenDisplayed:%d",isBlankScreenDisplayed); |
3416 _AKNTRACE( "IsBlankScreenDisplayed():isBlankScreenDisplayed: [%d]", isBlankScreenDisplayed ); |
3417 _AKNTRACE_FUNC_EXIT; |
|
3144 return isBlankScreenDisplayed; |
3418 return isBlankScreenDisplayed; |
3145 } |
3419 } |
3146 |
3420 |