equal
deleted
inserted
replaced
28 #include <eikmop.h> |
28 #include <eikmop.h> |
29 #include <aknlayoutscalable_avkon.cdl.h> |
29 #include <aknlayoutscalable_avkon.cdl.h> |
30 #include <skinlayout.cdl.h> |
30 #include <skinlayout.cdl.h> |
31 #include <aknglobalpopupprioritycontroller.h> |
31 #include <aknglobalpopupprioritycontroller.h> |
32 #include <touchfeedback.h> |
32 #include <touchfeedback.h> |
|
33 #include <akntranseffect.h> |
33 |
34 |
34 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS |
35 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS |
35 #include <gfxtranseffect/gfxtranseffect.h> |
36 #include <gfxtranseffect/gfxtranseffect.h> |
36 #include <akntransitionutils.h> |
37 #include <akntransitionutils.h> |
37 #endif |
38 #endif |
38 |
39 |
39 #include <AknTasHook.h> |
40 #include <AknTasHook.h> |
40 |
|
41 #include "aknPopup.h" |
41 #include "aknPopup.h" |
42 #include "akntrace.h" |
42 #include "akntrace.h" |
43 #include "aknitemactionmenuregister.h" |
43 #include "aknitemactionmenuregister.h" |
44 |
44 |
45 const TInt KSpaceBelowTitle=7; |
45 const TInt KSpaceBelowTitle=7; |
237 // otherwise the construction failed before the scheduler started. |
237 // otherwise the construction failed before the scheduler started. |
238 // The iReturn value is a convienient value to use since it is the |
238 // The iReturn value is a convienient value to use since it is the |
239 // last member ste before the actiave scheduler is started. |
239 // last member ste before the actiave scheduler is started. |
240 |
240 |
241 // Reset action menu register |
241 // Reset action menu register |
242 AknItemActionMenuRegister::SetConstructingMenuBarOwnerL( NULL ); |
242 AknItemActionMenuRegister::RemoveConstructingMenuBarOwner( this ); |
243 _AKNTRACE_FUNC_EXIT; |
243 _AKNTRACE_FUNC_EXIT; |
244 } |
244 } |
245 |
245 |
246 EXPORT_C void CAknPopupList::CloseState() |
246 EXPORT_C void CAknPopupList::CloseState() |
247 { |
247 { |
301 |
301 |
302 iBorder.SetType(TGulBorder::ENone); |
302 iBorder.SetType(TGulBorder::ENone); |
303 iListBox->SetBorder(TGulBorder::ENone); |
303 iListBox->SetBorder(TGulBorder::ENone); |
304 |
304 |
305 // Create extension class |
305 // Create extension class |
306 if (!iPopupListExtension) |
306 iPopupListExtension = new (ELeave) CAknPopupListExtension(); |
307 iPopupListExtension = new (ELeave) CAknPopupListExtension(); |
|
308 |
307 |
309 CAknAppUi* appUi = static_cast<CAknAppUi*>( iEikonEnv->EikAppUi() ); |
308 CAknAppUi* appUi = static_cast<CAknAppUi*>( iEikonEnv->EikAppUi() ); |
310 if ( appUi && appUi->IsSingleClickCompatible() ) |
309 if ( appUi && appUi->IsSingleClickCompatible() ) |
311 { |
310 { |
312 iPopupListExtension->iFlags |= EPopupSingleClickEnabled; |
311 iPopupListExtension->iFlags |= EPopupSingleClickEnabled; |
382 */ |
381 */ |
383 EXPORT_C TBool CAknPopupList::ExecuteLD() |
382 EXPORT_C TBool CAknPopupList::ExecuteLD() |
384 { |
383 { |
385 _AKNTRACE_FUNC_ENTER; |
384 _AKNTRACE_FUNC_ENTER; |
386 __ASSERT_DEBUG(iListBox,Panic(EAknPanicListboxUndefined)); |
385 __ASSERT_DEBUG(iListBox,Panic(EAknPanicListboxUndefined)); |
|
386 if ( AknLayoutUtils::PenEnabled() ) |
|
387 { |
|
388 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
|
389 if ( feedback ) |
|
390 { |
|
391 TTouchLogicalFeedback fbLogicalType = ETouchFeedbackPopUp; |
|
392 if ( CAknTransitionUtils::TransitionsEnabled( |
|
393 AknTransEffect::EComponentTransitionsOff ) ) |
|
394 { |
|
395 fbLogicalType = ETouchFeedbackIncreasingPopUp; |
|
396 } |
|
397 feedback->InstantFeedback( |
|
398 this, |
|
399 fbLogicalType, |
|
400 ETouchFeedbackVibra, |
|
401 TPointerEvent() ); |
|
402 } |
|
403 } |
|
404 |
387 iPopoutCba->SetBoundingRect(TRect(iAvkonAppUi->ApplicationRect().Size())); |
405 iPopoutCba->SetBoundingRect(TRect(iAvkonAppUi->ApplicationRect().Size())); |
388 |
406 |
389 // Disable item specific menu just before the popup is about to be shown. |
407 // Disable item specific menu just before the popup is about to be shown. |
390 // It can't be done earlier since CAknPopupList doesn't know whether the |
408 // It can't be done earlier since CAknPopupList doesn't know whether the |
391 // embedded listbox is fully constructed when passed to its constructor or |
409 // embedded listbox is fully constructed when passed to its constructor or |
399 if ( FindBox() && iListBox->Model()->NumberOfItems() == 0 ) |
417 if ( FindBox() && iListBox->Model()->NumberOfItems() == 0 ) |
400 { |
418 { |
401 STATIC_CAST(CAknFilteredTextListBoxModel*, |
419 STATIC_CAST(CAknFilteredTextListBoxModel*, |
402 ListBox()->Model())->Filter()->SetSearchField( NULL ); |
420 ListBox()->Model())->Filter()->SetSearchField( NULL ); |
403 FindBox()->Editor().SetFocus( EFalse ); |
421 FindBox()->Editor().SetFocus( EFalse ); |
|
422 __ASSERT_DEBUG( iPopupListExtension, Panic( EAknPanicNullPointer ) ); |
404 delete iPopupListExtension->iSearchControl; |
423 delete iPopupListExtension->iSearchControl; |
405 iPopupListExtension->iSearchControl = NULL; |
424 iPopupListExtension->iSearchControl = NULL; |
406 } |
425 } |
407 |
426 |
408 if (FindBox()) |
427 if (FindBox()) |
648 */ |
667 */ |
649 EXPORT_C void CAknPopupList::ProcessCommandL(TInt aCommandId) |
668 EXPORT_C void CAknPopupList::ProcessCommandL(TInt aCommandId) |
650 { |
669 { |
651 _AKNTRACE_FUNC_ENTER; |
670 _AKNTRACE_FUNC_ENTER; |
652 _AKNTRACE("ProcessCommandL: aCommandId=%d", aCommandId); |
671 _AKNTRACE("ProcessCommandL: aCommandId=%d", aCommandId); |
|
672 __ASSERT_DEBUG( iPopupListExtension, Panic( EAknPanicNullPointer ) ); |
653 // Respond to softkey events |
673 // Respond to softkey events |
654 switch (aCommandId) |
674 switch (aCommandId) |
655 { |
675 { |
656 case EAknSoftkeySelect: |
676 case EAknSoftkeySelect: |
657 case EAknSoftkeyYes: |
677 case EAknSoftkeyYes: |
707 * @param aEventType Event observed |
727 * @param aEventType Event observed |
708 */ |
728 */ |
709 EXPORT_C void CAknPopupList::HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType) |
729 EXPORT_C void CAknPopupList::HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType) |
710 { |
730 { |
711 _AKNTRACE_FUNC_ENTER; |
731 _AKNTRACE_FUNC_ENTER; |
|
732 __ASSERT_DEBUG( iPopupListExtension, Panic( EAknPanicNullPointer ) ); |
712 // Respond to events from listbox |
733 // Respond to events from listbox |
713 if (aListBox == iListBox) |
734 if (aListBox == iListBox) |
714 { |
735 { |
715 // if left softkey is empty, we do not handle enter key either. |
736 // if left softkey is empty, we do not handle enter key either. |
716 if (iPopoutCba && iPopoutCba->ButtonGroup()) |
737 if (iPopoutCba && iPopoutCba->ButtonGroup()) |
796 * @param aAccept ETrue if the user accepted. EFalse if the user cancelled. |
817 * @param aAccept ETrue if the user accepted. EFalse if the user cancelled. |
797 */ |
818 */ |
798 EXPORT_C void CAknPopupList::AttemptExitL(TBool aAccept) |
819 EXPORT_C void CAknPopupList::AttemptExitL(TBool aAccept) |
799 { |
820 { |
800 _AKNTRACE_FUNC_ENTER; |
821 _AKNTRACE_FUNC_ENTER; |
|
822 __ASSERT_DEBUG( iPopupListExtension, Panic( EAknPanicNullPointer ) ); |
801 //EFTG-7HWDP6. |
823 //EFTG-7HWDP6. |
802 if( FindBox() |
824 if( FindBox() |
803 && !( FindBox()->Editor().AknEdwinFlags() & EAknEditorFlagTouchInputModeOpened ) |
825 && !( FindBox()->Editor().AknEdwinFlags() & EAknEditorFlagTouchInputModeOpened ) |
804 && ( iPopupListExtension->iFlags & EPopupLayoutSwitchEvent ) ) |
826 && ( iPopupListExtension->iFlags & EPopupLayoutSwitchEvent ) ) |
805 { |
827 { |
820 iPopupListExtension->iFlags |= EPopupCancelAfterPointerEvent; |
842 iPopupListExtension->iFlags |= EPopupCancelAfterPointerEvent; |
821 } |
843 } |
822 } |
844 } |
823 else if( !(iPopupListExtension->iFlags & EPopupFepStartEvent) ) |
845 else if( !(iPopupListExtension->iFlags & EPopupFepStartEvent) ) |
824 { |
846 { |
|
847 if ( AknLayoutUtils::PenEnabled() ) |
|
848 { |
|
849 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
|
850 if ( feedback ) |
|
851 { |
|
852 TTouchLogicalFeedback fbLogicalType = ETouchFeedbackPopUp; |
|
853 if ( CAknTransitionUtils::TransitionsEnabled( |
|
854 AknTransEffect::EComponentTransitionsOff ) ) |
|
855 { |
|
856 fbLogicalType = ETouchFeedbackDecreasingPopUp; |
|
857 } |
|
858 feedback->InstantFeedback( |
|
859 this, |
|
860 fbLogicalType, |
|
861 ETouchFeedbackVibra, |
|
862 TPointerEvent() ); |
|
863 } |
|
864 } |
825 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS |
865 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS |
826 // no transition if accepted |
866 // no transition if accepted |
827 if( IsVisible() && GfxTransEffect::IsRegistered(this) && !aAccept ) |
867 if( IsVisible() && GfxTransEffect::IsRegistered(this) && !aAccept ) |
828 { |
868 { |
829 //If still visible, do a transition to invisible state. |
869 //If still visible, do a transition to invisible state. |
909 TRect outerRect(topLeft.Rect().iTl, bottomRight.Rect().iBr); |
949 TRect outerRect(topLeft.Rect().iTl, bottomRight.Rect().iBr); |
910 TRect innerRect(topLeft.Rect().iBr, bottomRight.Rect().iTl); |
950 TRect innerRect(topLeft.Rect().iBr, bottomRight.Rect().iTl); |
911 |
951 |
912 TInt softkeyHeight( KSoftkeyHeightUndefined ); |
952 TInt softkeyHeight( KSoftkeyHeightUndefined ); |
913 |
953 |
|
954 __ASSERT_DEBUG( iPopupListExtension, Panic( EAknPanicNullPointer ) ); |
914 if (!iPopupListExtension->iBgContext) |
955 if (!iPopupListExtension->iBgContext) |
915 { |
956 { |
916 TRAP_IGNORE( iPopupListExtension->iBgContext = CAknsFrameBackgroundControlContext::NewL( |
957 TRAP_IGNORE( iPopupListExtension->iBgContext = CAknsFrameBackgroundControlContext::NewL( |
917 KAknsIIDQsnFrPopup, outerRect, innerRect, ETrue ) ); |
958 KAknsIIDQsnFrPopup, outerRect, innerRect, ETrue ) ); |
918 iPopupListExtension->iBgContext->SetParentPos( PositionRelativeToScreen() ); |
959 iPopupListExtension->iBgContext->SetParentPos( PositionRelativeToScreen() ); |
1075 { |
1116 { |
1076 return aId.MakePtr(this); |
1117 return aId.MakePtr(this); |
1077 } |
1118 } |
1078 if (aId.iUid == MAknsControlContext::ETypeId) |
1119 if (aId.iUid == MAknsControlContext::ETypeId) |
1079 { |
1120 { |
1080 if (iPopupListExtension && iPopupListExtension->iBgContext) |
1121 __ASSERT_DEBUG( iPopupListExtension, Panic( EAknPanicNullPointer ) ); |
|
1122 if (iPopupListExtension->iBgContext) |
1081 { |
1123 { |
1082 return MAknsControlContext::SupplyMopObject(aId, iPopupListExtension->iBgContext); |
1124 return MAknsControlContext::SupplyMopObject(aId, iPopupListExtension->iBgContext); |
1083 } |
1125 } |
1084 else if ( iListBox && |
1126 else if ( iListBox && |
1085 iListBox->View() && |
1127 iListBox->View() && |
1129 _AKNTRACE("HandlePointerEventL: aPointerEvent.iPosition=(%d,%d)", |
1171 _AKNTRACE("HandlePointerEventL: aPointerEvent.iPosition=(%d,%d)", |
1130 aPointerEvent.iPosition.iX, aPointerEvent.iPosition.iY); |
1172 aPointerEvent.iPosition.iX, aPointerEvent.iPosition.iY); |
1131 |
1173 |
1132 if ( AknLayoutUtils::PenEnabled() ) |
1174 if ( AknLayoutUtils::PenEnabled() ) |
1133 { |
1175 { |
|
1176 __ASSERT_DEBUG( iPopupListExtension, Panic( EAknPanicNullPointer ) ); |
1134 iPopupListExtension->iFlags |= EPopupHandlingPointerEvent; |
1177 iPopupListExtension->iFlags |= EPopupHandlingPointerEvent; |
1135 |
1178 |
1136 TInt index; |
1179 TInt index; |
1137 TBool pointerOnItem = iListBox->View()->XYPosToItemIndex( aPointerEvent.iPosition, index ); |
1180 TBool pointerOnItem = iListBox->View()->XYPosToItemIndex( aPointerEvent.iPosition, index ); |
1138 if ( aPointerEvent.iType == TPointerEvent::EButton1Down |
1181 if ( aPointerEvent.iType == TPointerEvent::EButton1Down |
1160 && ( iPopupListExtension->iFlags |
1203 && ( iPopupListExtension->iFlags |
1161 & EPopupAcceptAfterPointerEvent ) ) |
1204 & EPopupAcceptAfterPointerEvent ) ) |
1162 { |
1205 { |
1163 AttemptExitL( ETrue ); |
1206 AttemptExitL( ETrue ); |
1164 } |
1207 } |
1165 else |
|
1166 { |
|
1167 AttemptExitL( EFalse ); |
|
1168 } |
|
1169 } |
1208 } |
1170 |
1209 |
1171 //EFTG-7HWDP6. |
1210 //EFTG-7HWDP6. |
1172 //If model didn't change from portrait to landscape, |
1211 //If model didn't change from portrait to landscape, |
1173 //EPopupFepStartEvent should be deleted. |
1212 //EPopupFepStartEvent should be deleted. |
1177 } |
1216 } |
1178 } |
1217 } |
1179 break; |
1218 break; |
1180 case TPointerEvent::EButton1Down: |
1219 case TPointerEvent::EButton1Down: |
1181 _AKNTRACE("CAknPopupList::HandlePointerEventL: TPointerEvent::EButton1Down"); |
1220 _AKNTRACE("CAknPopupList::HandlePointerEventL: TPointerEvent::EButton1Down"); |
1182 // as in comments close popup if pointer goes outside of the popup list |
1221 if ( FindBox() |
1183 if ( !Rect().Contains( aPointerEvent.iPosition ) ) |
1222 && ( FindBox()->Editor().Rect().Contains( aPointerEvent.iPosition ) ) |
|
1223 && !( iPopupListExtension->iFlags & EPopupLayoutSwitchEvent ) ) |
1184 { |
1224 { |
1185 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
1225 iPopupListExtension->iFlags |= EPopupFepStartEvent; |
1186 if ( feedback ) |
|
1187 { |
|
1188 feedback->InstantFeedback( ETouchFeedbackPopUp ); |
|
1189 } |
|
1190 AttemptExitL( EFalse ); |
|
1191 } |
|
1192 else |
|
1193 { |
|
1194 if( FindBox() |
|
1195 && ( FindBox()->Editor().Rect().Contains( aPointerEvent.iPosition ) ) |
|
1196 && !( iPopupListExtension->iFlags & EPopupLayoutSwitchEvent ) ) |
|
1197 { |
|
1198 iPopupListExtension->iFlags |= EPopupFepStartEvent; |
|
1199 } |
|
1200 } |
1226 } |
1201 break; |
1227 break; |
1202 case TPointerEvent::EDrag: |
1228 case TPointerEvent::EDrag: |
1203 _AKNTRACE("CAknPopupList::HandlePointerEventL: TPointerEvent::EDrag"); |
1229 _AKNTRACE("CAknPopupList::HandlePointerEventL: TPointerEvent::EDrag"); |
1204 if ( !iListBox->Rect().Contains( aPointerEvent.iPosition )) |
1230 if ( !iListBox->Rect().Contains( aPointerEvent.iPosition )) |
1218 return NULL; |
1244 return NULL; |
1219 } |
1245 } |
1220 |
1246 |
1221 EXPORT_C TBool CAknPopupList::EnableFind(TBool /*aEnable*/) |
1247 EXPORT_C TBool CAknPopupList::EnableFind(TBool /*aEnable*/) |
1222 { |
1248 { |
1223 if (!iPopupListExtension) |
1249 __ASSERT_DEBUG( iPopupListExtension, Panic( EAknPanicNullPointer ) ); |
1224 return EFalse; // no extension class, failed |
|
1225 if (!iPopupListExtension->iSearchControl) |
1250 if (!iPopupListExtension->iSearchControl) |
1226 { |
1251 { |
1227 CAknSearchField::TSearchFieldStyle flags = CAknSearchField::EPopupWindow; |
1252 CAknSearchField::TSearchFieldStyle flags = CAknSearchField::EPopupWindow; |
1228 TRAPD(err, |
1253 TRAPD(err, |
1229 iPopupListExtension->iSearchControl = CAknSearchField::NewL( *this, flags, 0, 40 ); |
1254 iPopupListExtension->iSearchControl = CAknSearchField::NewL( *this, flags, 0, 40 ); |
1251 return ETrue; |
1276 return ETrue; |
1252 } |
1277 } |
1253 |
1278 |
1254 EXPORT_C TBool CAknPopupList::EnableAdaptiveFind(TBool /*aEnable*/) |
1279 EXPORT_C TBool CAknPopupList::EnableAdaptiveFind(TBool /*aEnable*/) |
1255 { |
1280 { |
1256 if (!iPopupListExtension) |
1281 __ASSERT_DEBUG( iPopupListExtension, Panic( EAknPanicNullPointer ) ); |
1257 return EFalse; // no extension class, failed |
|
1258 if (!iPopupListExtension->iSearchControl) |
1282 if (!iPopupListExtension->iSearchControl) |
1259 { |
1283 { |
1260 CAknSearchField::TSearchFieldStyle flags = CAknSearchField::EPopupAdaptiveSearchWindow; |
1284 CAknSearchField::TSearchFieldStyle flags = CAknSearchField::EPopupAdaptiveSearchWindow; |
1261 TRAPD(err, |
1285 TRAPD(err, |
1262 iPopupListExtension->iSearchControl = CAknSearchField::NewL( *this, flags, 0, 40 ); |
1286 iPopupListExtension->iSearchControl = CAknSearchField::NewL( *this, flags, 0, 40 ); |
1285 } |
1309 } |
1286 |
1310 |
1287 |
1311 |
1288 EXPORT_C CAknSearchField* CAknPopupList::FindBox() const |
1312 EXPORT_C CAknSearchField* CAknPopupList::FindBox() const |
1289 { |
1313 { |
1290 if (iPopupListExtension) |
1314 __ASSERT_DEBUG( iPopupListExtension, Panic( EAknPanicNullPointer ) ); |
1291 return iPopupListExtension->iSearchControl; |
1315 return iPopupListExtension->iSearchControl; |
1292 return NULL; |
|
1293 } |
1316 } |
1294 |
1317 |
1295 void CAknPopupList::RemoveFindFiltering() |
1318 void CAknPopupList::RemoveFindFiltering() |
1296 { |
1319 { |
1297 if (FindBox()) |
1320 if (FindBox()) |
1308 EXPORT_C void CAknPopupList::HandleResourceChange(TInt aType) |
1331 EXPORT_C void CAknPopupList::HandleResourceChange(TInt aType) |
1309 { |
1332 { |
1310 _AKNTRACE_FUNC_ENTER; |
1333 _AKNTRACE_FUNC_ENTER; |
1311 if( aType == KEikDynamicLayoutVariantSwitch ) |
1334 if( aType == KEikDynamicLayoutVariantSwitch ) |
1312 { |
1335 { |
1313 |
1336 __ASSERT_DEBUG( iPopupListExtension, Panic( EAknPanicNullPointer ) ); |
1314 //EFTG-7HWDP6. |
1337 //EFTG-7HWDP6. |
1315 //Tapping Edit'area can arouse the CAknPopupList::HandleResourceChange() |
1338 //Tapping Edit'area can arouse the CAknPopupList::HandleResourceChange() |
1316 //when portrait is initial model, and 'Full screen QWERTY keyboard' is default input method. |
1339 //when portrait is initial model, and 'Full screen QWERTY keyboard' is default input method. |
1317 //Just then, EPopupLayoutSwitchEvent will be setted once. |
1340 //Just then, EPopupLayoutSwitchEvent will be setted once. |
1318 if( ( iPopupListExtension->iFlags & EPopupFepStartEvent ) && |
1341 if( ( iPopupListExtension->iFlags & EPopupFepStartEvent ) && |