author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 15 Sep 2010 12:34:44 +0300 | |
branch | RCL_3 |
changeset 50 | 5a1685599b76 |
parent 44 | ecbabf52600f |
child 56 | 8152b1f1763a |
permissions | -rw-r--r-- |
44 | 1 |
/* |
2 |
* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). |
|
3 |
* All rights reserved. |
|
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of "Eclipse Public License v1.0"" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Nokia Corporation - initial contribution. |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* |
|
14 |
* Description: Implementation of Pinyin and Stroke phrase candidate state |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
||
20 |
||
21 |
||
22 |
||
23 |
||
24 |
||
25 |
||
26 |
||
27 |
||
28 |
||
29 |
// System includes |
|
30 |
#include <PtiEngine.h> |
|
31 |
#include <PtiUserDicEntry.h> |
|
32 |
#include <aknnotewrappers.h> //CAknWarningNote |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
33 |
#include "AknFepUiManagerBase.h" |
44 | 34 |
|
35 |
const TInt KMinCandidateCount = 1; |
|
36 |
// User includes |
|
37 |
#include "AknFepUiInputStateCandidateMiniQwertyPinyinAndStrokePhrase.h" |
|
38 |
#include "AknFepUiInputStateCandidateQwertyBaseChinesePhrase.h" |
|
39 |
#include "AknFepUiCtrlContainerChinese.h" |
|
40 |
#include "AknFepUICtrlCandidatePane.h" |
|
41 |
#include "AknFepUICtrlInputPane.h" |
|
42 |
#include "aknfepuictrleditpane.h" //phrase creation |
|
43 |
#include "AknFepUIManagerStateInterface.h" |
|
44 |
#include "AknFepManager.h" |
|
45 |
#include <aknfep.rsg> |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
46 |
#include "AknFepUiManagerChinese.h" |
44 | 47 |
|
48 |
// --------------------------------------------------------------------------- |
|
49 |
// AknFepUiInputStateCandidateMiniQwertyPinyinAndStrokePhrase:: |
|
50 |
// TAknFepUiInputStateCandidateMiniQwertyPinyinAndStrokePhrase |
|
51 |
// (other items were commented in a header). |
|
52 |
// --------------------------------------------------------------------------- |
|
53 |
// |
|
54 |
TAknFepUiInputStateCandidateMiniQwertyPinyinAndStrokePhrase:: |
|
55 |
TAknFepUiInputStateCandidateMiniQwertyPinyinAndStrokePhrase(MAknFepUIManagerStateInterface* aOwner, |
|
56 |
MAknFepUICtrlContainerChinese* aUIContainer) |
|
57 |
:TAknFepInputMiniQwertyPinyinPhraseBase(aOwner, aUIContainer) |
|
58 |
{ |
|
59 |
iState = ECandidate; |
|
60 |
MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
61 |
||
62 |
TBool multiplePages = !(uiContainer->CandidatePane()->IsLastPage() && |
|
63 |
uiContainer->CandidatePane()->IsFirstPage()); |
|
64 |
TInt bufLength = iOwner->PtiEngine()->CandidatePage().Length(); |
|
65 |
TBool showHorizontalScrollArrows = multiplePages || bufLength > KMinCandidateCount; |
|
66 |
||
67 |
uiContainer->ShowHorizontalScrollArrows(showHorizontalScrollArrows); |
|
68 |
uiContainer->ShowVerticalScrollArrows(multiplePages); |
|
69 |
uiContainer->FocusCandidatePane(ETrue); |
|
70 |
uiContainer->CandidatePane()->ShowCandidateOrdinals(ETrue); |
|
71 |
uiContainer->CandidatePane()->SelectFirstPhrase(); |
|
72 |
UIContainer()->EditPaneWindow()->DisableCursor(); |
|
73 |
} |
|
74 |
||
75 |
// --------------------------------------------------------------------------- |
|
76 |
// AknFepUiInputStateCandidateMiniQwertyPinyinAndStrokePhrase::HandleKeyL |
|
77 |
// (other items were commented in a header). |
|
78 |
// --------------------------------------------------------------------------- |
|
79 |
// |
|
80 |
TBool TAknFepUiInputStateCandidateMiniQwertyPinyinAndStrokePhrase::HandleKeyL(TInt aKey, |
|
81 |
TKeyPressLength aLength) |
|
82 |
{ |
|
83 |
TInt selected = UIContainer()->CandidatePane()->SelectedIndex(); |
|
84 |
TInt numbertotal = UIContainer()->CandidatePane()->VisibleCandidateCount(); |
|
85 |
||
86 |
if ( iOwner->FepMan()->IsFlagSet( CAknFepManager::EFlagQwertyChrKeyDepressed ) |
|
87 |
|| iOwner->FepMan()->IsFlagSet( CAknFepManager::EFlagShiftKeyDepressed ) ) |
|
88 |
{ |
|
89 |
iOwner->FepMan()->PlaySound( EAvkonSIDErrorTone ); |
|
90 |
return ETrue; |
|
91 |
} |
|
92 |
TBool ret = EFalse; |
|
93 |
switch ( aKey ) |
|
94 |
{ |
|
95 |
case EStdKeySpace: |
|
96 |
{ |
|
97 |
if ( ECangJie ==iOwner->FepMan()->InputMode() ) |
|
98 |
{ |
|
99 |
TPtrC text = UIContainer()->CandidatePane()->CurrentPhraseCandidate(); |
|
100 |
if ( text.Length() ) |
|
101 |
{ |
|
102 |
MAknFepManagerUIInterface* fepMan = iOwner->FepMan(); |
|
103 |
fepMan->NewTextL( text ); |
|
104 |
fepMan->CommitInlineEditL(); |
|
105 |
iOwner->PtiEngine()->SetPredictiveChineseChar( text ); |
|
106 |
if ( fepMan->IsFlagSet( CAknFepManager::EFlagEditorFull ) ) |
|
107 |
{ |
|
108 |
fepMan->ClearFlag( CAknFepManager::EFlagEditorFull ); |
|
109 |
iOwner->FepMan()->TryCloseUiL(); |
|
110 |
} |
|
111 |
else |
|
112 |
{ |
|
113 |
UIContainer()->EditPaneWindow()->SetChangeState(ETrue); |
|
114 |
iOwner->ChangeState( EPredictiveCandidate ); |
|
115 |
} |
|
116 |
} |
|
117 |
} |
|
118 |
else |
|
119 |
{ |
|
120 |
iOwner->FepMan()->PlaySound( EAvkonSIDErrorTone ); |
|
121 |
} |
|
122 |
ret = ETrue; |
|
123 |
} |
|
124 |
break; |
|
125 |
case EStdKeyBackspace: |
|
126 |
{ |
|
127 |
UIContainer()->CandidatePane()->SetCandidateBuffer(); |
|
128 |
UIContainer()->EditPaneWindow()->SetAutoChangeStateFlag( EManualChangeState ); |
|
129 |
UIContainer()->EditPaneWindow()->SetChangeState( ETrue ); |
|
130 |
iOwner->ChangeState( EMiniQwertyEdit ); |
|
131 |
iOwner->FepMan()->UpdateCbaL( R_AKNFEP_SOFTKEYS_OK_SELECT_CANCEL ); |
|
132 |
ret = ETrue; |
|
133 |
} |
|
134 |
break; |
|
135 |
case EStdKeyLeftArrow: |
|
136 |
{ |
|
137 |
if ( selected == 0 ) |
|
138 |
{ |
|
139 |
UIContainer()->CandidatePane()->SelectIndex( numbertotal - 1 ); |
|
140 |
} |
|
141 |
else |
|
142 |
{ |
|
143 |
UIContainer()->CandidatePane()->SelectIndex( selected - 1 ); |
|
144 |
} |
|
145 |
UpdateIndicator(); |
|
146 |
ret = ETrue; |
|
147 |
} |
|
148 |
break; |
|
149 |
case EStdKeyRightArrow: |
|
150 |
{ |
|
151 |
if ( selected == numbertotal - 1 ) |
|
152 |
{ |
|
153 |
UIContainer()->CandidatePane()->SelectIndex( 0 ); |
|
154 |
} |
|
155 |
else |
|
156 |
{ |
|
157 |
UIContainer()->CandidatePane()->SelectIndex( selected + 1 ); |
|
158 |
} |
|
159 |
UpdateIndicator(); |
|
160 |
ret = ETrue; |
|
161 |
} |
|
162 |
break; |
|
163 |
case EStdKeyDownArrow: |
|
164 |
{ |
|
165 |
ret = TAknFepInputStateCandidateQwertyBaseChinesePhrase::HandleKeyL(aKey, aLength); |
|
166 |
} |
|
167 |
break; |
|
168 |
case EStdKeyUpArrow: |
|
169 |
{ |
|
170 |
if ( UIContainer()->CandidatePane()->IsFirstPage() ) |
|
171 |
{ |
|
172 |
UIContainer()->EditPaneWindow()->SetAutoChangeStateFlag( EManualChangeState ); |
|
173 |
iOwner->ChangeState( EMiniQwertyEdit ); |
|
174 |
return ETrue; |
|
175 |
} |
|
176 |
else |
|
177 |
{ |
|
178 |
UIContainer()->CandidatePane()->PreviousCandidatePage(); |
|
179 |
UIContainer()->CandidatePane()->SetCandidateBuffer(); |
|
180 |
UIContainer()->CandidatePane()->SelectFirstPhrase(); |
|
181 |
UpdateIndicator(); |
|
182 |
} |
|
183 |
ret = ETrue; |
|
184 |
} |
|
185 |
break; |
|
186 |
case EStdKeyEnter: |
|
187 |
{ |
|
188 |
if ( EStroke == iOwner->FepMan()->InputMode() || |
|
189 |
ECangJie == iOwner->FepMan()->InputMode() || |
|
190 |
EPinyin == iOwner->FepMan()->InputMode() ) |
|
191 |
{ |
|
192 |
iOwner->FepMan()->PlaySound( EAvkonSIDErrorTone ); |
|
193 |
} |
|
194 |
ret = ETrue; |
|
195 |
} |
|
196 |
break; |
|
197 |
case EStdKeyDevice0: |
|
198 |
case EStdKeyDevice3: |
|
199 |
{ |
|
200 |
TPtrC text = UIContainer()->CandidatePane()->CurrentPhraseCandidate(); |
|
201 |
if ( text.Length() && aLength != ELongKeyPress ) |
|
202 |
{ |
|
203 |
if ( !CommitInlineEEPL( text ) ) |
|
204 |
{ |
|
205 |
DoActionAfterCommit(); |
|
206 |
} |
|
207 |
else |
|
208 |
{ |
|
209 |
if ( CheckFirstGroupStroke() ) |
|
210 |
{ |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
211 |
//stroke to be shown |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
212 |
if ( iPlugin.IsEnable()) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
213 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
214 |
iPlugin.AnalyseL(); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
215 |
} |
44 | 216 |
RefreshUI( EFalse ); |
217 |
UIContainer()->CandidatePane()->SelectFirstPhrase(); |
|
218 |
} |
|
219 |
else |
|
220 |
{ |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
221 |
//stroke to be shown |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
222 |
if ( iPlugin.IsEnable()) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
223 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
224 |
iPlugin.AnalyseL(); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
225 |
} |
44 | 226 |
UIContainer()->EditPaneWindow()->SetAutoChangeStateFlag( EAutoChangeStateFromCandidate ); |
227 |
iOwner->ChangeState( EMiniQwertyEdit ); |
|
228 |
} |
|
229 |
} |
|
230 |
} |
|
231 |
} |
|
232 |
ret = ETrue; |
|
233 |
break; |
|
234 |
case EKeyLeftCtrl: |
|
235 |
case EKeyRightCtrl: |
|
236 |
case EKeyLeftShift: |
|
237 |
{ |
|
238 |
iOwner->FepMan()->PlaySound( EAvkonSIDErrorTone ); |
|
239 |
ret = ETrue; |
|
240 |
} |
|
241 |
break; |
|
242 |
case EKeyRightShift: |
|
243 |
{ |
|
244 |
ret = ETrue; |
|
245 |
} |
|
246 |
break; |
|
247 |
default: |
|
248 |
return TAknFepInputMiniQwertyPinyinPhraseBase::HandleKeyL( |
|
249 |
aKey, aLength ); |
|
250 |
} |
|
251 |
return ret; |
|
252 |
} |
|
253 |
// --------------------------------------------------------------------------- |
|
254 |
// TAknFepUiInputStateCandidateMiniQwertyPinyinAndStrokePhrase::HandleCommandL |
|
255 |
// Handling Command |
|
256 |
// --------------------------------------------------------------------------- |
|
257 |
// |
|
258 |
void TAknFepUiInputStateCandidateMiniQwertyPinyinAndStrokePhrase::HandleCommandL( |
|
259 |
TInt aCommandId ) |
|
260 |
{ |
|
261 |
TPtrC text = UIContainer()->CandidatePane()->CurrentPhraseCandidate( ); |
|
262 |
switch ( aCommandId ) |
|
263 |
{ |
|
264 |
// Handle the event frome command. |
|
265 |
case EAknSoftkeySelect: |
|
266 |
// case (TUint16)EAknSoftkeySelect: //the Selected in soft CBA |
|
267 |
if ( text.Length( ) ) |
|
268 |
{ |
|
269 |
if ( !CommitInlineEEPL( text ) ) |
|
270 |
{ |
|
271 |
DoActionAfterCommit( ); |
|
272 |
} |
|
273 |
else |
|
274 |
{ |
|
275 |
if ( CheckFirstGroupStroke( ) ) |
|
276 |
{ |
|
277 |
RefreshUI( EFalse ); |
|
278 |
UIContainer()->CandidatePane()->SelectFirstPhrase( ); |
|
279 |
} |
|
280 |
else |
|
281 |
{ |
|
282 |
UIContainer()->EditPaneWindow()->SetAutoChangeStateFlag( EAutoChangeStateFromCandidate ); |
|
283 |
iOwner->ChangeState( EMiniQwertyEdit ); |
|
284 |
} |
|
285 |
} |
|
286 |
} |
|
287 |
break; |
|
288 |
default: |
|
289 |
TAknFepInputStateChineseBase::HandleCommandL( aCommandId ); |
|
290 |
break; |
|
291 |
} |
|
292 |
} |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
293 |
void TAknFepUiInputStateCandidateMiniQwertyPinyinAndStrokePhrase::SubmitTextL( const TDesC& aText ) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
294 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
295 |
if ( aText.Length() ) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
296 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
297 |
if ( !CommitInlineEEPL( aText ) ) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
298 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
299 |
DoActionAfterCommit(); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
300 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
301 |
else |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
302 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
303 |
if ( CheckFirstGroupStroke() ) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
304 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
305 |
//stroke to be shown |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
306 |
if ( iPlugin.IsEnable()) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
307 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
308 |
iPlugin.AnalyseL(); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
309 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
310 |
RefreshUI( EFalse ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
311 |
UIContainer()->CandidatePane()->SelectFirstPhrase(); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
312 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
313 |
else |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
314 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
315 |
if ( iPlugin.IsEnable()) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
316 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
317 |
iPlugin.AnalyseL(); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
318 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
319 |
UIContainer()->EditPaneWindow()->SetAutoChangeStateFlag( EAutoChangeStateFromCandidate ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
320 |
iOwner->ChangeState( EMiniQwertyEdit ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
321 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
322 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
323 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
324 |
} |
44 | 325 |
// End of file |