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