17 |
17 |
18 #include <eikcapc.h> |
18 #include <eikcapc.h> |
19 #include <AknMediatorFacade.h> |
19 #include <AknMediatorFacade.h> |
20 #include <MediatorEventProvider.h> |
20 #include <MediatorEventProvider.h> |
21 #include <MediatorDomainUIDs.h> |
21 #include <MediatorDomainUIDs.h> |
22 #include <AknNotifyStd.h> |
22 #include <secondarydisplay/AknSecondaryDisplayDefs.h> |
23 #include <SecondaryDisplay/AknSecondaryDisplayDefs.h> |
|
24 |
23 |
25 #include "aknPopupHeadingPane.h" |
24 #include "aknPopupHeadingPane.h" |
26 #include "aknlistquerycontrol.h" |
25 #include "aknlistquerycontrol.h" |
27 #include "aknlistquerysearchcontrol.h" |
26 #include "aknlistquerysearchcontrol.h" |
28 #include "aknlists.h" |
27 #include "aknlists.h" |
56 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
55 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
57 #include <uikon/eikenvinterface.h> |
56 #include <uikon/eikenvinterface.h> |
58 #endif |
57 #endif |
59 |
58 |
60 #include <AknTasHook.h> // for testability hooks |
59 #include <AknTasHook.h> // for testability hooks |
|
60 #include "akntrace.h" |
61 NONSHARABLE_CLASS(CAknListQueryMediatorObserver): public CBase, public MAknDialogMediatorObserver |
61 NONSHARABLE_CLASS(CAknListQueryMediatorObserver): public CBase, public MAknDialogMediatorObserver |
62 { |
62 { |
63 public: |
63 public: |
64 CAknListQueryMediatorObserver(CArrayFixFlat<TInt>* aItemIdArray, CAknListQueryDialog& aOwner) |
64 CAknListQueryMediatorObserver(CArrayFixFlat<TInt>* aItemIdArray, CAknListQueryDialog& aOwner) |
65 :iItemIdArray(aItemIdArray), iOwner(aOwner) |
65 :iItemIdArray(aItemIdArray), iOwner(aOwner) |
159 } |
159 } |
160 |
160 |
161 EXPORT_C CAknListQueryDialog::CAknListQueryDialog(TInt* aIndex) |
161 EXPORT_C CAknListQueryDialog::CAknListQueryDialog(TInt* aIndex) |
162 : CAknQueryDialog(ENoTone) |
162 : CAknQueryDialog(ENoTone) |
163 { |
163 { |
|
164 _AKNTRACE_FUNC_ENTER; |
164 iIndex = aIndex; |
165 iIndex = aIndex; |
165 iEnterKeyPressed = EFalse; |
166 iEnterKeyPressed = EFalse; |
166 |
167 |
167 GfxTransEffect::Register(this,KGfxContextMenuControlUid); |
168 GfxTransEffect::Register(this,KGfxContextMenuControlUid); |
168 AKNTASHOOK_ADD( this, "CAknListQueryDialog" ); |
169 AKNTASHOOK_ADD( this, "CAknListQueryDialog" ); |
|
170 _AKNTRACE_FUNC_EXIT; |
169 } |
171 } |
170 |
172 |
171 |
173 |
172 EXPORT_C CAknListQueryDialog::CAknListQueryDialog(CListBoxView::CSelectionIndexArray* aSelectionIndexArray) |
174 EXPORT_C CAknListQueryDialog::CAknListQueryDialog(CListBoxView::CSelectionIndexArray* aSelectionIndexArray) |
173 : CAknQueryDialog(ENoTone) |
175 : CAknQueryDialog(ENoTone) |
174 { |
176 { |
|
177 _AKNTRACE_FUNC_ENTER; |
175 iSelectionIndexArray = aSelectionIndexArray; |
178 iSelectionIndexArray = aSelectionIndexArray; |
176 iEnterKeyPressed = EFalse; |
179 iEnterKeyPressed = EFalse; |
177 |
180 |
178 GfxTransEffect::Register(this,KGfxContextMenuControlUid); |
181 GfxTransEffect::Register(this,KGfxContextMenuControlUid); |
179 AKNTASHOOK_ADD( this, "CAknListQueryDialog" ); |
182 AKNTASHOOK_ADD( this, "CAknListQueryDialog" ); |
|
183 _AKNTRACE_FUNC_EXIT; |
180 } |
184 } |
181 |
185 |
182 EXPORT_C CAknListQueryDialog::~CAknListQueryDialog() |
186 EXPORT_C CAknListQueryDialog::~CAknListQueryDialog() |
183 { |
187 { |
|
188 _AKNTRACE( "[%s][%s] Enter", "CAknListQueryDialog", "~CAknListQueryDialog" ); |
184 AKNTASHOOK_REMOVE(); |
189 AKNTASHOOK_REMOVE(); |
185 if (iMediatorObs) |
190 if (iMediatorObs) |
186 CEikDialog::SetMediatorObserver(0); // Cover UI support cannot handle dialog it self as external observer |
191 CEikDialog::SetMediatorObserver(0); // Cover UI support cannot handle dialog it self as external observer |
187 |
192 |
188 delete iMediatorObs; |
193 delete iMediatorObs; |
189 delete iIdle; |
194 delete iIdle; |
|
195 _AKNTRACE( "[%s][%s] Exit", "CAknListQueryDialog", "~CAknListQueryDialog" ); |
190 } |
196 } |
191 |
197 |
192 EXPORT_C CEikListBox *CAknListQueryDialog::ListBox() const |
198 EXPORT_C CEikListBox *CAknListQueryDialog::ListBox() const |
193 { |
199 { |
194 return ListControl()->Listbox(); |
200 return ListControl()->Listbox(); |
231 } |
237 } |
232 |
238 |
233 |
239 |
234 EXPORT_C void CAknListQueryDialog::PreLayoutDynInitL() |
240 EXPORT_C void CAknListQueryDialog::PreLayoutDynInitL() |
235 { |
241 { |
|
242 _AKNTRACE_FUNC_ENTER; |
236 CAknListQuerySearchControl *control1 = (CAknListQuerySearchControl*)ControlOrNull(EFindControl); |
243 CAknListQuerySearchControl *control1 = (CAknListQuerySearchControl*)ControlOrNull(EFindControl); |
237 CAknSearchField *control = NULL; |
244 CAknSearchField *control = NULL; |
238 CAknSearchField::TSearchFieldStyle flags = CAknSearchField::EPopupWindow; |
245 CAknSearchField::TSearchFieldStyle flags = CAknSearchField::EPopupWindow; |
239 |
246 |
240 if (control1) |
247 if (control1) |
266 // The next line is needed so that drawing order of list query control and find pane becomes |
273 // The next line is needed so that drawing order of list query control and find pane becomes |
267 // correct. Seems that dialog page draws focused line last. |
274 // correct. Seems that dialog page draws focused line last. |
268 SetLineNonFocusing(EListQueryControl); |
275 SetLineNonFocusing(EListQueryControl); |
269 Line(EFindControl)->SetDrawNoWhiteBackground(ETrue); |
276 Line(EFindControl)->SetDrawNoWhiteBackground(ETrue); |
270 } |
277 } |
|
278 _AKNTRACE_FUNC_EXIT; |
271 } |
279 } |
272 |
280 |
273 EXPORT_C void CAknListQueryDialog::SetIconArrayL(CArrayPtr<CGulIcon>* aIcons) |
281 EXPORT_C void CAknListQueryDialog::SetIconArrayL(CArrayPtr<CGulIcon>* aIcons) |
274 { |
282 { |
|
283 _AKNTRACE_FUNC_ENTER; |
275 CEikFormattedCellListBox* listbox = STATIC_CAST(CEikFormattedCellListBox*,ListBox()); |
284 CEikFormattedCellListBox* listbox = STATIC_CAST(CEikFormattedCellListBox*,ListBox()); |
276 CArrayPtr<CGulIcon>* oldicons = listbox->ItemDrawer()->FormattedCellData()->IconArray(); |
285 CArrayPtr<CGulIcon>* oldicons = listbox->ItemDrawer()->FormattedCellData()->IconArray(); |
277 |
286 |
278 if (oldicons) |
287 if (oldicons) |
279 { |
288 { |
280 oldicons->ResetAndDestroy(); |
289 oldicons->ResetAndDestroy(); |
281 delete oldicons; |
290 delete oldicons; |
282 } |
291 } |
283 listbox->ItemDrawer()->FormattedCellData()->SetIconArrayL(aIcons); |
292 listbox->ItemDrawer()->FormattedCellData()->SetIconArrayL(aIcons); |
|
293 _AKNTRACE_FUNC_EXIT; |
284 } |
294 } |
285 |
295 |
286 EXPORT_C void CAknListQueryDialog::PostLayoutDynInitL() |
296 EXPORT_C void CAknListQueryDialog::PostLayoutDynInitL() |
287 { |
297 { |
|
298 _AKNTRACE_FUNC_ENTER; |
288 CEikFormattedCellListBox* listbox = STATIC_CAST(CEikFormattedCellListBox*,ListBox()); |
299 CEikFormattedCellListBox* listbox = STATIC_CAST(CEikFormattedCellListBox*,ListBox()); |
289 |
300 |
290 // Now we'll load default icons if existing icon array does not exists. |
301 // Now we'll load default icons if existing icon array does not exists. |
291 if (!listbox->ItemDrawer()->FormattedCellData()->IconArray()) |
302 if (!listbox->ItemDrawer()->FormattedCellData()->IconArray()) |
292 { |
303 { |
315 listbox->ItemDrawer()->FormattedCellData()->SetIconArrayL(icons); |
326 listbox->ItemDrawer()->FormattedCellData()->SetIconArrayL(icons); |
316 CleanupStack::Pop(); // icon for EMbmAvkonQgn_prop_checkbox_off |
327 CleanupStack::Pop(); // icon for EMbmAvkonQgn_prop_checkbox_off |
317 CleanupStack::Pop(); // icon for EMbmAvkonQgn_prop_checkbox_on |
328 CleanupStack::Pop(); // icon for EMbmAvkonQgn_prop_checkbox_on |
318 CleanupStack::Pop(); // icons array |
329 CleanupStack::Pop(); // icons array |
319 } |
330 } |
|
331 _AKNTRACE_FUNC_EXIT; |
320 } |
332 } |
321 |
333 |
322 EXPORT_C void CAknListQueryDialog::SetSizeAndPosition(const TSize & /*aSize*/) |
334 EXPORT_C void CAknListQueryDialog::SetSizeAndPosition(const TSize & /*aSize*/) |
323 { |
335 { |
|
336 _AKNTRACE_FUNC_ENTER; |
324 AknPopupLayouts::TAknPopupLayouts layout = AknPopupLayouts::EMenuWindow; |
337 AknPopupLayouts::TAknPopupLayouts layout = AknPopupLayouts::EMenuWindow; |
325 CAknListQueryControl *control = ListControl(); |
338 CAknListQueryControl *control = ListControl(); |
326 |
339 |
327 switch(control->Listtype()) |
340 switch(control->Listtype()) |
328 { |
341 { |
407 TRect outerRect = TRect(topLeft.Rect().iTl, bottomRight.Rect().iBr); |
420 TRect outerRect = TRect(topLeft.Rect().iTl, bottomRight.Rect().iBr); |
408 TRect innerRect = TRect(topLeft.Rect().iBr, bottomRight.Rect().iTl); |
421 TRect innerRect = TRect(topLeft.Rect().iBr, bottomRight.Rect().iTl); |
409 |
422 |
410 boxData->SetSkinPopupFrame(&KAknsIIDQsnFrPopup,&KAknsIIDQsnFrPopupCenter); |
423 boxData->SetSkinPopupFrame(&KAknsIIDQsnFrPopup,&KAknsIIDQsnFrPopupCenter); |
411 boxData->SetSkinPopupFramePosition(outerRect,innerRect); |
424 boxData->SetSkinPopupFramePosition(outerRect,innerRect); |
412 |
425 _AKNTRACE_FUNC_EXIT; |
413 } |
426 } |
414 |
427 |
415 EXPORT_C void CAknListQueryDialog::HandleListBoxEventL(CEikListBox* aListBox, |
428 EXPORT_C void CAknListQueryDialog::HandleListBoxEventL(CEikListBox* aListBox, |
416 TListBoxEvent aEventType) |
429 TListBoxEvent aEventType) |
417 { |
430 { |
|
431 _AKNTRACE( "[%s][%s] aEventType: %d", "CAknListQueryDialog", "HandleListBoxEventL", aEventType); |
418 if ( AknLayoutUtils::PenEnabled() ) |
432 if ( AknLayoutUtils::PenEnabled() ) |
419 { |
433 { |
420 switch(aEventType) |
434 switch(aEventType) |
421 { |
435 { |
422 case EEventEnterKeyPressed: |
436 case EEventEnterKeyPressed: |
504 } |
519 } |
505 |
520 |
506 EXPORT_C TKeyResponse CAknListQueryDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent, |
521 EXPORT_C TKeyResponse CAknListQueryDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent, |
507 TEventCode aType) |
522 TEventCode aType) |
508 { |
523 { |
|
524 _AKNTRACE( "[%s][%s] aKeyEvent.iCode: %d", "CAknListQueryDialog", "OfferKeyEventL", aKeyEvent.iCode); |
|
525 _AKNTRACE( "[%s][%s] aType: %d", "CAknListQueryDialog", "OfferKeyEventL", aType); |
509 if (aType==EEventKey && aKeyEvent.iCode == EKeyEscape) |
526 if (aType==EEventKey && aKeyEvent.iCode == EKeyEscape) |
510 { |
527 { |
511 CloseState(); |
528 CloseState(); |
512 return EKeyWasConsumed; |
529 return EKeyWasConsumed; |
513 } |
530 } |
589 STATIC_CAST(CTextListBoxModel*,ListBox()->Model())->SetOwnershipType(aOwnershipType); |
606 STATIC_CAST(CTextListBoxModel*,ListBox()->Model())->SetOwnershipType(aOwnershipType); |
590 } |
607 } |
591 |
608 |
592 EXPORT_C TBool CAknListQueryDialog::OkToExitL(TInt aButtonId) |
609 EXPORT_C TBool CAknListQueryDialog::OkToExitL(TInt aButtonId) |
593 { |
610 { |
|
611 _AKNTRACE( "[%s][%s] aButtonId: %d", "CAknListQueryDialog", "OkToExitL", aButtonId); |
594 CEikListBox* listbox = ListBox(); |
612 CEikListBox* listbox = ListBox(); |
595 |
613 |
596 if(aButtonId == GetLeftCBAShortKeyPress() || aButtonId == EEikBidOk) |
614 if(aButtonId == GetLeftCBAShortKeyPress() || aButtonId == EEikBidOk) |
597 { |
615 { |
598 if(iIndex) |
616 if(iIndex) |
616 TInt numberOfItems(array->Count()); |
634 TInt numberOfItems(array->Count()); |
617 iSelectionIndexArray->Reset(); |
635 iSelectionIndexArray->Reset(); |
618 for(TInt i(0); i<numberOfItems; i++) |
636 for(TInt i(0); i<numberOfItems; i++) |
619 iSelectionIndexArray->AppendL(array->At(i)); |
637 iSelectionIndexArray->AppendL(array->At(i)); |
620 } |
638 } |
|
639 _AKNTRACE( "[%s][%s] return ETrue", "CAknListQueryDialog", "OkToExitL"); |
621 return ETrue; |
640 return ETrue; |
622 } |
641 } |
623 else if(aButtonId == GetRightCBAShortKeyPress()) |
642 else if(aButtonId == GetRightCBAShortKeyPress()) |
624 return ETrue; |
643 { |
|
644 _AKNTRACE( "[%s][%s] return ETrue", "CAknListQueryDialog", "OkToExitL"); |
|
645 return ETrue; |
|
646 } |
|
647 _AKNTRACE( "[%s][%s] return EFalse", "CAknListQueryDialog", "OkToExitL"); |
625 return EFalse; |
648 return EFalse; |
626 } |
649 } |
627 |
650 |
628 EXPORT_C TInt CAknListQueryDialog::BorderStyle() |
651 EXPORT_C TInt CAknListQueryDialog::BorderStyle() |
629 { |
652 { |
634 #endif |
657 #endif |
635 } |
658 } |
636 |
659 |
637 EXPORT_C void CAknListQueryDialog::CloseState() |
660 EXPORT_C void CAknListQueryDialog::CloseState() |
638 { |
661 { |
|
662 _AKNTRACE_FUNC_ENTER; |
639 TRAP_IGNORE(TryExitL(EAknSoftkeyCancel)); |
663 TRAP_IGNORE(TryExitL(EAknSoftkeyCancel)); |
|
664 _AKNTRACE_FUNC_EXIT; |
640 } |
665 } |
641 |
666 |
642 EXPORT_C void CAknListQueryDialog::ActivateL() |
667 EXPORT_C void CAknListQueryDialog::ActivateL() |
643 { |
668 { |
|
669 _AKNTRACE_FUNC_ENTER; |
644 TBool notShowingPopup = ListBox()->Model()->NumberOfItems() == 0; |
670 TBool notShowingPopup = ListBox()->Model()->NumberOfItems() == 0; |
645 if (notShowingPopup) |
671 if (notShowingPopup) |
646 { |
672 { |
647 // We do not show if there's no list items. |
673 // We do not show if there's no list items. |
648 MakeVisible(EFalse); |
674 MakeVisible(EFalse); |
669 } |
695 } |
670 else |
696 else |
671 { |
697 { |
672 CAknQueryDialog::ActivateL(); |
698 CAknQueryDialog::ActivateL(); |
673 } |
699 } |
|
700 _AKNTRACE_FUNC_EXIT; |
674 } |
701 } |
675 |
702 |
676 TInt CAknListQueryDialog::ClosePopup(TAny *aObj) |
703 TInt CAknListQueryDialog::ClosePopup(TAny *aObj) |
677 { |
704 { |
|
705 _AKNTRACE_FUNC_ENTER; |
678 CAknListQueryDialog *popup = (CAknListQueryDialog*)aObj; |
706 CAknListQueryDialog *popup = (CAknListQueryDialog*)aObj; |
679 delete popup->iIdle; |
707 delete popup->iIdle; |
680 popup->iIdle = 0; |
708 popup->iIdle = 0; |
681 popup->CloseState(); |
709 popup->CloseState(); |
|
710 _AKNTRACE_FUNC_EXIT; |
682 return EFalse; |
711 return EFalse; |
683 } |
712 } |
684 |
713 |
685 EXPORT_C void CAknListQueryDialog::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
714 EXPORT_C void CAknListQueryDialog::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
686 { |
715 { |
687 // list query is dismissed if tapped outside |
|
688 if ( aPointerEvent.iType == TPointerEvent::EButton1Down ) |
|
689 { |
|
690 if( !Rect().Contains( aPointerEvent.iPosition ) ) |
|
691 { |
|
692 if ( !iIdle ) |
|
693 { |
|
694 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
|
695 if ( feedback ) |
|
696 { |
|
697 feedback->InstantFeedback( ETouchFeedbackPopUp ); |
|
698 } |
|
699 iIdle = CIdle::NewL(CActive::EPriorityIdle); |
|
700 iIdle->Start(TCallBack(ClosePopup, this)); |
|
701 return; |
|
702 } |
|
703 } |
|
704 |
|
705 TInt index; |
|
706 if ( ListBox()->View()->XYPosToItemIndex( aPointerEvent.iPosition, index ) ) |
|
707 { |
|
708 ListBox()->View()->ItemDrawer()->SetFlags( |
|
709 CListItemDrawer::EPressedDownState ); |
|
710 } |
|
711 } |
|
712 |
|
713 CAknQueryDialog::HandlePointerEventL( aPointerEvent ); |
716 CAknQueryDialog::HandlePointerEventL( aPointerEvent ); |
714 } |
717 } |
715 |
718 |
716 // --------------------------------------------------------- |
719 // --------------------------------------------------------- |
717 // CAknListQueryDialog::ClosePopupAcceptingChanges |
720 // CAknListQueryDialog::ClosePopupAcceptingChanges |
719 // --------------------------------------------------------- |
722 // --------------------------------------------------------- |
720 // |
723 // |
721 |
724 |
722 TInt CAknListQueryDialog::ClosePopupAcceptingChanges(TAny *aObj) |
725 TInt CAknListQueryDialog::ClosePopupAcceptingChanges(TAny *aObj) |
723 { |
726 { |
|
727 _AKNTRACE_FUNC_ENTER; |
724 if ( AknLayoutUtils::PenEnabled() ) |
728 if ( AknLayoutUtils::PenEnabled() ) |
725 { |
729 { |
726 CAknListQueryDialog *popup = (CAknListQueryDialog*)aObj; |
730 CAknListQueryDialog *popup = (CAknListQueryDialog*)aObj; |
727 delete popup->iIdle; |
731 delete popup->iIdle; |
728 popup->iIdle = NULL; |
732 popup->iIdle = NULL; |
729 TRAP_IGNORE( popup->TryExitL( EAknSoftkeyOk ) ); |
733 TRAP_IGNORE( popup->TryExitL( EAknSoftkeyOk ) ); |
|
734 _AKNTRACE_FUNC_EXIT; |
730 return EFalse; |
735 return EFalse; |
731 } |
736 } |
732 else |
737 else |
733 { |
738 { |
|
739 _AKNTRACE_FUNC_EXIT; |
734 return EFalse; |
740 return EFalse; |
735 } |
741 } |
736 } |
742 } |
737 |
743 |
738 |
744 |
739 EXPORT_C void* CAknListQueryDialog::ExtensionInterface( TUid /*aInterface*/ ) |
745 EXPORT_C void* CAknListQueryDialog::ExtensionInterface( TUid aInterface ) |
740 { |
746 { |
|
747 if(aInterface == KExIfTactileFeedbackUid) |
|
748 { |
|
749 return MTouchFeedback::Instance(); |
|
750 } |
741 return NULL; |
751 return NULL; |
742 } |
752 } |
743 |
753 |
744 EXPORT_C void CAknListQueryDialog::CEikDialog_Reserved_1() |
754 EXPORT_C void CAknListQueryDialog::CEikDialog_Reserved_1() |
745 { |
755 { |
769 iTone = (TTone)aTone; |
779 iTone = (TTone)aTone; |
770 } |
780 } |
771 |
781 |
772 EXPORT_C void CAknListQueryDialog::HandleResourceChange(TInt aType) |
782 EXPORT_C void CAknListQueryDialog::HandleResourceChange(TInt aType) |
773 { |
783 { |
|
784 _AKNTRACE_FUNC_ENTER; |
774 if (aType==KEikDynamicLayoutVariantSwitch) |
785 if (aType==KEikDynamicLayoutVariantSwitch) |
775 { |
786 { |
776 if (MessageBox()) |
787 if (MessageBox()) |
777 { |
788 { |
778 MessageBox()->SizeChanged(); |
789 MessageBox()->SizeChanged(); |
779 } |
790 } |
780 } |
791 } |
781 CAknQueryDialog::HandleResourceChange(aType); |
792 CAknQueryDialog::HandleResourceChange(aType); |
|
793 _AKNTRACE_FUNC_EXIT; |
782 } |
794 } |
783 |
795 |
784 EXPORT_C void CAknListQueryDialog::PublishDialogL(TInt aDialogIndex, TUid aCatUid, CArrayFixFlat<TInt>* aItemIds) |
796 EXPORT_C void CAknListQueryDialog::PublishDialogL(TInt aDialogIndex, TUid aCatUid, CArrayFixFlat<TInt>* aItemIds) |
785 { |
797 { |
786 CEikDialog::PublishDialogL(aDialogIndex, aCatUid); |
798 CEikDialog::PublishDialogL(aDialogIndex, aCatUid); |