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