46 #include "peninputgenericitutconverter.h" |
46 #include "peninputgenericitutconverter.h" |
47 |
47 |
48 _LIT(KEmptyString, ""); |
48 _LIT(KEmptyString, ""); |
49 const TInt KPeriodicTimerIntervalSec(2500000); |
49 const TInt KPeriodicTimerIntervalSec(2500000); |
50 /* Teleca change end, 18.05.2009 ssal */ |
50 /* Teleca change end, 18.05.2009 ssal */ |
|
51 |
|
52 const TInt KSCTPreventTime = 1000 * 1000; |
|
53 |
|
54 TInt PreventSCTTimerCallback( TAny* aData ) |
|
55 { |
|
56 CGenericItutWindowManager* windowMgr = |
|
57 static_cast<CGenericItutWindowManager*>( aData ); |
|
58 windowMgr->SetAllowHandleRawKeyEventFlag( ETrue ); |
|
59 windowMgr->StopPreventSCTTimer(); |
|
60 return 0; |
|
61 } |
|
62 |
51 CGenericItutWindowManager* CGenericItutWindowManager::NewL(CGenericItutUiLayout* aLayoutOwner, |
63 CGenericItutWindowManager* CGenericItutWindowManager::NewL(CGenericItutUiLayout* aLayoutOwner, |
52 CGenericItutDataMgr* aDataMgr) |
64 CGenericItutDataMgr* aDataMgr) |
53 { |
65 { |
54 CGenericItutWindowManager* layout = new (ELeave) |
66 CGenericItutWindowManager* layout = new (ELeave) |
55 CGenericItutWindowManager(aLayoutOwner,aDataMgr); |
67 CGenericItutWindowManager(aLayoutOwner,aDataMgr); |
61 |
73 |
62 CGenericItutWindowManager::CGenericItutWindowManager(CGenericItutUiLayout* aLayoutOwner, |
74 CGenericItutWindowManager::CGenericItutWindowManager(CGenericItutUiLayout* aLayoutOwner, |
63 CGenericItutDataMgr* aDataMgr) |
75 CGenericItutDataMgr* aDataMgr) |
64 :iLayoutOwner(aLayoutOwner), |
76 :iLayoutOwner(aLayoutOwner), |
65 iDataMgr(aDataMgr), |
77 iDataMgr(aDataMgr), |
66 iLastRawKeyDown(EStdKeyNull) |
78 iLastRawKeyDown(EStdKeyNull), |
|
79 iAllowHandleRawKeyEvent( ETrue ), |
|
80 iPreventCSTTimer( NULL ) |
67 |
81 |
68 { |
82 { |
69 iInEditWordQueryDlg = EFalse; |
83 iInEditWordQueryDlg = EFalse; |
70 } |
84 } |
71 |
85 |
77 { |
91 { |
78 iInfoTimer->Cancel(); |
92 iInfoTimer->Cancel(); |
79 } |
93 } |
80 delete iInfoTimer; |
94 delete iInfoTimer; |
81 /* Teleca change end, 18.05.2009 ssal */ |
95 /* Teleca change end, 18.05.2009 ssal */ |
|
96 |
|
97 iPreventCSTTimer->Cancel(); |
|
98 delete iPreventCSTTimer; |
82 } |
99 } |
83 |
100 |
84 void CGenericItutWindowManager::SetPropertyL(MItutPropertySubscriber::TItutProperty aPropertyName, |
101 void CGenericItutWindowManager::SetPropertyL(MItutPropertySubscriber::TItutProperty aPropertyName, |
85 const TDesC& aPropertyValue) |
102 const TDesC& aPropertyValue) |
86 { |
103 { |
92 { |
109 { |
93 iWindow = CGenericItutWindow::NewL(this, iLayoutOwner,iDataMgr); |
110 iWindow = CGenericItutWindow::NewL(this, iLayoutOwner,iDataMgr); |
94 /* Teleca change begin, 18.05.2009 ssal */ |
111 /* Teleca change begin, 18.05.2009 ssal */ |
95 iInfoTimer = CPeriodic::NewL(CActive::EPriorityStandard); |
112 iInfoTimer = CPeriodic::NewL(CActive::EPriorityStandard); |
96 /* Teleca change end, 18.05.2009 ssal */ |
113 /* Teleca change end, 18.05.2009 ssal */ |
|
114 |
|
115 iPreventCSTTimer = CPeriodic::NewL( CActive::EPriorityStandard ); |
97 } |
116 } |
98 |
117 |
99 void CGenericItutWindowManager::SimulateRawEvent(TInt aScanCode, TRawEvent::TType aType) |
118 void CGenericItutWindowManager::SimulateRawEvent(TInt aScanCode, TRawEvent::TType aType) |
100 { |
119 { |
101 iLayoutOwner->SimulateRawEvent(aScanCode, aType); |
120 iLayoutOwner->SimulateRawEvent(aScanCode, aType); |
123 { |
142 { |
124 switch(aEventType) |
143 switch(aEventType) |
125 { |
144 { |
126 case EEventRawKeyDownEvent: |
145 case EEventRawKeyDownEvent: |
127 { |
146 { |
128 const TKeyEvent *key = reinterpret_cast<const TKeyEvent*>(aEventData.Ptr()); |
147 if ( iAllowHandleRawKeyEvent ) |
129 SimulateRawEvent(key->iScanCode,TRawEvent::EKeyDown); |
148 { |
130 SetLastRawKeyDown(key->iScanCode, ETrue, aCtrl); |
149 const TKeyEvent *key = reinterpret_cast<const TKeyEvent*>(aEventData.Ptr()); |
|
150 SimulateRawEvent(key->iScanCode,TRawEvent::EKeyDown); |
|
151 SetLastRawKeyDown(key->iScanCode, ETrue, aCtrl); |
|
152 } |
131 } |
153 } |
132 break; |
154 break; |
133 case EEventRawKeyUpEvent: |
155 case EEventRawKeyUpEvent: |
134 { |
156 { |
135 const TKeyEvent *key = reinterpret_cast<const TKeyEvent*>(aEventData.Ptr()); |
157 if ( iAllowHandleRawKeyEvent ) |
136 SimulateRawEvent(key->iScanCode,TRawEvent::EKeyUp); |
158 { |
137 SetLastRawKeyDown(key->iScanCode, EFalse, aCtrl); |
159 const TKeyEvent *key = reinterpret_cast<const TKeyEvent*>(aEventData.Ptr()); |
|
160 SimulateRawEvent(key->iScanCode,TRawEvent::EKeyUp); |
|
161 SetLastRawKeyDown(key->iScanCode, EFalse, aCtrl); |
|
162 } |
138 } |
163 } |
139 break; |
164 break; |
140 case EItutCmdEnterSpellMode: |
165 case EItutCmdEnterSpellMode: |
141 { |
166 { |
|
167 StartPreventSCTTimer(); |
142 iLayoutOwner->SignalOwner(ESignalEnterSpellMode); |
168 iLayoutOwner->SignalOwner(ESignalEnterSpellMode); |
143 } |
169 } |
144 break; |
170 break; |
145 case EEventButtonUp: |
171 case EEventButtonUp: |
146 { |
172 { |
222 else if (aCtrl->ControlId() == ECtrlIdMatchSelection) |
248 else if (aCtrl->ControlId() == ECtrlIdMatchSelection) |
223 { |
249 { |
224 if (event->iCommand == EItutCmdPredictItemSelected) |
250 if (event->iCommand == EItutCmdPredictItemSelected) |
225 ReportItemSelected(ESignalSelectMatchSelectionText, event->iIndex, ETrue); |
251 ReportItemSelected(ESignalSelectMatchSelectionText, event->iIndex, ETrue); |
226 else if (event->iCommand == EItutCmdEnterSpellMode) |
252 else if (event->iCommand == EItutCmdEnterSpellMode) |
|
253 { |
|
254 StartPreventSCTTimer(); |
227 iLayoutOwner->SignalOwner(ESignalEnterSpellMode); |
255 iLayoutOwner->SignalOwner(ESignalEnterSpellMode); |
|
256 } |
228 } |
257 } |
229 else if (aCtrl->ControlId() == ECtrlIdEditorMenu) |
258 else if (aCtrl->ControlId() == ECtrlIdEditorMenu) |
230 { |
259 { |
231 if (event->iIndex == -1) |
260 if (event->iIndex == -1) |
232 { |
261 { |
436 CFepUiLayout* CGenericItutWindowManager::UiLayout() |
465 CFepUiLayout* CGenericItutWindowManager::UiLayout() |
437 { |
466 { |
438 return iLayoutOwner; |
467 return iLayoutOwner; |
439 } |
468 } |
440 |
469 |
441 TBool CGenericItutWindowManager::IsPortraitWest() |
|
442 { |
|
443 return !iDataMgr->IsChinese() && !iDataMgr->IsLandScape(); |
|
444 } |
|
445 void CGenericItutWindowManager::HandleAppInfoChangeL(const TDesC& aInfo) |
470 void CGenericItutWindowManager::HandleAppInfoChangeL(const TDesC& aInfo) |
446 { |
471 { |
447 CGenericItutUiLayout * itutLayoutOwner; |
472 CGenericItutUiLayout * itutLayoutOwner; |
448 itutLayoutOwner = static_cast<CGenericItutUiLayout *>(UiLayout()); |
473 itutLayoutOwner = static_cast<CGenericItutUiLayout *>(UiLayout()); |
449 if ( aInfo.Length() > 0 && |
474 if ( aInfo.Length() > 0 && |
450 itutLayoutOwner->UiMgr()->CurrentState() && |
475 itutLayoutOwner->UiMgr()->CurrentState() && |
451 itutLayoutOwner->UiMgr()->CurrentState()->StateType() != |
476 itutLayoutOwner->UiMgr()->CurrentState()->StateType() != |
452 CGenericItutUiMgrBase::EStateSpelling && |
477 CGenericItutUiMgrBase::EStateSpelling && |
453 !iInEditWordQueryDlg) |
478 !iInEditWordQueryDlg) |
454 { |
479 { |
455 if ( IsPortraitWest() && (!iDataMgr->IsChineseSpellMode())) |
480 if ( iDataMgr->IsPortraitWest() && (!iDataMgr->IsChineseSpellMode())) |
456 { |
481 { |
457 iWindow->Icf()->HideBubble(); |
482 iWindow->Icf()->HideBubble(); |
458 iWindow->SetIndiWithTextFlag( ETrue ); |
483 iWindow->SetIndiWithTextFlag( ETrue ); |
459 iWindow->IndiBubbleWithText(); |
484 iWindow->IndiBubbleWithText(); |
460 |
485 |
699 { |
724 { |
700 CGenericItutWindowManager* manager = static_cast<CGenericItutWindowManager*>(aPointer); |
725 CGenericItutWindowManager* manager = static_cast<CGenericItutWindowManager*>(aPointer); |
701 manager->HideByteWarningBubble(); |
726 manager->HideByteWarningBubble(); |
702 return KErrNone; |
727 return KErrNone; |
703 } |
728 } |
704 |
729 |
|
730 TBool CGenericItutWindowManager::IsAllowHandleRawKeyEvent() |
|
731 { |
|
732 return iAllowHandleRawKeyEvent; |
|
733 } |
|
734 |
|
735 void CGenericItutWindowManager::SetAllowHandleRawKeyEventFlag( TBool aFlag ) |
|
736 { |
|
737 iAllowHandleRawKeyEvent = aFlag; |
|
738 } |
|
739 |
|
740 void CGenericItutWindowManager::StartPreventSCTTimer() |
|
741 { |
|
742 iAllowHandleRawKeyEvent = EFalse; |
|
743 |
|
744 TTimeIntervalMicroSeconds32 t = KSCTPreventTime; |
|
745 iPreventCSTTimer->Start( t, t, |
|
746 TCallBack(PreventSCTTimerCallback, this)); |
|
747 } |
|
748 |
|
749 void CGenericItutWindowManager::StopPreventSCTTimer() |
|
750 { |
|
751 iPreventCSTTimer->Cancel(); |
|
752 } |
|
753 |
705 void CGenericItutWindowManager::HideByteWarningBubble() |
754 void CGenericItutWindowManager::HideByteWarningBubble() |
706 { |
755 { |
707 if (!iInfoTimer) |
756 if (!iInfoTimer) |
708 { |
757 { |
709 return; |
758 return; |