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 46 | bd83ceabce89 |
child 56 | 8152b1f1763a |
permissions | -rw-r--r-- |
44 | 1 |
/* |
2 |
* Copyright (c) 2008 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: |
|
15 |
* Provides the TAknFepInputStateStrokePhraseCreationBase definition. |
|
16 |
* |
|
17 |
*/ |
|
18 |
||
19 |
||
20 |
||
21 |
||
22 |
||
23 |
||
24 |
||
25 |
||
26 |
||
27 |
||
28 |
||
29 |
||
30 |
// System includes |
|
31 |
#include <e32cmn.h> |
|
32 |
#include <PtiEngine.h> |
|
33 |
#include <PtiDefs.h> |
|
34 |
#include <avkon.rsg> |
|
35 |
#include <aknfep.rsg> |
|
36 |
#include <PtiUserDicEntry.h> |
|
37 |
#include <aknnotewrappers.h> //CAknWarningNote |
|
38 |
// User includes |
|
39 |
#include "AknFepUIManagerStateInterface.h" |
|
40 |
#include "AknFepUICtrlInputPane.h" |
|
41 |
#include "AknFepUICtrlPinyinPopup.h" //Pinyin phrase |
|
42 |
#include "aknfepuictrleditpane.h" //pinyin phrase creation |
|
43 |
#include "AknFepUICtrlCandidatePane.h" |
|
44 |
#include "AknFepManager.h" |
|
45 |
#include "aknfepuiinputminiqwertypinyinphrasebase.h" |
|
46 |
||
47 |
// Constant definition |
|
48 |
const TInt KMaxPhraseCount = 50; |
|
49 |
const TInt KMaxPhraseCreationCount = 7; |
|
50 |
const TInt KMaxSpellLength = 7;//max pinyin length for one chinese Zi |
|
51 |
const TInt KMaxKeystrokeCount = 31; |
|
52 |
const TInt KInvalidToneMark = -1; |
|
53 |
const TUint16 KAutoDLT = 0x002E; |
|
54 |
const TUint16 KManualDLT = 0x0027; |
|
55 |
const TUint16 KPYa = 0x0061; |
|
56 |
const TUint16 KPYb = 0x0062; |
|
57 |
const TUint16 KPYc = 0x0063; |
|
58 |
const TUint16 KPYd = 0x0064; |
|
59 |
const TUint16 KPYe = 0x0065; |
|
60 |
const TUint16 KPYf = 0x0066; |
|
61 |
const TUint16 KPYg = 0x0067; |
|
62 |
const TUint16 KPYh = 0x0068; |
|
63 |
const TUint16 KPYi = 0x0069; |
|
64 |
const TUint16 KPYj = 0x006A; |
|
65 |
const TUint16 KPYk = 0x006B; |
|
66 |
const TUint16 KPYl = 0x006C; |
|
67 |
const TUint16 KPYm = 0x006D; |
|
68 |
const TUint16 KPYn = 0x006E; |
|
69 |
const TUint16 KPYo = 0x006F; |
|
70 |
const TUint16 KPYp = 0x0070; |
|
71 |
const TUint16 KPYq = 0x0071; |
|
72 |
const TUint16 KPYr = 0x0072; |
|
73 |
const TUint16 KPYs = 0x0073; |
|
74 |
const TUint16 KPYt = 0x0074; |
|
75 |
const TUint16 KPYu = 0x0075; |
|
76 |
const TUint16 KPYv = 0x0076; |
|
77 |
const TUint16 KPYw = 0x0077; |
|
78 |
const TUint16 KPYx = 0x0078; |
|
79 |
const TUint16 KPYy = 0x0079; |
|
80 |
const TUint16 KPYz = 0x007A; |
|
81 |
||
82 |
_LIT( KMaxPhraseNote,"\x8BCD\x7EC4\x6700\x957F\x4E3A\x4E03\x5B57" ); |
|
83 |
||
84 |
const TMiniQwertyKeyMap StrokeMap[] = |
|
85 |
{ |
|
86 |
{KPYa, EPtiKeyQwertyA}, |
|
87 |
{KPYb, EPtiKeyQwertyB}, |
|
88 |
{KPYc, EPtiKeyQwertyC}, |
|
89 |
{KPYd, EPtiKeyQwertyD}, |
|
90 |
{KPYe, EPtiKeyQwertyE}, |
|
91 |
{KPYf, EPtiKeyQwertyF}, |
|
92 |
{KPYg, EPtiKeyQwertyG}, |
|
93 |
{KPYh, EPtiKeyQwertyH}, |
|
94 |
{KPYi, EPtiKeyQwertyI}, |
|
95 |
{KPYj, EPtiKeyQwertyJ}, |
|
96 |
{KPYk, EPtiKeyQwertyK}, |
|
97 |
{KPYl, EPtiKeyQwertyL}, |
|
98 |
{KPYm, EPtiKeyQwertyM}, |
|
99 |
{KPYn, EPtiKeyQwertyN}, |
|
100 |
{KPYo, EPtiKeyQwertyO}, |
|
101 |
{KPYp, EPtiKeyQwertyP}, |
|
102 |
{KPYq, EPtiKeyQwertyQ}, |
|
103 |
{KPYr, EPtiKeyQwertyR}, |
|
104 |
{KPYs, EPtiKeyQwertyS}, |
|
105 |
{KPYt, EPtiKeyQwertyT}, |
|
106 |
{KPYu, EPtiKeyQwertyU}, |
|
107 |
{KPYv, EPtiKeyQwertyV}, |
|
108 |
{KPYw, EPtiKeyQwertyW}, |
|
109 |
{KPYx, EPtiKeyQwertyX}, |
|
110 |
{KPYy, EPtiKeyQwertyY}, |
|
111 |
{KPYz, EPtiKeyQwertyZ}, |
|
112 |
{KManualDLT, EPtiKeyQwertySpace} |
|
113 |
}; |
|
114 |
||
115 |
const TMiniQwertyToneMap PinyinToneMap[] = |
|
116 |
{ |
|
117 |
{0x02C9, 1}, |
|
118 |
{0x02CA, 2}, |
|
119 |
{0x02C7, 3}, |
|
120 |
{0x02CB, 4}, |
|
121 |
{0x02D9, 5} |
|
122 |
}; |
|
123 |
||
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
124 |
const TUid KPtiSogouCoreUid = { 0x20031DD6 }; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
125 |
|
44 | 126 |
// --------------------------------------------------------------------------- |
127 |
// TAknFepInputStateStrokePhraseCreationBase::TAknFepInputStateStrokePhraseCreationBase |
|
128 |
// C++ default constructor |
|
129 |
// --------------------------------------------------------------------------- |
|
130 |
// |
|
131 |
TAknFepInputMiniQwertyPinyinPhraseBase::TAknFepInputMiniQwertyPinyinPhraseBase( |
|
132 |
MAknFepUIManagerStateInterface* aOwner, |
|
133 |
MAknFepUICtrlContainerChinese* aUIContainer) : |
|
134 |
TAknFepInputStateCandidateQwertyBaseChinesePhrase(aOwner, aUIContainer) |
|
135 |
{ |
|
136 |
if (iOwner->PtiEngine()->InputMode() != EPtiEnginePinyinPhraseQwerty) |
|
137 |
{ |
|
138 |
iOwner->PtiEngine()->SetInputMode(EPtiEnginePinyinPhraseQwerty); |
|
139 |
} |
|
140 |
iOwner->PtiEngine()->SetCandidatePageLength(KMaxPhraseCount); |
|
141 |
MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
142 |
TBool multiplePages = !(uiContainer->CandidatePane()->IsLastPage() && uiContainer->CandidatePane()->IsFirstPage()); |
|
143 |
uiContainer->ShowVerticalScrollArrows(multiplePages); |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
144 |
|
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
145 |
// If sogou core is in use, set plugin to the state |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
146 |
// machine and enable the plugin. |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
147 |
// Get current core id. It is used to judge whether sogou core is in use. |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
148 |
TInt coreID = 0; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
149 |
TRAP_IGNORE( coreID = iOwner->PtiEngine()->HandleCommandL( EPtiCommandGetCoreID )); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
150 |
if ( TUid::Uid( coreID ) == KPtiSogouCoreUid ) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
151 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
152 |
TAknFepInputMiniQwertySogouPinyinPhrasePlugin plugin( aOwner, aUIContainer, iState ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
153 |
plugin.Enable( ETrue ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
154 |
SetPlugin( plugin ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
155 |
} |
44 | 156 |
} |
157 |
||
158 |
// --------------------------------------------------------------------------- |
|
159 |
// TAknFepInputMiniQwertyPinyinPhraseBase::HandleKeyL |
|
160 |
// Handle system key press event. |
|
161 |
// --------------------------------------------------------------------------- |
|
162 |
// |
|
163 |
TBool TAknFepInputMiniQwertyPinyinPhraseBase::HandleKeyL(TInt aKey, |
|
164 |
TKeyPressLength aLength) |
|
165 |
{ |
|
166 |
// |
|
167 |
switch (aKey) |
|
168 |
{ |
|
169 |
case EKeyLeftShift: |
|
170 |
case EKeyLeftCtrl: |
|
171 |
case EKeyRightCtrl: |
|
172 |
case EStdKeyDevice1:// CBA2 |
|
173 |
{ |
|
174 |
iOwner->FepMan()->TryCloseUiL(); |
|
175 |
break; |
|
176 |
} |
|
177 |
case EKeyRightFunc: |
|
178 |
{ |
|
179 |
iOwner->FepMan()->PlaySound(EAvkonSIDErrorTone); |
|
180 |
break; |
|
181 |
} |
|
182 |
case EStdKeyLeftFunc: //tone mark. |
|
183 |
{ |
|
184 |
HandlToneMarkL(); |
|
185 |
break; |
|
186 |
} |
|
187 |
case EStdKeyBackspace: |
|
188 |
{ |
|
189 |
if (CheckKeyNeedRepeat(aLength) ) |
|
190 |
{ |
|
191 |
HandleKeyBackspaceL(aLength); |
|
192 |
} |
|
193 |
else |
|
194 |
{ |
|
195 |
iOwner->FepMan()->PlaySound(EAvkonSIDErrorTone); |
|
196 |
} |
|
197 |
break; |
|
198 |
} |
|
199 |
case EStdKeyEnter://Enter keypress. |
|
200 |
{ |
|
201 |
HandlEnterKeyL(); |
|
202 |
break; |
|
203 |
} |
|
204 |
case EStdKeyDevice0:// CBA1 |
|
205 |
case EStdKeyDevice3:// CBASelect |
|
206 |
{ |
|
207 |
HandleCommitL(); |
|
208 |
break; |
|
209 |
} |
|
210 |
case EStdKeyUpArrow: |
|
211 |
{ |
|
212 |
iOwner->FepMan()->PlaySound(EAvkonSIDErrorTone); |
|
213 |
break; |
|
214 |
} |
|
215 |
case EStdKeyDownArrow: |
|
216 |
{ |
|
217 |
if (EMiniQwertyEdit == iState) |
|
218 |
{ |
|
219 |
if (CheckFirstGroupStroke() ) |
|
220 |
{ |
|
221 |
iOwner->ChangeState(EEntry); |
|
222 |
} |
|
223 |
} |
|
224 |
else |
|
225 |
{ |
|
226 |
iOwner->FepMan()->PlaySound(EAvkonSIDErrorTone); |
|
227 |
} |
|
228 |
break; |
|
229 |
} |
|
230 |
case EStdKeyLeftArrow: |
|
231 |
{ |
|
232 |
if (EMiniQwertyEdit == iState) |
|
233 |
{ |
|
234 |
UIContainer()->EditPaneWindow()->SetAutoChangeStateFlag( EManualChangeState ); |
|
235 |
MoveCursorLeft(); |
|
236 |
} |
|
237 |
else |
|
238 |
{ |
|
239 |
iOwner->FepMan()->PlaySound(EAvkonSIDErrorTone); |
|
240 |
} |
|
241 |
break; |
|
242 |
} |
|
243 |
case EStdKeyRightArrow: |
|
244 |
{ |
|
245 |
if (EMiniQwertyEdit == iState) |
|
246 |
{ |
|
247 |
UIContainer()->EditPaneWindow()->SetAutoChangeStateFlag( EManualChangeState ); |
|
248 |
MoveCursorRight(); |
|
249 |
} |
|
250 |
else |
|
251 |
{ |
|
252 |
iOwner->FepMan()->PlaySound(EAvkonSIDErrorTone); |
|
253 |
} |
|
254 |
break; |
|
255 |
} |
|
256 |
case EStdKeySpace: |
|
257 |
{ |
|
258 |
if (EShortKeyPress == aLength) |
|
259 |
{ |
|
260 |
HandlSpaceKeyL(); |
|
261 |
break; |
|
262 |
} |
|
263 |
break; |
|
264 |
} |
|
265 |
default: |
|
266 |
{ |
|
267 |
if (CAknFepFnKeyManager::EFnKeyNext == iOwner->FepMan()->FnKeyState() || CAknFepFnKeyManager::EFnKeyLock |
|
268 |
== iOwner->FepMan()->FnKeyState() |
|
269 |
|| ( CAknFepFnKeyManager::EFnKeyDown == iOwner->FepMan()->FnKeyState() && iState != ECandidate )) |
|
270 |
{ |
|
271 |
iOwner->FepMan()->PlaySound(EAvkonSIDErrorTone); |
|
272 |
return ETrue; |
|
273 |
} |
|
274 |
else |
|
275 |
if (iOwner->FepMan()->IsFlagSet(CAknFepManager::EFlagShiftKeyDepressed) |
|
276 |
|| iOwner->FepMan()->IsFlagSet(CAknFepManager::EFlagQwertyChrKeyDepressed)) |
|
277 |
{ |
|
278 |
iOwner->FepMan()->TryCloseUiL(); |
|
279 |
return EFalse; |
|
280 |
} |
|
281 |
else |
|
282 |
if ( (EShortKeyPress == aLength ) |
|
283 |
&& (iOwner->IsValidChineseInputKeyQwerty(aKey) )) |
|
284 |
{ |
|
285 |
if (iState == ECandidate) |
|
286 |
{ |
|
287 |
HandleKeyFromCandidateL(aKey, aLength); |
|
288 |
} |
|
289 |
else |
|
290 |
{ |
|
291 |
HandleDefaultKeyL(aKey); |
|
292 |
} |
|
293 |
} |
|
294 |
else |
|
295 |
{ |
|
296 |
iOwner->FepMan()->PlaySound(EAvkonSIDErrorTone); |
|
297 |
} |
|
298 |
break; |
|
299 |
} |
|
300 |
} |
|
301 |
||
302 |
return ETrue; |
|
303 |
} |
|
304 |
||
305 |
// --------------------------------------------------------------------------- |
|
306 |
// TAknFepInputMiniQwertyPinyinPhraseBase::RefreshUI |
|
307 |
// Update input window. |
|
308 |
// --------------------------------------------------------------------------- |
|
309 |
// |
|
310 |
void TAknFepInputMiniQwertyPinyinPhraseBase::RefreshUI(TBool aRefresh) |
|
311 |
{ |
|
312 |
MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
313 |
// get cursor position |
|
314 |
if (aRefresh) |
|
315 |
{ |
|
316 |
TPoint baseLine; |
|
317 |
TInt height(0); |
|
318 |
TInt ascent(0); |
|
319 |
TRAPD(ret,iOwner->FepMan()->GetScreenCoordinatesL(baseLine,height,ascent)) |
|
320 |
; |
|
321 |
if (ret == KErrNone) |
|
322 |
{ |
|
323 |
uiContainer->SetContainerPosition(baseLine, height); |
|
324 |
} |
|
325 |
} |
|
326 |
if ( (uiContainer->EditPaneWindow()->KeystrokeArray()->Count() > 0 ) || |
|
327 |
(uiContainer->EditPaneWindow()->PhraseArray()->Count() > 0 ) ) |
|
328 |
{ |
|
329 |
ShowInfoOnEEPPane(); |
|
330 |
SetWarningColor(); |
|
331 |
ShowInfoOnCandidatePane(); |
|
332 |
UpdateIndicator(); |
|
333 |
TRAP_IGNORE( ChangeCbaL() ); |
|
334 |
} |
|
335 |
} |
|
336 |
||
337 |
// --------------------------------------------------------------------------- |
|
338 |
// TAknFepInputMiniQwertyPinyinPhraseBase::CheckFirstGroupStroke |
|
339 |
// check the first group stroke of keystroke. |
|
340 |
// --------------------------------------------------------------------------- |
|
341 |
// |
|
342 |
TBool TAknFepInputMiniQwertyPinyinPhraseBase::CheckFirstGroupStroke() |
|
343 |
{ |
|
344 |
CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
345 |
MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
346 |
MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
347 |
CDesCArrayFlat* showKeystroke = editPane->ShowKeystrokeArray(); |
|
348 |
TInt stringBeforeLength = 0; |
|
349 |
TInt stringAfterLength = 0; |
|
350 |
TInt keyCode = 0; |
|
351 |
TInt toneMark = 0; |
|
352 |
if ( 0 == showKeystroke->Count() ) |
|
353 |
{ |
|
354 |
return EFalse; |
|
355 |
} |
|
356 |
||
357 |
if (KInvalidToneMark != ToneMark(showKeystroke->MdcaPoint( 0) ) ) |
|
358 |
{ |
|
359 |
return EFalse; |
|
360 |
} |
|
361 |
||
362 |
ClearPtiEngineKeystroke(); |
|
363 |
for (TInt i = 0; i < showKeystroke->Count(); ++i) |
|
364 |
{ |
|
365 |
if (CheckSpellingDLT(showKeystroke->MdcaPoint(i) ) ) |
|
366 |
{ |
|
367 |
if ( 0 == i) |
|
368 |
{ |
|
369 |
return EFalse; |
|
370 |
} |
|
371 |
else |
|
372 |
{ |
|
373 |
return ETrue; |
|
374 |
} |
|
375 |
} |
|
376 |
toneMark = ToneMark(showKeystroke->MdcaPoint(i) ); |
|
377 |
if (KInvalidToneMark != toneMark) |
|
378 |
{ |
|
379 |
for (TInt j = 0; j < toneMark; ++j) |
|
380 |
{ |
|
381 |
ptiengine->IncrementToneMark(ETrue); |
|
382 |
TPtrC ptr0 = getCurrentLeastDLTSpell(); |
|
383 |
if (ptr0.Length() > 0) |
|
384 |
{ |
|
385 |
if ( 0 |
|
386 |
== ptr0.Mid( ptr0.Length() - 1, 1 ).Compare(showKeystroke->MdcaPoint(i) ) ) |
|
387 |
{ |
|
388 |
return ETrue; |
|
389 |
} |
|
390 |
} |
|
391 |
} |
|
392 |
TPtrC ptr = getCurrentLeastDLTSpell(); |
|
393 |
if ( 0 == ptr.Mid( ptr.Length() - 1, 1 ).Compare(showKeystroke->MdcaPoint(i) ) ) |
|
394 |
{ |
|
395 |
return ETrue; |
|
396 |
} |
|
397 |
else |
|
398 |
{ |
|
399 |
return EFalse; |
|
400 |
} |
|
401 |
} |
|
402 |
GetKeystrokeCode(keyCode, showKeystroke->MdcaPoint(i) ); |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
403 |
|
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
404 |
// dltBeforeCount is the dlt count before append the key. |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
405 |
// dltAfterCount is the dlt count after append the key. |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
406 |
// In sogou core, after appending a new key, the spell length |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
407 |
// may be the same, but the dlt count will change. |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
408 |
// In this situation, the appended key is valid. |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
409 |
TInt dltBeforeCount = 0; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
410 |
TInt dltAfterCount = 0; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
411 |
TPtrC stringBefore = getCurrentLeastDLTSpell(); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
412 |
stringBeforeLength = stringBefore.Length(); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
413 |
for ( TInt k = 0; k < stringBefore.Length(); k++ ) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
414 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
415 |
if ( CheckSpellingDLT( stringBefore.Mid( k ))) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
416 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
417 |
dltBeforeCount++; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
418 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
419 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
420 |
|
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
421 |
// Append the key. |
44 | 422 |
ptiengine->AppendKeyPress((TPtiKey)keyCode).Length(); |
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
423 |
|
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
424 |
// Get the dlt count after appending the key. |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
425 |
TPtrC stringAfter = getCurrentLeastDLTSpell(); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
426 |
stringAfterLength = stringAfter.Length(); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
427 |
for ( TInt l = 0; l < stringAfter.Length(); l++ ) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
428 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
429 |
if ( CheckSpellingDLT( stringAfter.Mid( l ))) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
430 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
431 |
dltAfterCount++; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
432 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
433 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
434 |
|
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
435 |
// If the spell length is the same and the dlt count is |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
436 |
// the same, the keystroke is invalid |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
437 |
if (( stringBeforeLength == stringAfterLength ) && |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
438 |
( dltAfterCount == dltBeforeCount )) |
44 | 439 |
{ |
440 |
return EFalse; |
|
441 |
} |
|
442 |
} |
|
443 |
return ETrue; |
|
444 |
} |
|
445 |
||
446 |
// --------------------------------------------------------------------------- |
|
447 |
// TAknFepInputMiniQwertyPinyinPhraseBase::HandlEnterKey |
|
448 |
// Handle Enter key press |
|
449 |
// --------------------------------------------------------------------------- |
|
450 |
// |
|
451 |
TInt TAknFepInputMiniQwertyPinyinPhraseBase::GetCursorPos() |
|
452 |
{ |
|
453 |
MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
454 |
MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
455 |
CDesCArrayFlat* showKeystroke = editPane->ShowKeystrokeArray(); |
|
456 |
CDesCArrayFlat* keystroke = editPane->KeystrokeArray(); |
|
457 |
TInt phraseCount = editPane->PhraseArray()->Count(); |
|
458 |
TInt index = editPane->GetCursorIndexOfKeystroke(); |
|
459 |
TInt pos = 0; |
|
460 |
TInt count = 0; |
|
461 |
TBuf<1> autoDLT; |
|
462 |
autoDLT.Append(KAutoDLT); |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
463 |
|
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
464 |
// If this method is called in construction of the state machine, |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
465 |
// the plugin is not set. If sogou core is in use now, the phraseCount |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
466 |
// should be the same as the phrase characters count. |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
467 |
// For Sogou core, maybe one element of PhraseArray() contains two or more characters. |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
468 |
TInt coreID = 0; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
469 |
TRAP_IGNORE( coreID = iOwner->PtiEngine()->HandleCommandL( EPtiCommandGetCoreID )); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
470 |
if ( TUid::Uid( coreID ) == KPtiSogouCoreUid ) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
471 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
472 |
CDesCArrayFlat* phraseArray = editPane->PhraseArray(); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
473 |
phraseCount = 0; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
474 |
for ( TInt i = 0; i < phraseArray->Count(); i++ ) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
475 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
476 |
phraseCount += (*phraseArray)[i].Length(); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
477 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
478 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
479 |
|
44 | 480 |
if ( 0 == index) |
481 |
{ |
|
482 |
pos = phraseCount; |
|
483 |
} |
|
484 |
else |
|
485 |
if (keystroke->Count() == index) |
|
486 |
{ |
|
487 |
pos = phraseCount + showKeystroke->Count(); |
|
488 |
} |
|
489 |
else |
|
490 |
{ |
|
491 |
for (TInt i = 0; i < showKeystroke->Count(); ++i) |
|
492 |
{ |
|
493 |
if ( 0 != showKeystroke->MdcaPoint( i ).Compare(autoDLT) ) |
|
494 |
{ |
|
495 |
count = count + 1; |
|
496 |
} |
|
497 |
if (count == index) |
|
498 |
{ |
|
499 |
pos = phraseCount + i + 1; |
|
500 |
break; |
|
501 |
} |
|
502 |
} |
|
503 |
} |
|
504 |
return pos; |
|
505 |
} |
|
506 |
||
507 |
// --------------------------------------------------------------------------- |
|
508 |
// TAknFepInputMiniQwertyPinyinPhraseBase::HandlEnterKeyL |
|
509 |
// Handle Enter key press |
|
510 |
// --------------------------------------------------------------------------- |
|
511 |
// |
|
512 |
void TAknFepInputMiniQwertyPinyinPhraseBase::HandlEnterKeyL() |
|
513 |
{ |
|
514 |
TBuf<KMaxKeystrokeCount> currentText; |
|
515 |
MAknFepUICtrlEditPane* editpane = UIContainer()->EditPaneWindow(); |
|
516 |
CDesCArrayFlat* showkeyStoke = editpane->ShowKeystrokeArray(); |
|
517 |
CDesCArrayFlat* phraseArray = editpane->PhraseArray(); |
|
518 |
TInt phraseCount = phraseArray->Count(); |
|
519 |
TInt keyStrokeCount = showkeyStoke->Count(); |
|
520 |
TInt i = 0; |
|
521 |
TBuf<1> autoDLT; |
|
522 |
autoDLT.Append(KAutoDLT); |
|
523 |
||
524 |
for (i = 0; i < phraseCount; i++) |
|
525 |
{ |
|
526 |
currentText.Append(phraseArray->MdcaPoint(i) ); |
|
527 |
} |
|
528 |
for (i = 0; i < keyStrokeCount; i++) |
|
529 |
{ |
|
530 |
currentText.Append(showkeyStoke->MdcaPoint(i) ); |
|
531 |
} |
|
532 |
||
533 |
while (currentText.Find(autoDLT)> 0) |
|
534 |
{ |
|
535 |
currentText.Replace(currentText.Find(autoDLT), 1, KNullDesC); |
|
536 |
} |
|
537 |
||
538 |
if (currentText.Length() ) |
|
539 |
{ |
|
540 |
MAknFepManagerUIInterface* fepMan = iOwner->FepMan(); |
|
541 |
fepMan->NewTextL(currentText); |
|
542 |
fepMan->CommitInlineEditL(); |
|
543 |
if (keyStrokeCount == 0 && currentText.Length() > 1) |
|
544 |
{ |
|
545 |
AddPhraseToDB(currentText); |
|
546 |
} |
|
547 |
||
548 |
UIContainer()->EditPaneWindow()->ResetAllArray(); |
|
549 |
UIContainer()->EditPaneWindow()->SetPhraseCreationFlag(EFalse); |
|
550 |
||
551 |
if (fepMan->IsFlagSet(CAknFepManager::EFlagEditorFull)) |
|
552 |
{ |
|
553 |
fepMan->ClearFlag(CAknFepManager::EFlagEditorFull); |
|
554 |
iOwner->FepMan()->TryCloseUiL(); |
|
555 |
} |
|
556 |
else |
|
557 |
{ |
|
558 |
iOwner->FepMan()->TryCloseUiL(); |
|
559 |
} |
|
560 |
} |
|
561 |
} |
|
562 |
||
563 |
// --------------------------------------------------------------------------- |
|
564 |
// TAknFepInputMiniQwertyPinyinPhraseBase::HandlToneMarkL |
|
565 |
// Handle tone mark key press. |
|
566 |
// --------------------------------------------------------------------------- |
|
567 |
// |
|
568 |
void TAknFepInputMiniQwertyPinyinPhraseBase::HandlSpaceKeyL() |
|
569 |
{ |
|
570 |
MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
571 |
MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
572 |
CDesCArrayFlat* keystrokeArray = editPane->KeystrokeArray(); |
|
573 |
TInt phraseCount = editPane->PhraseArray()->Count(); |
|
574 |
TInt showKeystrokeCount = editPane->ShowKeystrokeArray()->Count(); |
|
575 |
TInt index = editPane->GetCursorIndexOfKeystroke(); |
|
576 |
TBuf<1> manualDLT; |
|
577 |
TBuf<1> autoDLT; |
|
578 |
manualDLT.Append( KManualDLT ); |
|
579 |
autoDLT.Append( KAutoDLT ); |
|
580 |
||
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
581 |
// Get the current core id |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
582 |
TInt coreID = 0; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
583 |
TRAP_IGNORE( coreID = iOwner->PtiEngine()->HandleCommandL( EPtiCommandGetCoreID )); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
584 |
|
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
585 |
if ( TUid::Uid( coreID ) == KPtiSogouCoreUid ) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
586 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
587 |
CDesCArrayFlat* phrase = editPane->PhraseArray(); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
588 |
phraseCount = 0; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
589 |
for ( TInt j = 0; j < phrase->Count(); j++ ) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
590 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
591 |
phraseCount += phrase->MdcaPoint(j).Length();; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
592 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
593 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
594 |
|
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
595 |
if ( phraseCount + showKeystrokeCount >= KMaxKeystrokeCount ) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
596 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
597 |
iOwner->FepMan()->PlaySound(EAvkonSIDErrorTone); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
598 |
return; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
599 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
600 |
|
44 | 601 |
TBool firstGroup = CheckFirstGroupStroke(); |
602 |
||
603 |
keystrokeArray->InsertL(index, manualDLT); |
|
604 |
editPane->SetCursorIndexOfKeystroke(index + 1); |
|
605 |
AnalyseL(); |
|
606 |
||
607 |
if ( editPane->ShowKeystrokeArray()->Count() > KMaxKeystrokeCount ) |
|
608 |
{ |
|
609 |
keystrokeArray->Delete( index ); |
|
610 |
editPane->SetCursorIndexOfKeystroke( index ); |
|
611 |
iOwner->FepMan()->PlaySound(EAvkonSIDErrorTone); |
|
612 |
AnalyseL(); |
|
613 |
return; |
|
614 |
} |
|
615 |
||
616 |
//Auto change from EMiniQwertyEdit state to EEntry state. |
|
617 |
if (EMiniQwertyEdit == iState) |
|
618 |
{ |
|
619 |
if ( ( !firstGroup ) && CheckFirstGroupStroke() ) |
|
620 |
{ |
|
621 |
if ( EAutoChangeStateFromCandidate == editPane->GetAutoChangeStateFlag() ) |
|
622 |
{ |
|
623 |
RefreshUI(); |
|
624 |
editPane->SetChangeState(ETrue); |
|
625 |
iOwner->ChangeState(ECandidate); |
|
626 |
} |
|
627 |
else if ( EAutoChangeStateFromInput == editPane->GetAutoChangeStateFlag() ) |
|
628 |
{ |
|
629 |
editPane->SetChangeState(ETrue); |
|
630 |
iOwner->ChangeState(EEntry); |
|
631 |
} |
|
632 |
else |
|
633 |
{ |
|
634 |
RefreshUI(); |
|
635 |
} |
|
636 |
return; |
|
637 |
} |
|
638 |
} |
|
639 |
||
640 |
//Auto change from EEntry state to EMiniQwertyEdit state. |
|
641 |
if (EEntry == iState) |
|
642 |
{ |
|
643 |
if ( !CheckFirstGroupStroke() ) |
|
644 |
{ |
|
645 |
editPane->SetAutoChangeStateFlag(EAutoChangeStateFromInput); |
|
646 |
editPane->SetChangeState(ETrue); |
|
647 |
iOwner->ChangeState(EMiniQwertyEdit); |
|
648 |
return; |
|
649 |
} |
|
650 |
} |
|
651 |
||
652 |
RefreshUI(); |
|
653 |
} |
|
654 |
||
655 |
// --------------------------------------------------------------------------- |
|
656 |
// TAknFepInputMiniQwertyPinyinPhraseBase::HandlToneMarkL |
|
657 |
// Handle tone mark key press. |
|
658 |
// --------------------------------------------------------------------------- |
|
659 |
// |
|
660 |
void TAknFepInputMiniQwertyPinyinPhraseBase::HandlToneMarkL() |
|
661 |
{ |
|
662 |
MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
663 |
MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
664 |
TBool firstGroup = CheckFirstGroupStroke(); |
|
665 |
AddToneMarkL(); |
|
666 |
AnalyseL(); |
|
667 |
//Auto change from EMiniQwertyEdit state to EEntry state. |
|
668 |
if (EMiniQwertyEdit == iState) |
|
669 |
{ |
|
670 |
if ( ( !firstGroup ) && CheckFirstGroupStroke() ) |
|
671 |
{ |
|
672 |
if ( EAutoChangeStateFromCandidate == editPane->GetAutoChangeStateFlag() ) |
|
673 |
{ |
|
674 |
RefreshUI(); |
|
675 |
editPane->SetChangeState(ETrue); |
|
676 |
iOwner->ChangeState(ECandidate); |
|
677 |
} |
|
678 |
else if ( EAutoChangeStateFromInput == editPane->GetAutoChangeStateFlag() ) |
|
679 |
{ |
|
680 |
editPane->SetChangeState(ETrue); |
|
681 |
iOwner->ChangeState(EEntry); |
|
682 |
} |
|
683 |
else |
|
684 |
{ |
|
685 |
RefreshUI(); |
|
686 |
} |
|
687 |
return; |
|
688 |
} |
|
689 |
} |
|
690 |
||
691 |
//Auto change from EEntry state to EMiniQwertyEdit state. |
|
692 |
if (EEntry == iState) |
|
693 |
{ |
|
694 |
if ( !CheckFirstGroupStroke() ) |
|
695 |
{ |
|
696 |
editPane->SetAutoChangeStateFlag(EAutoChangeStateFromInput); |
|
697 |
editPane->SetChangeState(ETrue); |
|
698 |
iOwner->ChangeState(EMiniQwertyEdit); |
|
699 |
return; |
|
700 |
} |
|
701 |
} |
|
702 |
RefreshUI(); |
|
703 |
} |
|
704 |
||
705 |
// --------------------------------------------------------------------------- |
|
706 |
// TAknFepInputMiniQwertyPinyinPhraseBase::CheckManualDelimiter |
|
707 |
// Check the delimiter that wether is manual delimiter. |
|
708 |
// --------------------------------------------------------------------------- |
|
709 |
// |
|
710 |
TBool TAknFepInputMiniQwertyPinyinPhraseBase::CheckManualDelimiter( |
|
711 |
const TInt aCount, const TDesC& aKeystroke) |
|
712 |
{ |
|
713 |
TInt keyCount = 0; |
|
714 |
for (TInt i = 0; i < aKeystroke.Length(); ++i) |
|
715 |
{ |
|
716 |
if (KManualDLT != aKeystroke[i]) |
|
717 |
{ |
|
718 |
keyCount = keyCount + 1; |
|
719 |
} |
|
720 |
if (aCount == keyCount) |
|
721 |
{ |
|
722 |
break; |
|
723 |
} |
|
724 |
} |
|
725 |
||
726 |
if (keyCount != aCount) |
|
727 |
{ |
|
728 |
return EFalse; |
|
729 |
} |
|
730 |
||
731 |
if (aKeystroke.Length() == keyCount) |
|
732 |
{ |
|
733 |
return EFalse; |
|
734 |
} |
|
735 |
||
736 |
if (KManualDLT != aKeystroke[keyCount]) |
|
737 |
{ |
|
738 |
return EFalse; |
|
739 |
} |
|
740 |
||
741 |
return ETrue; |
|
742 |
} |
|
743 |
||
744 |
// --------------------------------------------------------------------------- |
|
745 |
// TAknFepInputMiniQwertyPinyinPhraseBase::AnalyseSpellingL |
|
746 |
// Analyse Pinyin spelling. |
|
747 |
// --------------------------------------------------------------------------- |
|
748 |
// |
|
749 |
void TAknFepInputMiniQwertyPinyinPhraseBase::AnalyseSpellingL( |
|
750 |
const TDesC& aKeystroke, const TDesC& aSpelling, |
|
751 |
CDesCArrayFlat* aShowKeystroke) |
|
752 |
{ |
|
753 |
TInt count = 0; |
|
754 |
TBuf<1> manualDLT; |
|
755 |
TBuf<1> autoDLT; |
|
756 |
manualDLT.Append(KManualDLT); |
|
757 |
autoDLT.Append(KAutoDLT); |
|
758 |
||
759 |
if ( 0 == aSpelling.Compare(aKeystroke) ) |
|
760 |
{ |
|
761 |
for (TInt i = 0; i < aKeystroke.Length(); ++i) |
|
762 |
{ |
|
763 |
aShowKeystroke->AppendL(aKeystroke.Mid(i, 1) ); |
|
764 |
} |
|
765 |
return; |
|
766 |
} |
|
767 |
||
768 |
for (TInt i = 0; i < aSpelling.Length(); ++i) |
|
769 |
{ |
|
770 |
if (KManualDLT == aSpelling[i]) |
|
771 |
{ |
|
772 |
//Manual delimiter |
|
773 |
if (CheckManualDelimiter(count, aKeystroke) ) |
|
774 |
{ |
|
775 |
aShowKeystroke->AppendL(manualDLT); |
|
776 |
} |
|
777 |
else |
|
778 |
{ |
|
779 |
aShowKeystroke->AppendL(autoDLT); |
|
780 |
} |
|
781 |
} |
|
782 |
else |
|
783 |
{ |
|
784 |
aShowKeystroke->AppendL(aSpelling.Mid(i, 1) ); |
|
785 |
count = count + 1; |
|
786 |
} |
|
787 |
} |
|
788 |
} |
|
789 |
||
790 |
// --------------------------------------------------------------------------- |
|
791 |
// TAknFepInputMiniQwertyPinyinPhraseBase::AnalyseSpellingAddToneMarkL |
|
792 |
// Analyse spelling after user press tone mark. |
|
793 |
// --------------------------------------------------------------------------- |
|
794 |
// |
|
795 |
void TAknFepInputMiniQwertyPinyinPhraseBase::AnalyseSpellingAddToneMarkL( |
|
796 |
TInt aI, |
|
797 |
TInt aToneMarkCount, |
|
798 |
CDesCArrayFlat* aKeystroke, |
|
799 |
CDesCArrayFlat* aShowKeystroke ) |
|
800 |
{ |
|
801 |
TBuf<1> atuoDLT; |
|
802 |
TBuf<1> manualDLT; |
|
803 |
atuoDLT.Append(KAutoDLT); |
|
804 |
manualDLT.Append(KManualDLT); |
|
805 |
if ( CheckSpellingDLT( aKeystroke->MdcaPoint( aI - 1 ) ) || |
|
806 |
( KInvalidToneMark != ToneMark( aKeystroke->MdcaPoint( aI - 1 ) ) ) ) |
|
807 |
{ |
|
808 |
aShowKeystroke->AppendL( aKeystroke->MdcaPoint( aI ) ); |
|
809 |
} |
|
810 |
else |
|
811 |
{ |
|
812 |
if ( CheckSpellingAddToneMarkToPTIL( aToneMarkCount ) ) |
|
813 |
{ |
|
814 |
aShowKeystroke->AppendL( aKeystroke->MdcaPoint( aI - 1 ) ); |
|
815 |
aShowKeystroke->AppendL( aKeystroke->MdcaPoint( aI ) ); |
|
816 |
} |
|
817 |
else |
|
818 |
{ |
|
819 |
if ( aShowKeystroke->Count() == 0 ) |
|
820 |
{ |
|
821 |
aShowKeystroke->AppendL( aKeystroke->MdcaPoint( aI - 1 ) ); |
|
822 |
aShowKeystroke->AppendL( aKeystroke->MdcaPoint( aI ) ); |
|
823 |
} |
|
824 |
else |
|
825 |
{ |
|
826 |
if ( ( !CheckSpellingDLT(aShowKeystroke->MdcaPoint( |
|
827 |
aShowKeystroke->Count() - 1 ) ) ) && |
|
828 |
( KInvalidToneMark == ToneMark( aShowKeystroke-> |
|
829 |
MdcaPoint( aShowKeystroke->Count() - 1 ) ) ) ) |
|
830 |
{ |
|
831 |
aShowKeystroke->AppendL( atuoDLT ); |
|
832 |
} |
|
833 |
aShowKeystroke->AppendL( aKeystroke->MdcaPoint( aI - 1 ) ); |
|
834 |
aShowKeystroke->AppendL( aKeystroke->MdcaPoint( aI ) ); |
|
835 |
} |
|
836 |
} |
|
837 |
} |
|
838 |
} |
|
839 |
||
840 |
// --------------------------------------------------------------------------- |
|
841 |
// TAknFepInputMiniQwertyPinyinPhraseBase::AnalyseSpellingAddKeyL |
|
842 |
// Analyse spelling after user press key that is not tone mark. |
|
843 |
// --------------------------------------------------------------------------- |
|
844 |
// |
|
845 |
void TAknFepInputMiniQwertyPinyinPhraseBase::AnalyseSpellingAddKeyL( |
|
846 |
TInt& aI, |
|
847 |
TInt aDelimterPos, |
|
848 |
CDesCArrayFlat* aKeystroke, |
|
849 |
CDesCArrayFlat* aShowKeystroke ) |
|
850 |
{ |
|
851 |
CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
852 |
TBuf<1> atuoDLT; |
|
853 |
TBuf<1> manualDLT; |
|
854 |
atuoDLT.Append(KAutoDLT); |
|
855 |
manualDLT.Append(KManualDLT); |
|
856 |
if ( 0 == aI ) |
|
857 |
{ |
|
858 |
if ( aI + 1 < aKeystroke->Count() ) |
|
859 |
{ |
|
860 |
if ( ( KInvalidToneMark != ToneMark( aKeystroke->MdcaPoint( aI + 1 ) ) ) || |
|
861 |
( CheckSpellingDLT( aKeystroke->MdcaPoint( aI + 1 ) ) ) ) |
|
862 |
{ |
|
863 |
aShowKeystroke->AppendL( aKeystroke->MdcaPoint( aI ) ); |
|
864 |
aShowKeystroke->AppendL( aKeystroke->MdcaPoint( aI + 1 ) ); |
|
865 |
aI = aI + 1; |
|
866 |
} |
|
867 |
else |
|
868 |
{ |
|
869 |
aShowKeystroke->AppendL( aKeystroke->MdcaPoint( aI ) ); |
|
870 |
aShowKeystroke->AppendL( atuoDLT ); |
|
871 |
} |
|
872 |
} |
|
873 |
else |
|
874 |
{ |
|
875 |
aShowKeystroke->AppendL( aKeystroke->MdcaPoint( aI ) ); |
|
876 |
} |
|
877 |
} |
|
878 |
else if ( aI + 1 == aKeystroke->Count() ) |
|
879 |
{ |
|
880 |
if ( ( 1 == aDelimterPos ) || ( -1 == aDelimterPos ) ) |
|
881 |
{ |
|
882 |
if ( ( !CheckSpellingDLT( aShowKeystroke-> |
|
883 |
MdcaPoint( aShowKeystroke->Count() - 1 ) ) && |
|
884 |
( KInvalidToneMark == ToneMark( aShowKeystroke-> |
|
885 |
MdcaPoint( aShowKeystroke->Count() - 1 ) ) ) ) ) |
|
886 |
{ |
|
887 |
aShowKeystroke->AppendL( atuoDLT ); |
|
888 |
} |
|
889 |
aShowKeystroke->AppendL( aKeystroke->MdcaPoint( aI ) ); |
|
890 |
} |
|
891 |
else |
|
892 |
{ |
|
893 |
for ( TInt ii = 0; ii < aDelimterPos - 1; ++ii ) |
|
894 |
{ |
|
895 |
aShowKeystroke->Delete( aShowKeystroke->Count() - 1 ); |
|
896 |
} |
|
897 |
if ( ( !CheckSpellingDLT( aShowKeystroke-> |
|
898 |
MdcaPoint( aShowKeystroke->Count() - 1 ) ) ) && |
|
899 |
( KInvalidToneMark == ToneMark( aShowKeystroke->MdcaPoint( |
|
900 |
aShowKeystroke->Count() - 1 ) ) ) ) |
|
901 |
{ |
|
902 |
aShowKeystroke->AppendL( atuoDLT ); |
|
903 |
} |
|
904 |
aI = aI - aDelimterPos; |
|
905 |
} |
|
906 |
} |
|
907 |
else |
|
908 |
{ |
|
909 |
if ( -1 == aDelimterPos ) |
|
910 |
{ |
|
911 |
if ( ( !CheckSpellingDLT( aShowKeystroke->MdcaPoint( |
|
912 |
aShowKeystroke->Count() - 1 ) ) ) && |
|
913 |
( KInvalidToneMark == ToneMark( aShowKeystroke->MdcaPoint( |
|
914 |
aShowKeystroke->Count() - 1 ) ) ) ) |
|
915 |
{ |
|
916 |
aShowKeystroke->AppendL( atuoDLT ); |
|
917 |
} |
|
918 |
if ( 0 == getCurrentLeastDLTSpell().Length() ) |
|
919 |
{ |
|
920 |
aShowKeystroke->AppendL( aKeystroke->MdcaPoint( aI ) ); |
|
921 |
if ( KInvalidToneMark != ToneMark( aKeystroke->MdcaPoint( aI + 1 ) ) ) |
|
922 |
{ |
|
923 |
aShowKeystroke->AppendL( aKeystroke->MdcaPoint( aI + 1 ) ); |
|
924 |
aI = aI + 1; |
|
925 |
} |
|
926 |
} |
|
927 |
else |
|
928 |
{ |
|
929 |
aI = aI - 1; |
|
930 |
} |
|
931 |
} |
|
932 |
else |
|
933 |
{ |
|
934 |
for ( TInt ii = 0; ii < aDelimterPos - 1; ++ii ) |
|
935 |
{ |
|
936 |
aShowKeystroke->Delete( aShowKeystroke->Count() - 1 ); |
|
937 |
} |
|
938 |
if ( ( !CheckSpellingDLT( aShowKeystroke->MdcaPoint( |
|
939 |
aShowKeystroke->Count() - 1 ) ) ) && |
|
940 |
( KInvalidToneMark == ToneMark( aShowKeystroke->MdcaPoint( |
|
941 |
aShowKeystroke->Count() - 1 ) ) ) ) |
|
942 |
{ |
|
943 |
aShowKeystroke->AppendL( atuoDLT ); |
|
944 |
} |
|
945 |
aI = aI - aDelimterPos; |
|
946 |
} |
|
947 |
} |
|
948 |
} |
|
949 |
||
950 |
// --------------------------------------------------------------------------- |
|
951 |
// TAknFepInputMiniQwertyPinyinPhraseBase::AnalyseL |
|
952 |
// Analyse key storke. |
|
953 |
// --------------------------------------------------------------------------- |
|
954 |
// |
|
955 |
void TAknFepInputMiniQwertyPinyinPhraseBase::AnalyseL() |
|
956 |
{ |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
957 |
// If sogou core is actived, use the plugin. |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
958 |
if ( iPlugin.IsEnable()) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
959 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
960 |
iPlugin.AnalyseL(); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
961 |
return; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
962 |
} |
44 | 963 |
CPtiEngine* ptiengine = iOwner->PtiEngine(); |
964 |
MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
965 |
MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
966 |
//user pressed keystroke sequence |
|
967 |
CDesCArrayFlat* keystroke = editPane->KeystrokeArray(); |
|
968 |
//stroke to be shown |
|
969 |
CDesCArrayFlat* showKeystroke = editPane->ShowKeystrokeArray(); |
|
970 |
TInt start = 0; |
|
971 |
TInt toneMarkCount = KInvalidToneMark; |
|
972 |
TInt delimiterPosition = 0; |
|
973 |
showKeystroke->Reset(); |
|
974 |
TBuf<1> atuoDLT; |
|
975 |
TBuf<1> manualDLT; |
|
976 |
atuoDLT.Append(KAutoDLT); |
|
977 |
manualDLT.Append(KManualDLT); |
|
978 |
TBuf<KMaxKeystrokeCount> keyTmp; |
|
979 |
||
980 |
if ( keystroke->Count() == 0 ) |
|
981 |
{ |
|
982 |
return; |
|
983 |
} |
|
984 |
||
985 |
//if the first keystroke is delimiter or ToneMark, analyse frome the next one |
|
986 |
if ( CheckSpellingDLT( keystroke->MdcaPoint( 0 ) ) || |
|
987 |
( KInvalidToneMark != ToneMark( keystroke->MdcaPoint( 0 ) ) ) ) |
|
988 |
{ |
|
989 |
showKeystroke->AppendL(keystroke->MdcaPoint( 0 ) ); |
|
990 |
start = 1; |
|
991 |
} |
|
992 |
||
993 |
ClearPtiEngineKeystroke(); |
|
994 |
||
995 |
for ( TInt i = start; i < keystroke->Count(); ++i ) |
|
996 |
{ |
|
997 |
toneMarkCount = ToneMark( keystroke->MdcaPoint( i ) ); |
|
998 |
// current keystroke is delimiter |
|
999 |
if ( CheckSpellingDLT( keystroke->MdcaPoint( i ) ) ) |
|
1000 |
{ |
|
1001 |
showKeystroke->AppendL(keystroke->MdcaPoint( i ) ); |
|
1002 |
ClearPtiEngineKeystroke(); |
|
1003 |
} |
|
1004 |
// current keystroke is tone mark |
|
1005 |
else if ( KInvalidToneMark != toneMarkCount ) |
|
1006 |
{ |
|
1007 |
AnalyseSpellingAddToneMarkL( i, toneMarkCount, keystroke, showKeystroke ); |
|
1008 |
ClearPtiEngineKeystroke(); |
|
1009 |
} |
|
1010 |
// current keystroke is A - Z |
|
1011 |
else |
|
1012 |
{ |
|
1013 |
delimiterPosition = CheckSpellingAddKeyToPTIL( keystroke->MdcaPoint( i ) ); |
|
1014 |
if ( 0 == delimiterPosition ) |
|
1015 |
{ |
|
1016 |
if ( ( 0 != i ) && |
|
1017 |
( 1 == this->getCurrentLeastDLTSpell().Length() ) ) |
|
1018 |
{ |
|
1019 |
if ( ( !CheckSpellingDLT( showKeystroke-> |
|
1020 |
MdcaPoint( showKeystroke->Count() - 1 ) ) ) && |
|
1021 |
( KInvalidToneMark == ToneMark( showKeystroke-> |
|
1022 |
MdcaPoint( showKeystroke->Count() - 1 ) ) ) ) |
|
1023 |
{ |
|
1024 |
showKeystroke->AppendL( atuoDLT ); |
|
1025 |
} |
|
1026 |
} |
|
1027 |
if ( i + 1 < keystroke->Count() ) |
|
1028 |
{ |
|
1029 |
if ( KInvalidToneMark == ToneMark( keystroke->MdcaPoint( i + 1 ) ) ) |
|
1030 |
{ |
|
1031 |
showKeystroke->AppendL( keystroke->MdcaPoint( i ) ); |
|
1032 |
} |
|
1033 |
} |
|
1034 |
else |
|
1035 |
{ |
|
1036 |
showKeystroke->AppendL( keystroke->MdcaPoint( i ) ); |
|
1037 |
} |
|
1038 |
} |
|
1039 |
else |
|
1040 |
{ |
|
1041 |
AnalyseSpellingAddKeyL( i, delimiterPosition, keystroke, showKeystroke ); |
|
1042 |
ClearPtiEngineKeystroke(); |
|
1043 |
} |
|
1044 |
} |
|
1045 |
} |
|
1046 |
} |
|
1047 |
||
1048 |
// --------------------------------------------------------------------------- |
|
1049 |
// TAknFepInputMiniQwertyPinyinPhraseBase::HandleCommitL |
|
1050 |
// Handle CBA1 or select event. |
|
1051 |
// --------------------------------------------------------------------------- |
|
1052 |
// |
|
1053 |
void TAknFepInputMiniQwertyPinyinPhraseBase::HandleCommitL() |
|
1054 |
{ |
|
1055 |
MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
1056 |
MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
1057 |
TInt keyCount = editPane->KeystrokeArray()->Count(); |
|
1058 |
TInt showKeyCount = editPane->ShowKeystrokeArray()->Count(); |
|
1059 |
CDesCArrayFlat* phrase = editPane->PhraseArray(); |
|
1060 |
TInt cdtCount = uiContainer->CandidatePane()->CandidateArray()->Count(); |
|
1061 |
MAknFepManagerUIInterface* fepMan = iOwner->FepMan(); |
|
1062 |
||
1063 |
if (EMiniQwertyEdit == iState) |
|
1064 |
{ |
|
1065 |
if ( ( showKeyCount > 0 ) && (cdtCount > 0 ) ) |
|
1066 |
{ |
|
1067 |
UIContainer()->EditPaneWindow()->SetChangeState(ETrue); |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1068 |
iOwner->ChangeState(EEntry); |
44 | 1069 |
return; |
1070 |
} |
|
1071 |
||
1072 |
if ( keyCount > 0 ) |
|
1073 |
{ |
|
1074 |
iOwner->FepMan()->PlaySound(EAvkonSIDErrorTone); |
|
1075 |
return; |
|
1076 |
} |
|
1077 |
} |
|
1078 |
||
1079 |
if ( ( 0 == keyCount ) && (phrase->Count() <= 1 ) ) |
|
1080 |
{ |
|
1081 |
iOwner->FepMan()->PlaySound(EAvkonSIDErrorTone); |
|
1082 |
return; |
|
1083 |
} |
|
1084 |
||
1085 |
if ( ( 0 == keyCount ) && (phrase->Count() > 1 ) ) |
|
1086 |
{ |
|
1087 |
TBuf<KMaxPhraseCreationCount> phraseCreated; |
|
1088 |
for (TInt i = 0; ( (i < phrase->Count() ) && (i |
|
1089 |
< KMaxPhraseCreationCount ) ); ++i ) |
|
1090 |
{ |
|
1091 |
phraseCreated.Append(phrase->MdcaPoint( i ) ); |
|
1092 |
AddPhraseToDB(phraseCreated); |
|
1093 |
} |
|
1094 |
fepMan->NewTextL(phraseCreated); |
|
1095 |
fepMan->CommitInlineEditL(); |
|
1096 |
if ( !UIContainer()->EditPaneWindow()->GetPhraseCreationFlag() ) |
|
1097 |
{ |
|
1098 |
UIContainer()->EditPaneWindow()->SetPhraseCreationFlag(EFalse); |
|
1099 |
iOwner->PtiEngine()->SetPredictiveChineseChar(phraseCreated); |
|
1100 |
#ifdef RD_INTELLIGENT_TEXT_INPUT |
|
1101 |
UIContainer()->EditPaneWindow()->SetChangeState(ETrue); |
|
1102 |
if (EPtiKeyboardQwerty4x10 == iOwner->FepMan()->KeyboardLayout() || |
|
1103 |
EPtiKeyboardQwerty3x11 == iOwner->FepMan()->KeyboardLayout() ) |
|
1104 |
{ |
|
1105 |
iOwner->ChangeState(EPredictiveCandidate); |
|
1106 |
} |
|
1107 |
#endif |
|
1108 |
} |
|
1109 |
else |
|
1110 |
{ |
|
1111 |
UIContainer()->EditPaneWindow()->SetPhraseCreationFlag(EFalse); |
|
1112 |
iOwner->FepMan()->TryCloseUiL(); |
|
1113 |
} |
|
1114 |
return; |
|
1115 |
} |
|
1116 |
||
1117 |
TPtrC text = UIContainer()->CandidatePane()->CurrentPhraseCandidate(); |
|
1118 |
if (text.Length() == 0) |
|
1119 |
{ |
|
1120 |
return; |
|
1121 |
} |
|
1122 |
||
1123 |
if ( !CommitInlineEEPL(text) ) |
|
1124 |
{ |
|
1125 |
DoActionAfterCommit(); |
|
1126 |
} |
|
1127 |
else |
|
1128 |
{ |
|
1129 |
if ( !CheckFirstGroupStroke() ) |
|
1130 |
{ |
|
1131 |
if ( iState == EEntry ) |
|
1132 |
{ |
|
1133 |
editPane->SetAutoChangeStateFlag(EAutoChangeStateFromInput); |
|
1134 |
} |
|
1135 |
else |
|
1136 |
{ |
|
1137 |
editPane->SetAutoChangeStateFlag(EAutoChangeStateFromCandidate); |
|
1138 |
} |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1139 |
//stroke to be shown |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1140 |
if ( iPlugin.IsEnable()) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1141 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1142 |
iPlugin.AnalyseL(); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1143 |
} |
44 | 1144 |
iOwner->ChangeState(EMiniQwertyEdit); |
1145 |
return; |
|
1146 |
} |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1147 |
|
44 | 1148 |
AnalyseL(); |
1149 |
RefreshUI(); |
|
1150 |
} |
|
1151 |
} |
|
1152 |
||
1153 |
// --------------------------------------------------------------------------- |
|
1154 |
// TAknFepInputMiniQwertyPinyinPhraseBase::HandleKeyBackspaceL |
|
1155 |
// Handle KeyBackspace event. |
|
1156 |
// --------------------------------------------------------------------------- |
|
1157 |
// |
|
1158 |
void TAknFepInputMiniQwertyPinyinPhraseBase::HandleKeyBackspaceL( |
|
1159 |
TKeyPressLength aLength) |
|
1160 |
{ |
|
1161 |
MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
1162 |
MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
1163 |
TInt index = editPane->GetCursorIndexOfKeystroke(); |
|
1164 |
CDesCArrayFlat* keystroke = editPane->KeystrokeArray(); |
|
1165 |
TInt phraseCount = editPane->PhraseArray()->Count(); |
|
1166 |
TBool firstGroup = CheckFirstGroupStroke(); |
|
1167 |
||
1168 |
if ( ( 0 == index ) && (phraseCount != 0 ) ) |
|
1169 |
{ |
|
1170 |
RevertPhraseToKeystrokeL(); |
|
1171 |
} |
|
1172 |
else |
|
1173 |
if ( ( 0 == index ) && (keystroke->Count() > 0 ) ) |
|
1174 |
{ |
|
1175 |
iOwner->FepMan()->PlaySound(EAvkonSIDErrorTone); |
|
1176 |
} |
|
1177 |
else |
|
1178 |
{ |
|
1179 |
if ( !DeleteKeystrokeL() ) |
|
1180 |
{ |
|
1181 |
iOwner->FepMan()->PlaySound(EAvkonSIDErrorTone); |
|
1182 |
} |
|
1183 |
} |
|
1184 |
||
1185 |
//if the keystroke is null and phrase is null then close input window. |
|
1186 |
if ( ( 0 == phraseCount ) && (keystroke->Count() == 0 )) |
|
1187 |
{ |
|
1188 |
iOwner->FepMan()->TryCloseUiL(); //no more keys, close the UI. |
|
1189 |
if (aLength == ELongKeyPress) |
|
1190 |
{ |
|
1191 |
iOwner->FepMan()->SetLongClearAfterCloseUI(ETrue); |
|
1192 |
} |
|
1193 |
return; |
|
1194 |
} |
|
1195 |
||
1196 |
AnalyseL(); |
|
1197 |
//Auto change from EMiniQwertyEdit state to EEntry state. |
|
1198 |
if (EMiniQwertyEdit == iState) |
|
1199 |
{ |
|
1200 |
if ( ( !firstGroup ) && CheckFirstGroupStroke() ) |
|
1201 |
{ |
|
1202 |
if ( EAutoChangeStateFromCandidate == editPane->GetAutoChangeStateFlag() ) |
|
1203 |
{ |
|
1204 |
RefreshUI(); |
|
1205 |
editPane->SetChangeState(ETrue); |
|
1206 |
iOwner->ChangeState(ECandidate); |
|
1207 |
} |
|
1208 |
else if ( EAutoChangeStateFromInput == editPane->GetAutoChangeStateFlag() ) |
|
1209 |
{ |
|
1210 |
editPane->SetChangeState(ETrue); |
|
1211 |
iOwner->ChangeState(EEntry); |
|
1212 |
} |
|
1213 |
else |
|
1214 |
{ |
|
1215 |
RefreshUI(); |
|
1216 |
} |
|
1217 |
return; |
|
1218 |
} |
|
1219 |
} |
|
1220 |
||
1221 |
//Auto change from EEntry state to EMiniQwertyEdit state. |
|
1222 |
if (EEntry == iState) |
|
1223 |
{ |
|
1224 |
if ( (firstGroup ) && ( !CheckFirstGroupStroke() )) |
|
1225 |
{ |
|
1226 |
editPane->SetChangeState(EFalse); |
|
1227 |
editPane->SetAutoChangeStateFlag(EAutoChangeStateFromInput); |
|
1228 |
iOwner->ChangeState(EMiniQwertyEdit); |
|
1229 |
return; |
|
1230 |
} |
|
1231 |
} |
|
1232 |
||
1233 |
RefreshUI(); |
|
1234 |
} |
|
1235 |
||
1236 |
// --------------------------------------------------------------------------- |
|
1237 |
// TAknFepInputMiniQwertyPinyinPhraseBase::HandleDefaultKeyL |
|
1238 |
// Handle default key press event. |
|
1239 |
// --------------------------------------------------------------------------- |
|
1240 |
// |
|
1241 |
void TAknFepInputMiniQwertyPinyinPhraseBase::HandleDefaultKeyL(TInt aKey) |
|
1242 |
{ |
|
1243 |
MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
1244 |
MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
1245 |
TBool firstGroup = CheckFirstGroupStroke(); |
|
1246 |
||
1247 |
if ( !AddKeystrokeL(aKey) ) |
|
1248 |
{ |
|
1249 |
iOwner->FepMan()->PlaySound(EAvkonSIDErrorTone); |
|
1250 |
return; |
|
1251 |
} |
|
1252 |
||
1253 |
AnalyseL(); |
|
1254 |
||
1255 |
//Auto change from EMiniQwertyEdit state to EEntry state. |
|
1256 |
if (EMiniQwertyEdit == iState) |
|
1257 |
{ |
|
1258 |
if ( ( !firstGroup ) && CheckFirstGroupStroke() ) |
|
1259 |
{ |
|
1260 |
if ( EAutoChangeStateFromCandidate == editPane->GetAutoChangeStateFlag() ) |
|
1261 |
{ |
|
1262 |
RefreshUI(); |
|
1263 |
editPane->SetChangeState(ETrue); |
|
1264 |
iOwner->ChangeState(ECandidate); |
|
1265 |
} |
|
1266 |
else if ( EAutoChangeStateFromInput == editPane->GetAutoChangeStateFlag() ) |
|
1267 |
{ |
|
1268 |
editPane->SetChangeState(ETrue); |
|
1269 |
iOwner->ChangeState(EEntry); |
|
1270 |
} |
|
1271 |
else |
|
1272 |
{ |
|
1273 |
RefreshUI(); |
|
1274 |
} |
|
1275 |
return; |
|
1276 |
} |
|
1277 |
} |
|
1278 |
||
1279 |
//Auto change from EEntry state to EMiniQwertyEdit state. |
|
1280 |
if (EEntry == iState) |
|
1281 |
{ |
|
1282 |
if ( !CheckFirstGroupStroke() ) |
|
1283 |
{ |
|
1284 |
editPane->SetAutoChangeStateFlag(EAutoChangeStateFromInput); |
|
1285 |
editPane->SetChangeState(ETrue); |
|
1286 |
iOwner->ChangeState(EMiniQwertyEdit); |
|
1287 |
return; |
|
1288 |
} |
|
1289 |
} |
|
1290 |
||
1291 |
RefreshUI(); |
|
1292 |
} |
|
1293 |
||
1294 |
// --------------------------------------------------------------------------- |
|
1295 |
// TAknFepInputMiniQwertyPinyinPhraseBase::ShowInfoOnEEP |
|
1296 |
// Show the showinfo on the EEP ctrl. |
|
1297 |
// --------------------------------------------------------------------------- |
|
1298 |
// |
|
1299 |
void TAknFepInputMiniQwertyPinyinPhraseBase::ShowInfoOnEEPPane() |
|
1300 |
{ |
|
1301 |
MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
1302 |
MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
1303 |
CDesCArrayFlat* showKeystroke = editPane->ShowKeystrokeArray(); |
|
1304 |
CDesCArrayFlat* keystrokeArray = editPane->KeystrokeArray(); |
|
1305 |
CDesCArrayFlat* phrase = editPane->PhraseArray(); |
|
1306 |
TBuf<KMaxKeystrokeCount> showInfo; |
|
1307 |
TBuf<KMaxKeystrokeCount> keyBuf; |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1308 |
|
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1309 |
// Get the current core id |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1310 |
TInt coreID = 0; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1311 |
TRAP_IGNORE( coreID = iOwner->PtiEngine()->HandleCommandL( EPtiCommandGetCoreID )); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1312 |
TInt phraseCount = 0; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1313 |
|
44 | 1314 |
for (TInt i = 0; i < phrase->Count(); ++i) |
1315 |
{ |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1316 |
// If this method is called in construction of the state machine, |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1317 |
// the plugin is not set. If sogou core is in use now, we should append |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1318 |
// each characters to showInfo. |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1319 |
// For Sogou core, maybe one element of PhraseArray() contains two or more characters. |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1320 |
if ( TUid::Uid( coreID ) == KPtiSogouCoreUid ) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1321 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1322 |
for ( TInt k = 0; k < phrase->MdcaPoint(i).Length(); k++ ) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1323 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1324 |
showInfo.Append( phrase->MdcaPoint(i)[k] ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1325 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1326 |
phraseCount += phrase->MdcaPoint(i).Length(); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1327 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1328 |
else |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1329 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1330 |
// If cpicore is in use, just append the element of phrase |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1331 |
showInfo.Append(phrase->MdcaPoint(i) ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1332 |
} |
44 | 1333 |
} |
1334 |
||
1335 |
for (TInt ii = 0; ii < showKeystroke->Count(); ++ii) |
|
1336 |
{ |
|
1337 |
showInfo.Append(showKeystroke->MdcaPoint(ii) ); |
|
1338 |
} |
|
1339 |
||
1340 |
for (TInt j = 0; j < keystrokeArray->Count(); ++j) |
|
1341 |
{ |
|
1342 |
keyBuf.Append(keystrokeArray->MdcaPoint(j) ); |
|
1343 |
} |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1344 |
|
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1345 |
// If this method is called in construction of the state machine, |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1346 |
// the plugin is not set. If sogou core is in use now, the phraseCount |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1347 |
// should be the same as the phrase characters count. |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1348 |
// For Sogou core, maybe one element of PhraseArray() contains two or more characters. |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1349 |
if ( TUid::Uid( coreID ) == KPtiSogouCoreUid ) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1350 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1351 |
editPane->SetTextForZhuyin(showInfo, GetCursorPos(), phraseCount, |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1352 |
keyBuf, editPane->GetCursorIndexOfKeystroke() ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1353 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1354 |
else |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1355 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1356 |
// If cpicore is in use, phraseCount is the same as phrase->Count() |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1357 |
editPane->SetTextForZhuyin(showInfo, GetCursorPos(), phrase->Count(), |
44 | 1358 |
keyBuf, editPane->GetCursorIndexOfKeystroke() ); |
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1359 |
} |
44 | 1360 |
|
1361 |
if (iState == ECandidate) |
|
1362 |
{ |
|
1363 |
editPane->DisableCursor(); |
|
1364 |
} |
|
1365 |
else |
|
1366 |
if (iState == EEntry) |
|
1367 |
{ |
|
1368 |
editPane->EnableCursor(); |
|
1369 |
editPane->DeactiveCursor(); |
|
1370 |
} |
|
1371 |
else |
|
1372 |
if (iState == EMiniQwertyEdit) |
|
1373 |
{ |
|
1374 |
editPane->EnableCursor(); |
|
1375 |
editPane->ActiveCursor(); |
|
1376 |
} |
|
1377 |
} |
|
1378 |
||
1379 |
// --------------------------------------------------------------------------- |
|
1380 |
// TAknFepInputMiniQwertyPinyinPhraseBase::ShowInfoOnEEP |
|
1381 |
// Show the showinfo on the EEP ctrl. |
|
1382 |
// --------------------------------------------------------------------------- |
|
1383 |
// |
|
1384 |
void TAknFepInputMiniQwertyPinyinPhraseBase::ShowInfoOnCandidatePane() |
|
1385 |
{ |
|
1386 |
MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
1387 |
CDesCArrayFlat* phrase = uiContainer->CandidatePane()->CandidateArray(); |
|
1388 |
MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
1389 |
if (KMaxPhraseCreationCount == editPane->PhraseArray()->Count() ) |
|
1390 |
{ |
|
1391 |
phrase->Reset(); |
|
1392 |
TRAP_IGNORE( phrase->AppendL( KMaxPhraseNote ) ); |
|
1393 |
uiContainer->CandidatePane()->SplitPhraseCandidatesIntoPages(); |
|
1394 |
uiContainer->CandidatePane()->SetCandidateBuffer(); |
|
1395 |
uiContainer->Enable(ETrue); |
|
1396 |
uiContainer->ShowHorizontalScrollArrows(EFalse); |
|
1397 |
uiContainer->ShowVerticalScrollArrows(EFalse); |
|
1398 |
} |
|
1399 |
||
1400 |
TRAP_IGNORE( GetCandidateL() ); |
|
1401 |
if (phrase->Count() > 0) |
|
1402 |
{ |
|
1403 |
// layout candidate and fill candidate buffer for first display page |
|
1404 |
uiContainer->CandidatePane()->SplitPhraseCandidatesIntoPages(); |
|
1405 |
uiContainer->CandidatePane()->SetCandidateBuffer(); |
|
1406 |
uiContainer->Enable(ETrue); |
|
1407 |
TBool multiplePages = !(uiContainer->CandidatePane()->IsLastPage() && uiContainer->CandidatePane()->IsFirstPage()); |
|
1408 |
uiContainer->ShowVerticalScrollArrows(multiplePages); |
|
1409 |
if (iState == EMiniQwertyEdit) |
|
1410 |
{ |
|
1411 |
UIContainer()->FocusCandidatePane(EFalse); |
|
1412 |
} |
|
1413 |
else |
|
1414 |
{ |
|
1415 |
UIContainer()->FocusCandidatePane(ETrue); |
|
1416 |
UIContainer()->CandidatePane()->SelectFirstPhrase(); |
|
1417 |
} |
|
1418 |
} |
|
1419 |
else |
|
1420 |
{ |
|
1421 |
uiContainer->CandidatePane()->SplitPhraseCandidatesIntoPages(); |
|
1422 |
uiContainer->CandidatePane()->SetCandidateBuffer(); |
|
1423 |
uiContainer->Enable(ETrue); |
|
1424 |
uiContainer->ShowHorizontalScrollArrows(EFalse); |
|
1425 |
uiContainer->ShowVerticalScrollArrows(EFalse); |
|
1426 |
uiContainer->SetControlInVisible( EFalse ); |
|
1427 |
} |
|
1428 |
} |
|
1429 |
||
46
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1430 |
//------------------------------------------------------------------------------- |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1431 |
// Purpose: to adjust the scancode to make pinyin works |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1432 |
// Pinyin symbol inheritantly accepts A-Z, any input out of this range will make it crash. |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1433 |
// Add this function to turn some alienated scancode to A-Z. |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1434 |
// |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1435 |
//--------------------------------------------------------------------------- |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1436 |
// |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1437 |
void TAknFepInputMiniQwertyPinyinPhraseBase::MapKey(TInt& aKey) |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1438 |
{ |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1439 |
if(iOwner && iOwner->PtiEngine()) |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1440 |
{ |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1441 |
iOwner->PtiEngine()->SetInputMode(EPtiEnginePinyinPhraseQwerty); |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1442 |
TBuf<KMaxName> upperdata; |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1443 |
iOwner->PtiEngine()->MappingDataForKey((TPtiKey)aKey, upperdata, EPtiCaseUpper); |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1444 |
if(upperdata.Length() > 0) |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1445 |
{ |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1446 |
aKey = upperdata[0]; |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1447 |
} |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1448 |
} |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1449 |
} |
44 | 1450 |
// --------------------------------------------------------------------------- |
1451 |
// TAknFepInputMiniQwertyPinyinPhraseBase::GetShowKeystroke |
|
1452 |
//Handle horizontal navigation. |
|
1453 |
// --------------------------------------------------------------------------- |
|
1454 |
// |
|
1455 |
void TAknFepInputMiniQwertyPinyinPhraseBase::GetShowKeystroke(TInt aKey, |
|
1456 |
TDes& aKeystroke) |
|
1457 |
{ |
|
46
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1458 |
TInt key = aKey; |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1459 |
MapKey(key); |
44 | 1460 |
TInt count = sizeof(StrokeMap )/sizeof(StrokeMap[0] ); |
1461 |
for (TInt i = 0; i < count; i++) |
|
1462 |
{ |
|
46
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1463 |
if (key == StrokeMap[i].iKeyCode) |
44 | 1464 |
{ |
1465 |
aKeystroke.Append(StrokeMap[i].iValue); |
|
1466 |
break; |
|
1467 |
} |
|
1468 |
} |
|
1469 |
} |
|
1470 |
||
1471 |
// --------------------------------------------------------------------------- |
|
1472 |
// TAknFepInputMiniQwertyPinyinPhraseBase::HandleHorizontalNavigation |
|
1473 |
//Handle horizontal navigation. |
|
1474 |
// --------------------------------------------------------------------------- |
|
1475 |
// |
|
1476 |
TBool TAknFepInputMiniQwertyPinyinPhraseBase::HandleHorizontalNavigation( |
|
1477 |
TInt aKey) |
|
1478 |
{ |
|
1479 |
MAknFepUICtrlCandidatePane* candidatePane = UIContainer()->CandidatePane(); |
|
1480 |
TBool response = EFalse; |
|
1481 |
||
1482 |
// Do navigation... |
|
1483 |
if (aKey == EStdKeyLeftArrow) |
|
1484 |
{ |
|
1485 |
if (!candidatePane->SelectPrev()) |
|
1486 |
{ |
|
1487 |
candidatePane->SetCandidateBuffer(); |
|
1488 |
candidatePane->SelectLastPhrase(); |
|
1489 |
} |
|
1490 |
response = ETrue; |
|
1491 |
} |
|
1492 |
else |
|
1493 |
if (aKey == EStdKeyRightArrow) |
|
1494 |
{ |
|
1495 |
if (!candidatePane->SelectNext()) |
|
1496 |
{ |
|
1497 |
candidatePane->SetCandidateBuffer(); |
|
1498 |
candidatePane->SelectFirstPhrase(); |
|
1499 |
} |
|
1500 |
response = ETrue; |
|
1501 |
} |
|
1502 |
||
1503 |
if (response) |
|
1504 |
{ |
|
1505 |
UpdateIndicator(); |
|
1506 |
} |
|
1507 |
||
1508 |
return response; |
|
1509 |
} |
|
1510 |
||
1511 |
// --------------------------------------------------------- |
|
1512 |
// TAknFepInputMiniQwertyPinyinPhraseBase::UpdateIndicator |
|
1513 |
// Update Indicator. |
|
1514 |
// --------------------------------------------------------- |
|
1515 |
// |
|
1516 |
void TAknFepInputMiniQwertyPinyinPhraseBase::UpdateIndicator() |
|
1517 |
{ |
|
1518 |
MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
1519 |
MAknFepUICtrlCandidatePane* candidatePane = uiContainer->CandidatePane(); |
|
1520 |
||
1521 |
if (candidatePane->IsFirstPage()) |
|
1522 |
{ |
|
1523 |
uiContainer->CandidatePane()->ShowUpScrollArrows(EFalse); |
|
1524 |
} |
|
1525 |
else |
|
1526 |
{ |
|
1527 |
uiContainer->CandidatePane()->ShowUpScrollArrows(ETrue); |
|
1528 |
} |
|
1529 |
||
1530 |
if (candidatePane->IsLastPage()) |
|
1531 |
{ |
|
1532 |
uiContainer->CandidatePane()->ShowDownScrollArrows(EFalse); |
|
1533 |
} |
|
1534 |
else |
|
1535 |
{ |
|
1536 |
uiContainer->CandidatePane()->ShowDownScrollArrows(ETrue); |
|
1537 |
} |
|
1538 |
#ifdef RD_INTELLIGENT_TEXT_INPUT |
|
1539 |
if (iOwner->FepMan()->KeyboardLayout() == EPtiKeyboardQwerty4x10) |
|
1540 |
{ |
|
1541 |
if (candidatePane->VisibleCandidateCount()==1) |
|
1542 |
{ |
|
1543 |
uiContainer->CandidatePane()->ShowLeftScrollArrows(EFalse); |
|
1544 |
uiContainer->CandidatePane()->ShowRightScrollArrows(EFalse); |
|
1545 |
} |
|
1546 |
else |
|
1547 |
{ |
|
1548 |
uiContainer->CandidatePane()->ShowLeftScrollArrows(ETrue); |
|
1549 |
uiContainer->CandidatePane()->ShowRightScrollArrows(ETrue); |
|
1550 |
} |
|
1551 |
} |
|
1552 |
else |
|
1553 |
{ |
|
1554 |
#endif |
|
1555 |
if (candidatePane->SelectedIndex() == 0 |
|
1556 |
&& candidatePane->IsFirstPage() ) |
|
1557 |
{ |
|
1558 |
uiContainer->CandidatePane()->ShowLeftScrollArrows(EFalse); |
|
1559 |
} |
|
1560 |
else |
|
1561 |
{ |
|
1562 |
uiContainer->CandidatePane()->ShowLeftScrollArrows(ETrue); |
|
1563 |
} |
|
1564 |
||
1565 |
if (candidatePane->IsLastPage() && (candidatePane->SelectedIndex() |
|
1566 |
== candidatePane->VisibleCandidateCount() - 1)) |
|
1567 |
{ |
|
1568 |
uiContainer->CandidatePane()->ShowRightScrollArrows(EFalse); |
|
1569 |
} |
|
1570 |
else |
|
1571 |
{ |
|
1572 |
uiContainer->CandidatePane()->ShowRightScrollArrows(ETrue); |
|
1573 |
} |
|
1574 |
} |
|
1575 |
#ifdef RD_INTELLIGENT_TEXT_INPUT |
|
1576 |
} |
|
1577 |
#endif |
|
1578 |
||
1579 |
// --------------------------------------------------------- |
|
1580 |
// TAknFepInputMiniQwertyPinyinPhraseBase::DeleteMoreKeystrokeL |
|
1581 |
// Delete more keystroke than max leng. |
|
1582 |
// --------------------------------------------------------- |
|
1583 |
// |
|
1584 |
void TAknFepInputMiniQwertyPinyinPhraseBase::DeleteMoreKeystrokeL() |
|
1585 |
{ |
|
1586 |
MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
1587 |
MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
1588 |
CDesCArrayFlat* keystroke = editPane->KeystrokeArray(); |
|
1589 |
CDesCArrayFlat* showKeystroke = editPane->ShowKeystrokeArray(); |
|
1590 |
TInt index = editPane->GetCursorIndexOfKeystroke(); |
|
1591 |
TBuf<1> autoDLT; |
|
1592 |
autoDLT.Append( KAutoDLT ); |
|
1593 |
AnalyseL(); |
|
1594 |
// the count keystroke more than max length. |
|
1595 |
TInt count = showKeystroke->Count() - KMaxKeystrokeCount; |
|
1596 |
||
1597 |
for ( TInt i = 0; i < count; ++i ) |
|
1598 |
{ |
|
1599 |
if ( 0 != showKeystroke->MdcaPoint( showKeystroke->Count() - 1 ).Compare( autoDLT ) ) |
|
1600 |
{ |
|
1601 |
showKeystroke->Delete( showKeystroke->Count() - 1 ); |
|
1602 |
keystroke->Delete( keystroke->Count() - 1 ); |
|
1603 |
} |
|
1604 |
} |
|
1605 |
||
1606 |
if ( index > keystroke->Count() ) |
|
1607 |
{ |
|
1608 |
editPane->SetCursorIndexOfKeystroke( keystroke->Count() ); |
|
1609 |
} |
|
1610 |
} |
|
1611 |
// --------------------------------------------------------- |
|
1612 |
// TAknFepInputMiniQwertyPinyinPhraseBase::DeleteKeystrokeL |
|
1613 |
// Delete current keystroke. |
|
1614 |
// --------------------------------------------------------- |
|
1615 |
// |
|
1616 |
TBool TAknFepInputMiniQwertyPinyinPhraseBase::DeleteKeystrokeL() |
|
1617 |
{ |
|
1618 |
MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
1619 |
MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
1620 |
CDesCArrayFlat* keystroke = editPane->KeystrokeArray(); |
|
1621 |
TInt index = editPane->GetCursorIndexOfKeystroke(); |
|
1622 |
TInt showKeyCount = editPane->ShowKeystrokeArray()->Count(); |
|
1623 |
||
1624 |
if ( ( 0 == index ) || (keystroke->Count() == 0 )) |
|
1625 |
{ |
|
1626 |
return EFalse; |
|
1627 |
} |
|
1628 |
if ( 1 == index ) |
|
1629 |
{ |
|
1630 |
editPane->Reset(); |
|
1631 |
} |
|
1632 |
if (index >= keystroke->Count() ) |
|
1633 |
{ |
|
1634 |
keystroke->Delete(keystroke->Count() - 1); |
|
1635 |
editPane->SetCursorIndexOfKeystroke(keystroke->Count() ); |
|
1636 |
} |
|
1637 |
else |
|
1638 |
{ |
|
1639 |
keystroke->Delete(index - 1); |
|
1640 |
editPane->SetCursorIndexOfKeystroke(index - 1); |
|
1641 |
} |
|
1642 |
||
1643 |
if ( showKeyCount >= KMaxKeystrokeCount - 1 ) |
|
1644 |
{ |
|
1645 |
DeleteMoreKeystrokeL(); |
|
1646 |
} |
|
1647 |
||
1648 |
return ETrue; |
|
1649 |
} |
|
1650 |
||
1651 |
// --------------------------------------------------------- |
|
1652 |
// TAknFepInputMiniQwertyPinyinPhraseBase::AddPhraseToDB |
|
1653 |
// Add phrase to DB. |
|
1654 |
// --------------------------------------------------------- |
|
1655 |
// |
|
1656 |
void TAknFepInputMiniQwertyPinyinPhraseBase::AddPhraseToDB( |
|
1657 |
const TDesC& aPhraseAdd) |
|
1658 |
{ |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1659 |
if ( iPlugin.IsEnable()) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1660 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1661 |
iPlugin.AddPhrasePinyinToPti(); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1662 |
return; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1663 |
} |
44 | 1664 |
TPtiUserDictionaryEntry addUdbEntry(aPhraseAdd); |
1665 |
//Add the phrase to the DB by PTI Engine |
|
1666 |
iOwner->PtiEngine()->AddUserDictionaryEntry(addUdbEntry); |
|
1667 |
} |
|
1668 |
||
1669 |
// --------------------------------------------------------------------------- |
|
1670 |
// TAknFepInputMiniQwertyPinyinPhraseBase::RefreshCandidate |
|
1671 |
// Refresh candidate |
|
1672 |
// --------------------------------------------------------------------------- |
|
1673 |
// |
|
1674 |
void TAknFepInputMiniQwertyPinyinPhraseBase::RefreshCandidate() |
|
1675 |
{ |
|
1676 |
MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
1677 |
uiContainer->CandidatePane()->SetCandidateBuffer(); |
|
1678 |
uiContainer->Enable(ETrue); |
|
1679 |
||
1680 |
TBool multiplePages = !(uiContainer->CandidatePane()->IsLastPage() && |
|
1681 |
uiContainer->CandidatePane()->IsFirstPage()); |
|
1682 |
uiContainer->ShowVerticalScrollArrows(multiplePages); |
|
1683 |
||
1684 |
uiContainer->CandidatePane()->SelectFirstPhrase(); |
|
1685 |
UpdateIndicator(); |
|
1686 |
} |
|
1687 |
||
1688 |
// --------------------------------------------------------------------------- |
|
1689 |
// TAknFepInputMiniQwertyPinyinPhraseBase::CheckKeyNeedRepeat |
|
1690 |
// Check key whether need repeat. |
|
1691 |
// --------------------------------------------------------------------------- |
|
1692 |
// |
|
1693 |
TBool TAknFepInputMiniQwertyPinyinPhraseBase::CheckKeyNeedRepeat( |
|
1694 |
TKeyPressLength aLength) |
|
1695 |
{ |
|
1696 |
MAknFepUICtrlEditPane* editPane = UIContainer()->EditPaneWindow(); |
|
1697 |
if (editPane->IsChangeState() && aLength == ELongKeyPress) |
|
1698 |
{ |
|
1699 |
return EFalse; |
|
1700 |
} |
|
1701 |
else |
|
1702 |
{ |
|
1703 |
editPane->SetChangeState(EFalse); |
|
1704 |
} |
|
1705 |
return ETrue; |
|
1706 |
} |
|
1707 |
||
1708 |
// --------------------------------------------------------------------------- |
|
1709 |
// TAknFepInputMiniQwertyPinyinPhraseBase::CommitInlineEEPL |
|
1710 |
// Commint text to EEP or editor |
|
1711 |
// --------------------------------------------------------------------------- |
|
1712 |
// |
|
1713 |
TBool TAknFepInputMiniQwertyPinyinPhraseBase::CommitInlineEEPL( |
|
1714 |
const TDesC& aDes) |
|
1715 |
{ |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1716 |
// If sogou core is actived, use the plugin. |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1717 |
if ( iPlugin.IsEnable()) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1718 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1719 |
return iPlugin.CommitInlineEEPL( aDes ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1720 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1721 |
|
44 | 1722 |
TInt charCount = aDes.Length(); |
1723 |
MAknFepManagerUIInterface* fepMan = iOwner->FepMan(); |
|
1724 |
MAknFepUICtrlEditPane* editpane = UIContainer()->EditPaneWindow(); |
|
1725 |
CDesCArrayFlat* showkeyStoke = editpane->ShowKeystrokeArray(); |
|
1726 |
CDesCArrayFlat* keyStoke = editpane->KeystrokeArray(); |
|
1727 |
CDesCArrayFlat* phraseArray = editpane->PhraseArray(); |
|
1728 |
CDesCArrayFlat* phraseShowKeyStroke = editpane->PhraseShowKeyStrokeArray(); |
|
1729 |
TBuf<KMaxKeystrokeCount> buf; |
|
1730 |
TBuf<1> autoDLT; |
|
1731 |
autoDLT.Append(KAutoDLT); |
|
1732 |
||
1733 |
if (phraseArray->Count() == 0) |
|
1734 |
{ |
|
1735 |
editpane->SetPhraseCreationFlag(EFalse); |
|
1736 |
} |
|
1737 |
phraseArray->AppendL(aDes); |
|
1738 |
||
1739 |
TInt delCount = 0; |
|
1740 |
for (TInt i = 0; i < showkeyStoke->Count() && charCount |
|
1741 |
&& keyStoke->Count() != 0; i++) |
|
1742 |
{ |
|
1743 |
TPtrC showptr = showkeyStoke->MdcaPoint(i); |
|
1744 |
TPtrC ptr = keyStoke->MdcaPoint( 0); |
|
1745 |
if (CheckSpellingDLT(showptr) || (KInvalidToneMark |
|
1746 |
!= ToneMark(showptr) )) |
|
1747 |
{ |
|
1748 |
charCount--; |
|
1749 |
} |
|
1750 |
if (showptr.Compare(autoDLT) != 0) |
|
1751 |
{ |
|
1752 |
buf.Append(ptr); |
|
1753 |
keyStoke->Delete( 0); |
|
1754 |
} |
|
1755 |
delCount++; |
|
1756 |
} |
|
1757 |
||
1758 |
for (TInt j = 0; j < delCount; j++) |
|
1759 |
{ |
|
1760 |
showkeyStoke->Delete( 0); |
|
1761 |
} |
|
1762 |
phraseShowKeyStroke->AppendL(buf); |
|
1763 |
||
1764 |
TInt phraseCount = phraseArray->Count(); |
|
1765 |
if (phraseCount > KMaxPhraseCreationCount) |
|
1766 |
{ |
|
1767 |
phraseCount = KMaxPhraseCreationCount; |
|
1768 |
} |
|
1769 |
||
1770 |
if (keyStoke->Count() == 0 || phraseCount == KMaxPhraseCreationCount) |
|
1771 |
{ |
|
1772 |
//here,we pass pinyin-spelling to db together with phrase. |
|
1773 |
TBuf<KMaxPhraseCreationCount> phraseCreated; |
|
1774 |
phraseCreated.FillZ(); |
|
1775 |
TBuf<(1+KMaxSpellLength)*KMaxPhraseCreationCount> phraseCreatedWithPinYin;//(Zi+pinyin)* max_Zi |
|
1776 |
phraseCreatedWithPinYin.FillZ(); |
|
1777 |
for (TInt ii = 0; ii < phraseCount; ++ii) |
|
1778 |
{ |
|
1779 |
TPtrC ptrZi = phraseArray->MdcaPoint(ii); |
|
1780 |
phraseCreatedWithPinYin.Append(ptrZi); |
|
1781 |
phraseCreated.Append(ptrZi); |
|
1782 |
||
1783 |
TPtrC ptrPinYin = phraseShowKeyStroke->MdcaPoint(ii);//it mabe include KManualDLT,but no matter |
|
1784 |
phraseCreatedWithPinYin.Append(ptrPinYin); |
|
1785 |
||
1786 |
TInt zeroTail = (1+KMaxSpellLength)-(ptrZi.Length()+ptrPinYin.Length()); |
|
1787 |
phraseCreatedWithPinYin.AppendFill(0,zeroTail); |
|
1788 |
||
1789 |
} |
|
1790 |
fepMan->NewTextL(phraseCreated); |
|
1791 |
fepMan->CommitInlineEditL(); |
|
1792 |
iOwner->PtiEngine()->SetPredictiveChineseChar(phraseCreated); |
|
1793 |
AddPhraseToDB(phraseCreatedWithPinYin); |
|
1794 |
return EFalse; |
|
1795 |
} |
|
1796 |
||
1797 |
||
1798 |
||
1799 |
editpane->SetCursorIndexOfKeystroke( 0); |
|
1800 |
editpane->DisableCursor(); |
|
1801 |
editpane->SetPhraseCreationFlag(ETrue); |
|
1802 |
return ETrue; |
|
1803 |
} |
|
1804 |
// --------------------------------------------------------- |
|
1805 |
// TAknFepInputMiniQwertyPinyinPhraseBase::ClearPtiEngineKeystroke |
|
1806 |
// clear the ptiengine keystroke; |
|
1807 |
// --------------------------------------------------------- |
|
1808 |
// |
|
1809 |
void TAknFepInputMiniQwertyPinyinPhraseBase::ClearPtiEngineKeystroke() |
|
1810 |
{ |
|
1811 |
iOwner->PtiEngine()->ClearCurrentWord(); |
|
1812 |
} |
|
1813 |
||
1814 |
// --------------------------------------------------------- |
|
1815 |
// TAknFepInputMiniQwertyPinyinPhraseBase::AddKeystrokeL |
|
1816 |
// Add keystroke. |
|
1817 |
// --------------------------------------------------------- |
|
1818 |
// |
|
1819 |
TBool TAknFepInputMiniQwertyPinyinPhraseBase::AddKeystrokeL(TInt aKey) |
|
1820 |
{ |
|
1821 |
MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
1822 |
MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
1823 |
CDesCArrayFlat* keystrokeArray = editPane->KeystrokeArray(); |
|
1824 |
TInt phraseCount = editPane->PhraseArray()->Count(); |
|
1825 |
TInt showKeystrokeCount = editPane->ShowKeystrokeArray()->Count(); |
|
1826 |
TInt index = editPane->GetCursorIndexOfKeystroke(); |
|
1827 |
TBuf<1> keystroke; |
|
1828 |
||
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1829 |
// Get the current core id |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1830 |
TInt coreID = 0; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1831 |
TRAP_IGNORE( coreID = iOwner->PtiEngine()->HandleCommandL( EPtiCommandGetCoreID )); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1832 |
|
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1833 |
if ( TUid::Uid( coreID ) == KPtiSogouCoreUid ) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1834 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1835 |
CDesCArrayFlat* phrase = editPane->PhraseArray(); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1836 |
phraseCount = 0; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1837 |
for ( TInt j = 0; j < phrase->Count(); j++ ) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1838 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1839 |
phraseCount += phrase->MdcaPoint(j).Length();; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1840 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1841 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1842 |
|
44 | 1843 |
if ( phraseCount + showKeystrokeCount >= KMaxKeystrokeCount ) |
1844 |
{ |
|
1845 |
return EFalse; |
|
1846 |
} |
|
1847 |
||
1848 |
GetShowKeystroke(aKey, keystroke); |
|
46
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1849 |
|
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1850 |
//Add this condition to avoid crash in case keystroke is empty. |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1851 |
if(keystroke.Length() == 0) |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1852 |
{ |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1853 |
return EFalse; |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1854 |
} |
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1855 |
|
44 | 1856 |
if ( index >= keystrokeArray->Count() ) |
1857 |
{ |
|
1858 |
keystrokeArray->AppendL(keystroke); |
|
1859 |
editPane->SetCursorIndexOfKeystroke(keystrokeArray->Count() ); |
|
1860 |
} |
|
1861 |
else |
|
1862 |
{ |
|
1863 |
keystrokeArray->InsertL(index, keystroke); |
|
1864 |
editPane->SetCursorIndexOfKeystroke(index + 1); |
|
1865 |
} |
|
1866 |
||
1867 |
if ( phraseCount + showKeystrokeCount >= KMaxKeystrokeCount - 1 ) |
|
1868 |
{ |
|
1869 |
AnalyseL(); |
|
1870 |
if ( phraseCount + editPane->ShowKeystrokeArray()->Count() <= KMaxKeystrokeCount ) |
|
1871 |
{ |
|
1872 |
return ETrue; |
|
1873 |
} |
|
1874 |
else |
|
1875 |
{ |
|
1876 |
keystrokeArray->Delete( index ); |
|
1877 |
editPane->SetCursorIndexOfKeystroke( index ); |
|
1878 |
AnalyseL(); |
|
1879 |
return EFalse; |
|
1880 |
} |
|
1881 |
} |
|
1882 |
||
1883 |
||
1884 |
return ETrue; |
|
1885 |
} |
|
1886 |
||
1887 |
// --------------------------------------------------------- |
|
1888 |
// TAknFepInputMiniQwertyPinyinPhraseBase::AddToneMarkL |
|
1889 |
// Add tone mark. |
|
1890 |
// --------------------------------------------------------- |
|
1891 |
// |
|
1892 |
TBool TAknFepInputMiniQwertyPinyinPhraseBase::AddToneMarkL() |
|
1893 |
{ |
|
1894 |
MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
1895 |
MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
1896 |
CDesCArrayFlat* keystrokeArray = editPane->KeystrokeArray(); |
|
1897 |
TInt phraseCount = editPane->PhraseArray()->Count(); |
|
1898 |
TInt showKeystrokeCount = editPane->ShowKeystrokeArray()->Count(); |
|
1899 |
TInt index = editPane->GetCursorIndexOfKeystroke(); |
|
1900 |
TInt i = 0; |
|
1901 |
const TInt MaxToneMark = 4; |
|
1902 |
if ( phraseCount + showKeystrokeCount >= KMaxKeystrokeCount ) |
|
1903 |
{ |
|
1904 |
if ( 0 == index ) |
|
1905 |
{ |
|
1906 |
return EFalse; |
|
1907 |
} |
|
1908 |
else |
|
1909 |
{ |
|
1910 |
if ( KInvalidToneMark == ToneMark( keystrokeArray->MdcaPoint( index - 1 ) ) ) |
|
1911 |
{ |
|
1912 |
return EFalse; |
|
1913 |
} |
|
1914 |
} |
|
1915 |
} |
|
1916 |
||
1917 |
TBuf<1> toneMark; |
|
1918 |
||
1919 |
if ( 0 == index ) |
|
1920 |
{ |
|
1921 |
toneMark.Append(PinyinToneMap[0].iValue); |
|
1922 |
keystrokeArray->InsertL( 0, toneMark); |
|
1923 |
editPane->SetCursorIndexOfKeystroke( 1); |
|
1924 |
return ETrue; |
|
1925 |
} |
|
1926 |
||
1927 |
TInt num = sizeof(PinyinToneMap )/( sizeof(PinyinToneMap[0])); |
|
1928 |
for ( i = 0; i < num; ++i ) |
|
1929 |
{ |
|
1930 |
if (PinyinToneMap[i].iValue == keystrokeArray->MdcaPoint( index - 1 )[0]) |
|
1931 |
{ |
|
1932 |
break; |
|
1933 |
} |
|
1934 |
} |
|
1935 |
||
1936 |
if ( i > MaxToneMark ) |
|
1937 |
{ |
|
1938 |
toneMark.Append(PinyinToneMap[0].iValue); |
|
1939 |
keystrokeArray->InsertL(index, toneMark); |
|
1940 |
editPane->SetCursorIndexOfKeystroke( index + 1 ); |
|
1941 |
} |
|
1942 |
else |
|
1943 |
{ |
|
1944 |
if ( MaxToneMark == i ) |
|
1945 |
{ |
|
1946 |
toneMark.Append(PinyinToneMap[0].iValue); |
|
1947 |
} |
|
1948 |
else |
|
1949 |
{ |
|
1950 |
toneMark.Append(PinyinToneMap[ i + 1 ].iValue); |
|
1951 |
} |
|
1952 |
keystrokeArray->Delete(index - 1); |
|
1953 |
keystrokeArray->InsertL(index - 1, toneMark); |
|
1954 |
} |
|
1955 |
||
1956 |
if ( phraseCount + showKeystrokeCount >= KMaxKeystrokeCount - 1 ) |
|
1957 |
{ |
|
1958 |
AnalyseL(); |
|
1959 |
if ( phraseCount + editPane->ShowKeystrokeArray()->Count() > KMaxKeystrokeCount ) |
|
1960 |
{ |
|
1961 |
if ( i > MaxToneMark ) |
|
1962 |
{ |
|
1963 |
keystrokeArray->Delete( index ); |
|
1964 |
editPane->SetCursorIndexOfKeystroke( index ); |
|
1965 |
} |
|
1966 |
else |
|
1967 |
{ |
|
1968 |
toneMark.Zero(); |
|
1969 |
toneMark.Append( PinyinToneMap[i].iValue ); |
|
1970 |
keystrokeArray->Delete( index - 1 ); |
|
1971 |
keystrokeArray->InsertL( index - 1, toneMark ); |
|
1972 |
} |
|
1973 |
AnalyseL(); |
|
1974 |
return EFalse; |
|
1975 |
} |
|
1976 |
} |
|
1977 |
||
1978 |
return ETrue; |
|
1979 |
} |
|
1980 |
||
1981 |
// --------------------------------------------------------- |
|
1982 |
// TAknFepInputMiniQwertyPinyinPhraseBase::GetCandidateL |
|
1983 |
// Get the candidate info. |
|
1984 |
// --------------------------------------------------------- |
|
1985 |
// |
|
1986 |
void TAknFepInputMiniQwertyPinyinPhraseBase::GetCandidateL() |
|
1987 |
{ |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1988 |
if ( iPlugin.IsEnable()) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1989 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1990 |
iPlugin.GetCandidateL(); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1991 |
return; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1992 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1993 |
|
44 | 1994 |
CPtiEngine* ptiengine = iOwner->PtiEngine(); |
1995 |
MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
1996 |
MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
1997 |
CDesCArrayFlat* phraseCandidates = |
|
1998 |
uiContainer->CandidatePane()->CandidateArray(); |
|
1999 |
CDesCArrayFlat* keystroke = editPane->KeystrokeArray(); |
|
2000 |
CDesCArrayFlat* showKeystroke = editPane->ShowKeystrokeArray(); |
|
2001 |
TInt phraseCount = editPane->PhraseArray()->Count(); |
|
2002 |
phraseCandidates->Reset(); |
|
2003 |
TBuf<KMaxKeystrokeCount> buf; |
|
2004 |
TBuf<1> delimiter; |
|
2005 |
delimiter.Append( KManualDLT ); |
|
2006 |
TInt keyCode; |
|
2007 |
TInt count = KInvalidToneMark; |
|
2008 |
ClearPtiEngineKeystroke(); |
|
2009 |
||
2010 |
if ( showKeystroke->Count() == 0 ) |
|
2011 |
{ |
|
2012 |
return; |
|
2013 |
} |
|
2014 |
||
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2015 |
if (( phraseCount == 0 ) && CheckAllGroupStroke()) |
44 | 2016 |
{ |
2017 |
getCurrentLeastDLTSpell(); |
|
2018 |
ptiengine->GetChinesePhraseCandidatesL( *phraseCandidates ); |
|
2019 |
return; |
|
2020 |
} |
|
2021 |
||
2022 |
if ( CheckFirstGroupStroke() ) |
|
2023 |
{ |
|
2024 |
ClearPtiEngineKeystroke(); |
|
2025 |
for ( TInt i = 0; i < showKeystroke->Count(); ++i ) |
|
2026 |
{ |
|
2027 |
count = ToneMark( keystroke->MdcaPoint( i ) ); |
|
2028 |
if ( CheckSpellingDLT( showKeystroke->MdcaPoint( i ) ) ) |
|
2029 |
{ |
|
2030 |
break; |
|
2031 |
} |
|
2032 |
else if ( KInvalidToneMark != count ) |
|
2033 |
{ |
|
2034 |
for ( TInt j = 0; j < count; ++j ) |
|
2035 |
{ |
|
2036 |
ptiengine->IncrementToneMark( ETrue ); |
|
2037 |
} |
|
2038 |
break; |
|
2039 |
} |
|
2040 |
else |
|
2041 |
{ |
|
2042 |
GetKeystrokeCode( keyCode, keystroke->MdcaPoint( i ) ); |
|
2043 |
ptiengine->AppendKeyPress((TPtiKey)keyCode); |
|
2044 |
} |
|
2045 |
} |
|
2046 |
} |
|
2047 |
else |
|
2048 |
{ |
|
2049 |
return; |
|
2050 |
} |
|
2051 |
getCurrentLeastDLTSpell(); |
|
2052 |
ptiengine->GetChinesePhraseCandidatesL( *phraseCandidates ); |
|
2053 |
} |
|
2054 |
||
2055 |
// --------------------------------------------------------- |
|
2056 |
// TAknFepInputMiniQwertyPinyinPhraseBase::GetKeystrokeCode |
|
2057 |
// get Code of the key stroke. |
|
2058 |
// --------------------------------------------------------- |
|
2059 |
// |
|
2060 |
void TAknFepInputMiniQwertyPinyinPhraseBase::GetKeystrokeCode(TInt& aKey, |
|
2061 |
const TDesC& aKeystroke) |
|
2062 |
{ |
|
2063 |
TInt count = sizeof(StrokeMap )/sizeof(StrokeMap[0] ); |
|
2064 |
for (TInt i = 0; i < count; i++) |
|
2065 |
{ |
|
2066 |
TBuf<1> buf; |
|
2067 |
buf.Append(StrokeMap[i].iValue); |
|
2068 |
if (0 == aKeystroke.Compare(buf)) |
|
2069 |
{ |
|
2070 |
aKey = StrokeMap[i].iKeyCode; |
|
2071 |
break; |
|
2072 |
} |
|
2073 |
} |
|
2074 |
} |
|
2075 |
||
2076 |
// --------------------------------------------------------- |
|
2077 |
// TAknFepInputMiniQwertyPinyinPhraseBase::RevertPhraseToKeystrokeL |
|
2078 |
// Revert the phrase to keystroke. |
|
2079 |
// --------------------------------------------------------- |
|
2080 |
// |
|
2081 |
void TAknFepInputMiniQwertyPinyinPhraseBase::RevertPhraseToKeystrokeL() |
|
2082 |
{ |
|
2083 |
MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
2084 |
MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
2085 |
CDesCArrayFlat* keystrokeArray = editPane->KeystrokeArray(); |
|
2086 |
CDesCArrayFlat* shownKeystrokeArray = editPane->ShowKeystrokeArray(); |
|
2087 |
CDesCArrayFlat* phrase = editPane->PhraseArray(); |
|
2088 |
CDesCArrayFlat* phraseStroke = editPane->PhraseShowKeyStrokeArray(); |
|
2089 |
TBuf<KMaxKeystrokeCount> buf; |
|
2090 |
if ( (phrase->Count() == 0 ) || (phraseStroke->Count() == 0 )) |
|
2091 |
{ |
|
2092 |
return; |
|
2093 |
} |
|
2094 |
||
2095 |
buf.Append(phraseStroke->MdcaPoint(phraseStroke->Count() - 1) ); |
|
2096 |
for (TInt i = buf.Length() - 1; i >= 0; --i) |
|
2097 |
{ |
|
2098 |
keystrokeArray->InsertL( 0, buf.Mid(i, 1) ); |
|
2099 |
} |
|
2100 |
phrase->Delete(phrase->Count() - 1); |
|
2101 |
phraseStroke->Delete(phraseStroke->Count() - 1); |
|
2102 |
AnalyseL(); |
|
2103 |
TInt showCount = editPane->ShowKeystrokeArray()->Count(); |
|
2104 |
TInt leng = phrase->Count() + showCount; |
|
2105 |
TInt deleteCount = 0; |
|
2106 |
if (leng > KMaxKeystrokeCount) |
|
2107 |
{ |
|
2108 |
for (TInt i = 0; i < leng - KMaxKeystrokeCount; ++i) |
|
2109 |
{ |
|
2110 |
if (KAutoDLT != shownKeystrokeArray->MdcaPoint( shownKeystrokeArray->Count() - 1 )[0]) |
|
2111 |
{ |
|
2112 |
deleteCount = deleteCount + 1; |
|
2113 |
} |
|
2114 |
shownKeystrokeArray->Delete(shownKeystrokeArray->Count() - 1); |
|
2115 |
} |
|
2116 |
if (KAutoDLT == shownKeystrokeArray->MdcaPoint( shownKeystrokeArray->Count() - 1 )[0]) |
|
2117 |
{ |
|
2118 |
shownKeystrokeArray->Delete(shownKeystrokeArray->Count() - 1); |
|
2119 |
} |
|
2120 |
} |
|
2121 |
for (TInt i = 0; i < deleteCount; ++i) |
|
2122 |
{ |
|
2123 |
keystrokeArray->Delete(keystrokeArray->Count() - 1); |
|
2124 |
} |
|
2125 |
||
2126 |
editPane->SetCursorIndexOfKeystroke(buf.Length() ); |
|
2127 |
keystrokeArray->Compress(); |
|
2128 |
phrase->Compress(); |
|
2129 |
phraseStroke->Compress(); |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2130 |
|
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2131 |
TInt coreID = iOwner->PtiEngine()->HandleCommandL( EPtiCommandGetCoreID ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2132 |
if ( TUid::Uid( coreID ) == KPtiSogouCoreUid ) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2133 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2134 |
// Notify sogoucore that last phrase is cancelled |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2135 |
iOwner->PtiEngine()->HandleCommandL( EPtiCommandCancelSelectElement ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2136 |
} |
44 | 2137 |
} |
2138 |
||
2139 |
// --------------------------------------------------------- |
|
2140 |
// TAknFepInputMiniQwertyPinyinPhraseBase::SetWarningColor |
|
2141 |
// Set warning color. |
|
2142 |
// --------------------------------------------------------- |
|
2143 |
// |
|
2144 |
void TAknFepInputMiniQwertyPinyinPhraseBase::SetWarningColor( |
|
2145 |
TInt aCount, |
|
2146 |
TInt aIndex, |
|
2147 |
TInt aI, |
|
2148 |
TInt aPhraseCount, |
|
2149 |
TInt aToneMark, |
|
2150 |
TBool aValid, |
|
2151 |
CDesCArrayFlat* aShowKeystroke |
|
2152 |
) |
|
2153 |
{ |
|
2154 |
CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
2155 |
MAknFepUICtrlEditPane* editPane = UIContainer()->EditPaneWindow(); |
|
2156 |
if ( ( !aValid ) || CheckSpellingDLT(aShowKeystroke->MdcaPoint(aI |
|
2157 |
- 1) ) || (KInvalidToneMark |
|
2158 |
!= ToneMark( aShowKeystroke->MdcaPoint( aI - 1 ) ) )) |
|
2159 |
{ |
|
2160 |
editPane->SetHighlight(aPhraseCount + aIndex, aPhraseCount |
|
2161 |
+ aIndex + aCount - 1 ); |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2162 |
if ( iPlugin.IsEnable()) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2163 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2164 |
iPlugin.CanConvertAll( EFalse ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2165 |
iPlugin.ConvertCount( aIndex ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2166 |
} |
44 | 2167 |
} |
2168 |
else |
|
2169 |
{ |
|
2170 |
TPtrC ptr1 = getCurrentLeastDLTSpell(); |
|
2171 |
for (TInt j = 0; j < aToneMark; ++j) |
|
2172 |
{ |
|
2173 |
ptiengine->IncrementToneMark(ETrue); |
|
2174 |
TPtrC ptr0 = getCurrentLeastDLTSpell(); |
|
2175 |
if (ptr0.Length() > 0) |
|
2176 |
{ |
|
2177 |
if ( 0 == ptr0.Mid( ptr0.Length() - 1, 1 ). |
|
2178 |
Compare(aShowKeystroke->MdcaPoint( aI ) ) ) |
|
2179 |
{ |
|
2180 |
break; |
|
2181 |
} |
|
2182 |
} |
|
2183 |
} |
|
2184 |
TPtrC ptr2 = getCurrentLeastDLTSpell(); |
|
2185 |
if ( ( ( 1 + ptr1.Length() ) != ptr2.Length() ) || ( 0 |
|
2186 |
!= ptr2.Mid( ptr2.Length() - 1, 1 ). |
|
2187 |
CompareC( aShowKeystroke->MdcaPoint( aI ) ) )) |
|
2188 |
{ |
|
2189 |
editPane->SetHighlight( aPhraseCount + aIndex, aPhraseCount |
|
2190 |
+ aIndex + aCount - 1); |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2191 |
if ( iPlugin.IsEnable()) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2192 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2193 |
iPlugin.CanConvertAll( EFalse ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2194 |
iPlugin.ConvertCount( aIndex ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2195 |
} |
44 | 2196 |
} |
2197 |
} |
|
2198 |
ClearPtiEngineKeystroke(); |
|
2199 |
} |
|
2200 |
||
2201 |
// --------------------------------------------------------- |
|
2202 |
// TAknFepInputMiniQwertyPinyinPhraseBase::SetWarningColor |
|
2203 |
// Set warning color. |
|
2204 |
// --------------------------------------------------------- |
|
2205 |
// |
|
2206 |
void TAknFepInputMiniQwertyPinyinPhraseBase::SetWarningColor() |
|
2207 |
{ |
|
2208 |
CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
2209 |
MAknFepUICtrlEditPane* editPane = UIContainer()->EditPaneWindow(); |
|
2210 |
CDesCArrayFlat* showKeystroke = editPane->ShowKeystrokeArray(); |
|
2211 |
TInt phraseCount = editPane->PhraseArray()->Count(); |
|
2212 |
TBool valid = ETrue; |
|
2213 |
TInt index = 0; |
|
2214 |
TInt count = 0; |
|
2215 |
TInt stringBeforeLength = 0; |
|
2216 |
TInt stringAfterLength = 0; |
|
2217 |
TInt start = 0; |
|
2218 |
TInt keyCode = 0; |
|
2219 |
TInt toneMark = KInvalidToneMark; |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2220 |
|
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2221 |
if ( iPlugin.IsEnable()) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2222 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2223 |
iPlugin.CanConvertAll( ETrue ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2224 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2225 |
// Get the current core id |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2226 |
TInt coreID = 0; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2227 |
TRAP_IGNORE( coreID = iOwner->PtiEngine()->HandleCommandL( EPtiCommandGetCoreID )); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2228 |
|
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2229 |
if ( TUid::Uid( coreID ) == KPtiSogouCoreUid ) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2230 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2231 |
CDesCArrayFlat* phrase = editPane->PhraseArray(); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2232 |
phraseCount = 0; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2233 |
for ( TInt j = 0; j < phrase->Count(); j++ ) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2234 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2235 |
phraseCount += phrase->MdcaPoint(j).Length();; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2236 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2237 |
} |
44 | 2238 |
|
2239 |
if (showKeystroke->Count() == 0) |
|
2240 |
{ |
|
2241 |
return; |
|
2242 |
} |
|
2243 |
||
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2244 |
if ( TUid::Uid( coreID ) != KPtiSogouCoreUid ) |
44 | 2245 |
{ |
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2246 |
if ( CheckAllGroupStroke()) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2247 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2248 |
return; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2249 |
} |
44 | 2250 |
} |
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2251 |
|
44 | 2252 |
ClearPtiEngineKeystroke(); |
2253 |
if (CheckSpellingDLT(showKeystroke->MdcaPoint( 0) ) || (KInvalidToneMark |
|
2254 |
!= ToneMark(showKeystroke->MdcaPoint( 0) ) )) |
|
2255 |
{ |
|
2256 |
start = 1; |
|
2257 |
editPane->SetHighlight(phraseCount, phraseCount); |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2258 |
|
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2259 |
if ( iPlugin.IsEnable()) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2260 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2261 |
iPlugin.CanConvertAll( EFalse ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2262 |
iPlugin.ConvertCount( index ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2263 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2264 |
|
44 | 2265 |
index = 1; |
2266 |
} |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2267 |
|
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2268 |
TInt end = showKeystroke->Count(); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2269 |
if ( TUid::Uid( coreID ) == KPtiSogouCoreUid ) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2270 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2271 |
for ( TInt j = showKeystroke->Count() - 1; j >= 0; j-- ) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2272 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2273 |
if ( KAutoDLT == showKeystroke->MdcaPoint(j)[0] ) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2274 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2275 |
end = j + 1; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2276 |
break; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2277 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2278 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2279 |
} |
44 | 2280 |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2281 |
for ( TInt i = start; i < end; ++i ) |
44 | 2282 |
{ |
2283 |
count = count + 1; |
|
2284 |
// tone mark |
|
2285 |
toneMark = ToneMark(showKeystroke->MdcaPoint(i) ); |
|
2286 |
if ( KInvalidToneMark != toneMark ) |
|
2287 |
{ |
|
2288 |
SetWarningColor( count, |
|
2289 |
index, |
|
2290 |
i, |
|
2291 |
phraseCount, |
|
2292 |
toneMark, |
|
2293 |
valid, |
|
2294 |
showKeystroke ); |
|
2295 |
index = i + 1; |
|
2296 |
count = 0; |
|
2297 |
valid = ETrue; |
|
2298 |
} |
|
2299 |
else |
|
2300 |
if ( CheckSpellingDLT(showKeystroke->MdcaPoint(i) ) ) |
|
2301 |
{ |
|
2302 |
if ( ( !valid ) |
|
2303 |
|| CheckSpellingDLT(showKeystroke->MdcaPoint(i - 1) ) |
|
2304 |
|| (KInvalidToneMark |
|
2305 |
!= ToneMark(showKeystroke->MdcaPoint(i - 1) ) )) |
|
2306 |
{ |
|
2307 |
editPane->SetHighlight(phraseCount + index, phraseCount |
|
2308 |
+ index + count - 1); |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2309 |
if ( iPlugin.IsEnable()) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2310 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2311 |
iPlugin.CanConvertAll( EFalse ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2312 |
iPlugin.ConvertCount( index ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2313 |
} |
44 | 2314 |
} |
2315 |
ClearPtiEngineKeystroke(); |
|
2316 |
index = i + 1; |
|
2317 |
count = 0; |
|
2318 |
valid = ETrue; |
|
2319 |
} |
|
2320 |
else |
|
2321 |
{ |
|
2322 |
if ( valid ) |
|
2323 |
{ |
|
2324 |
GetKeystrokeCode(keyCode, showKeystroke->MdcaPoint(i) ); |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2325 |
|
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2326 |
// dltBeforeCount is the dlt count before append the key. |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2327 |
// dltAfterCount is the dlt count after append the key. |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2328 |
// In sogou core, after appending a new key, the spell length |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2329 |
// may be the same, but the dlt count will change. |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2330 |
// In this situation, the appended key is valid. |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2331 |
TInt dltBeforeCount = 0; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2332 |
TInt dltAfterCount = 0; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2333 |
TPtrC stringBefore = getCurrentLeastDLTSpell(); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2334 |
stringBeforeLength = stringBefore.Length(); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2335 |
for ( TInt j = 0; j < stringBefore.Length(); j++ ) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2336 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2337 |
if ( CheckSpellingDLT( stringBefore.Mid( j ))) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2338 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2339 |
dltBeforeCount++; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2340 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2341 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2342 |
|
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2343 |
// Append the key. |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2344 |
ptiengine->AppendKeyPress(( TPtiKey )keyCode ).Length(); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2345 |
|
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2346 |
// Get the dlt count after appending the key. |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2347 |
TPtrC stringAfter = getCurrentLeastDLTSpell(); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2348 |
stringAfterLength = stringAfter.Length(); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2349 |
for ( TInt k = 0; k < stringAfter.Length(); k++ ) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2350 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2351 |
if ( CheckSpellingDLT( stringAfter.Mid( k ))) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2352 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2353 |
dltAfterCount++; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2354 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2355 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2356 |
|
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2357 |
// If the spell length is the same and the dlt count is |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2358 |
// the same, the keystroke is invalid |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2359 |
if (( stringBeforeLength == stringAfterLength ) && |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2360 |
( dltAfterCount == dltBeforeCount )) |
44 | 2361 |
{ |
2362 |
ClearPtiEngineKeystroke(); |
|
2363 |
valid = EFalse; |
|
2364 |
} |
|
2365 |
} |
|
2366 |
} |
|
2367 |
||
2368 |
if ( ( showKeystroke->Count() == i + 1 ) && ( !valid ) ) |
|
2369 |
{ |
|
2370 |
editPane->SetHighlight( |
|
2371 |
phraseCount + index, |
|
2372 |
phraseCount + index + count - 1 ); |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2373 |
|
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2374 |
if ( iPlugin.IsEnable()) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2375 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2376 |
iPlugin.CanConvertAll( EFalse ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2377 |
iPlugin.ConvertCount( index ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2378 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2379 |
|
44 | 2380 |
ClearPtiEngineKeystroke(); |
2381 |
} |
|
2382 |
} |
|
2383 |
} |
|
2384 |
||
2385 |
// --------------------------------------------------------- |
|
2386 |
// TAknFepInputMiniQwertyPinyinPhraseBase::SetWarningColor |
|
2387 |
// Set warning color. |
|
2388 |
// --------------------------------------------------------- |
|
2389 |
// |
|
2390 |
void TAknFepInputMiniQwertyPinyinPhraseBase::ChangeCbaL() |
|
2391 |
{ |
|
2392 |
MAknFepManagerUIInterface* fepMan = iOwner->FepMan( ); |
|
2393 |
MAknFepUICtrlEditPane* editPane = UIContainer()->EditPaneWindow( ); |
|
2394 |
TInt candidateCount = UIContainer()->CandidatePane()->CandidateArray()->Count( ); |
|
2395 |
TInt keyStrokeCount = editPane->KeystrokeArray()->Count( ); |
|
2396 |
TInt phraseCount = editPane->PhraseArray()->Count( ); |
|
2397 |
TInt currentCBAResId = editPane->GetCurrentCBAResID( ); |
|
2398 |
if ( (candidateCount == 0 && keyStrokeCount != 0 ) || (phraseCount == 1 |
|
2399 |
&& keyStrokeCount == 0 ) ) |
|
2400 |
{ |
|
2401 |
if ( R_AKNFEP_SOFTKEYS_EMPTY_CANCEL_EMPTY != currentCBAResId ) |
|
2402 |
{ |
|
2403 |
fepMan->UpdateCbaL( R_AKNFEP_SOFTKEYS_EMPTY_CANCEL_EMPTY ); |
|
2404 |
editPane->SetCurrentCBAResID( R_AKNFEP_SOFTKEYS_EMPTY_CANCEL_EMPTY ); |
|
2405 |
} |
|
2406 |
||
2407 |
} |
|
2408 |
else if ( keyStrokeCount == 0 ) |
|
2409 |
{ |
|
2410 |
if ( R_AKNFEP_SOFTKEYS_DONE_CANCEL_DONE != currentCBAResId ) |
|
2411 |
{ |
|
2412 |
fepMan->UpdateCbaL( R_AKNFEP_SOFTKEYS_DONE_CANCEL_DONE ); |
|
2413 |
editPane->SetCurrentCBAResID( R_AKNFEP_SOFTKEYS_DONE_CANCEL_DONE ); |
|
2414 |
} |
|
2415 |
} |
|
2416 |
else if ( R_AKNFEP_SOFTKEYS_OK_SELECT_CANCEL != currentCBAResId ) |
|
2417 |
{ |
|
2418 |
fepMan->UpdateCbaL( R_AKNFEP_SOFTKEYS_OK_SELECT_CANCEL ); |
|
2419 |
editPane->SetCurrentCBAResID( R_AKNFEP_SOFTKEYS_OK_SELECT_CANCEL ); |
|
2420 |
} |
|
2421 |
} |
|
2422 |
||
2423 |
// --------------------------------------------------------- |
|
2424 |
// TAknFepInputMiniQwertyPinyinPhraseBase::MoveCursorLeft |
|
2425 |
// Move the cursor to Left. |
|
2426 |
// --------------------------------------------------------- |
|
2427 |
// |
|
2428 |
void TAknFepInputMiniQwertyPinyinPhraseBase::MoveCursorLeft() |
|
2429 |
{ |
|
2430 |
MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
2431 |
MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
2432 |
CDesCArrayFlat* showKeyStoke = editPane->ShowKeystrokeArray(); |
|
2433 |
TInt showKeyStokeCount = editPane->ShowKeystrokeArray()->Count(); |
|
2434 |
TInt indexOfKeystroke = editPane->GetCursorIndexOfKeystroke(); |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2435 |
|
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2436 |
TInt cursorPos = 0; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2437 |
// Get the current core id |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2438 |
TInt coreID = 0; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2439 |
TRAP_IGNORE( coreID = iOwner->PtiEngine()->HandleCommandL( EPtiCommandGetCoreID )); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2440 |
TInt phraseCount = 0; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2441 |
|
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2442 |
// For Sogou core, maybe on element of PhraseArray() contains two or |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2443 |
// more characters. |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2444 |
if ( TUid::Uid( coreID ) == KPtiSogouCoreUid ) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2445 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2446 |
for ( TInt l = 0; l < editPane->PhraseArray()->Count(); l++ ) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2447 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2448 |
phraseCount += editPane->PhraseArray()->MdcaPoint( l ).Length(); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2449 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2450 |
cursorPos = editPane->GetCursor() - phraseCount; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2451 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2452 |
else |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2453 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2454 |
cursorPos = editPane->GetCursor() - editPane->PhraseArray()->Count(); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2455 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2456 |
|
44 | 2457 |
TBuf<1> autoDLT; |
2458 |
autoDLT.Append(KAutoDLT); |
|
2459 |
const TInt offset = 2; |
|
2460 |
if (cursorPos <= 0) |
|
2461 |
{ |
|
2462 |
cursorPos = 0; |
|
2463 |
} |
|
2464 |
else |
|
2465 |
if (cursorPos >= showKeyStokeCount) |
|
2466 |
{ |
|
2467 |
cursorPos = showKeyStokeCount; |
|
2468 |
} |
|
2469 |
||
2470 |
if (cursorPos == 0) |
|
2471 |
{ |
|
2472 |
editPane->SetCursorIndexOfKeystroke(editPane->KeystrokeArray()->Count() ); |
|
2473 |
ShowInfoOnEEPPane(); |
|
2474 |
SetWarningColor(); |
|
2475 |
} |
|
2476 |
else |
|
2477 |
if (cursorPos == 1) |
|
2478 |
{ |
|
2479 |
editPane->SetCursorIndexOfKeystroke( 0); |
|
2480 |
ShowInfoOnEEPPane(); |
|
2481 |
SetWarningColor(); |
|
2482 |
} |
|
2483 |
else |
|
2484 |
{ |
|
2485 |
if (showKeyStoke->MdcaPoint( cursorPos - 2 ).Compare(autoDLT) == 0) |
|
2486 |
{ |
|
2487 |
editPane->MoveCursorLeft(offset); |
|
2488 |
editPane->SetCursorIndexOfKeystroke(indexOfKeystroke - 1); |
|
2489 |
} |
|
2490 |
else |
|
2491 |
{ |
|
2492 |
editPane->MoveCursorLeft(); |
|
2493 |
editPane->SetCursorIndexOfKeystroke(indexOfKeystroke - 1); |
|
2494 |
} |
|
2495 |
} |
|
2496 |
} |
|
2497 |
||
2498 |
// --------------------------------------------------------- |
|
2499 |
// TAknFepInputMiniQwertyPinyinPhraseBase::MoveCursorRight |
|
2500 |
// Move the cursor to Right. |
|
2501 |
// --------------------------------------------------------- |
|
2502 |
// |
|
2503 |
void TAknFepInputMiniQwertyPinyinPhraseBase::MoveCursorRight() |
|
2504 |
{ |
|
2505 |
MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
2506 |
MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
2507 |
CDesCArrayFlat* showKeyStoke = editPane->ShowKeystrokeArray(); |
|
2508 |
TInt showKeyStokeCount = editPane->ShowKeystrokeArray()->Count(); |
|
2509 |
TInt indexOfKeystroke = editPane->GetCursorIndexOfKeystroke(); |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2510 |
|
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2511 |
TInt cursorPos = 0; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2512 |
// Get the current core id |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2513 |
TInt coreID = 0; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2514 |
TRAP_IGNORE( coreID = iOwner->PtiEngine()->HandleCommandL( EPtiCommandGetCoreID )); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2515 |
TInt phraseCount = 0; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2516 |
|
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2517 |
// For Sogou core, maybe on element of PhraseArray() contains two or |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2518 |
// more characters. |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2519 |
if ( TUid::Uid( coreID ) == KPtiSogouCoreUid ) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2520 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2521 |
for ( TInt l = 0; l < editPane->PhraseArray()->Count(); l++ ) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2522 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2523 |
phraseCount += editPane->PhraseArray()->MdcaPoint( l ).Length(); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2524 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2525 |
cursorPos = editPane->GetCursor() - phraseCount; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2526 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2527 |
else |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2528 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2529 |
cursorPos = editPane->GetCursor() - editPane->PhraseArray()->Count(); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2530 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2531 |
|
44 | 2532 |
TBuf<1> autoDLT; |
2533 |
autoDLT.Append(KAutoDLT); |
|
2534 |
const TInt offset = 2; |
|
2535 |
||
2536 |
if (cursorPos <= 0) |
|
2537 |
{ |
|
2538 |
cursorPos = 0; |
|
2539 |
} |
|
2540 |
else |
|
2541 |
if (cursorPos >= showKeyStokeCount) |
|
2542 |
{ |
|
2543 |
cursorPos = showKeyStokeCount; |
|
2544 |
} |
|
2545 |
||
2546 |
if (cursorPos == showKeyStokeCount) |
|
2547 |
{ |
|
2548 |
editPane->SetCursorIndexOfKeystroke( 0); |
|
2549 |
ShowInfoOnEEPPane(); |
|
2550 |
SetWarningColor(); |
|
2551 |
} |
|
2552 |
else |
|
2553 |
if (cursorPos == showKeyStokeCount - 1) |
|
2554 |
{ |
|
2555 |
editPane->MoveCursorRight(); |
|
2556 |
editPane->SetCursorIndexOfKeystroke(editPane->KeystrokeArray()->Count() ); |
|
2557 |
ShowInfoOnEEPPane(); |
|
2558 |
SetWarningColor(); |
|
2559 |
} |
|
2560 |
else |
|
2561 |
{ |
|
2562 |
if (showKeyStoke->MdcaPoint( cursorPos ).Compare(autoDLT) == 0) |
|
2563 |
{ |
|
2564 |
editPane->MoveCursorRight(offset); |
|
2565 |
editPane->SetCursorIndexOfKeystroke(indexOfKeystroke + 1); |
|
2566 |
} |
|
2567 |
else |
|
2568 |
{ |
|
2569 |
editPane->MoveCursorRight(); |
|
2570 |
editPane->SetCursorIndexOfKeystroke(indexOfKeystroke + 1); |
|
2571 |
} |
|
2572 |
} |
|
2573 |
} |
|
2574 |
||
2575 |
// --------------------------------------------------------- |
|
2576 |
// TAknFepInputMiniQwertyPinyinPhraseBase::CheckSpecialKey |
|
2577 |
// Check the special keystroke( i,u,v ). |
|
2578 |
// --------------------------------------------------------- |
|
2579 |
// |
|
2580 |
TBool TAknFepInputMiniQwertyPinyinPhraseBase::CheckSpecialKey(const TInt aKey) |
|
2581 |
{ |
|
2582 |
if ( (aKey == EPtiKeyQwertyI ) || (aKey == EPtiKeyQwertyU ) || (aKey |
|
2583 |
== EPtiKeyQwertyV )) |
|
2584 |
{ |
|
2585 |
return ETrue; |
|
2586 |
} |
|
2587 |
return EFalse; |
|
2588 |
} |
|
2589 |
||
2590 |
// --------------------------------------------------------- |
|
2591 |
// TAknFepInputMiniQwertyPinyinPhraseBase::CheckSpellingDLT |
|
2592 |
// Check the delimiter of spelling. |
|
2593 |
// --------------------------------------------------------- |
|
2594 |
// |
|
2595 |
TBool TAknFepInputMiniQwertyPinyinPhraseBase::CheckSpellingDLT( |
|
2596 |
const TDesC& aKeystroke) |
|
2597 |
{ |
|
2598 |
if ( aKeystroke.Length() == 0 ) |
|
2599 |
{ |
|
2600 |
return EFalse; |
|
2601 |
} |
|
2602 |
||
2603 |
if ( ( KAutoDLT == aKeystroke[0] ) || ( KManualDLT == aKeystroke[0] ) ) |
|
2604 |
{ |
|
2605 |
return ETrue; |
|
2606 |
} |
|
2607 |
||
2608 |
return EFalse; |
|
2609 |
} |
|
2610 |
||
2611 |
// --------------------------------------------------------- |
|
2612 |
// TAknFepInputMiniQwertyPinyinPhraseBase::ToneMark |
|
2613 |
// Get pinyin tone mark. |
|
2614 |
// --------------------------------------------------------- |
|
2615 |
// |
|
2616 |
TInt TAknFepInputMiniQwertyPinyinPhraseBase::ToneMark(const TDesC& aKeystroke) |
|
2617 |
{ |
|
2618 |
TInt numOfToneMark = sizeof (PinyinToneMap)/sizeof(PinyinToneMap[0]); |
|
2619 |
for (TInt i = 0; i < numOfToneMark; i++) |
|
2620 |
{ |
|
2621 |
if (PinyinToneMap[i].iValue == aKeystroke[0]) |
|
2622 |
return PinyinToneMap[i].iInputTone; |
|
2623 |
} |
|
2624 |
return KInvalidToneMark; |
|
2625 |
} |
|
2626 |
||
2627 |
// --------------------------------------------------------- |
|
2628 |
// TAknFepInputMiniQwertyPinyinPhraseBase::ToneMark |
|
2629 |
// Get pinyin tone mark. |
|
2630 |
// --------------------------------------------------------- |
|
2631 |
// |
|
2632 |
TBool TAknFepInputMiniQwertyPinyinPhraseBase::CheckSpellingAddToneMarkToPTIL( |
|
2633 |
const TInt aToneMark ) |
|
2634 |
{ |
|
2635 |
CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
2636 |
MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
2637 |
MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
2638 |
TBuf<1> toneMark; |
|
2639 |
TBuf<1> delimiter; |
|
2640 |
||
2641 |
toneMark.Append( PinyinToneMap[aToneMark - 1].iValue ); |
|
2642 |
delimiter.Append( KManualDLT ); |
|
2643 |
||
2644 |
for ( TInt i = 0; i < aToneMark; ++i ) |
|
2645 |
{ |
|
2646 |
ptiengine->IncrementToneMark(ETrue); |
|
2647 |
TPtrC ptr = getCurrentLeastDLTSpell(); |
|
2648 |
if ( ( 0 == ptr.Mid( ptr.Length() - 1, 1 ).Compare( toneMark ) ) && |
|
2649 |
( KErrNotFound == ptr.Find( delimiter ) ) |
|
2650 |
) |
|
2651 |
{ |
|
2652 |
return ETrue; |
|
2653 |
} |
|
2654 |
} |
|
2655 |
||
2656 |
||
2657 |
return EFalse; |
|
2658 |
} |
|
2659 |
TPtrC TAknFepInputMiniQwertyPinyinPhraseBase::getCurrentLeastDLTSpell() |
|
2660 |
{ |
|
2661 |
CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
2662 |
CDesC16ArrayFlat* allSpell = new CDesC16ArrayFlat(1); |
|
2663 |
TPtrC currentSpell; |
|
2664 |
TBuf<1> delimiter; |
|
2665 |
TBuf<KMaxKeystrokeCount> preDltPosizeArr; |
|
2666 |
TBuf<KMaxKeystrokeCount> curDltPosizeArr; |
|
2667 |
preDltPosizeArr.FillZ(KMaxKeystrokeCount); |
|
2668 |
preDltPosizeArr.SetLength(KMaxKeystrokeCount); |
|
2669 |
curDltPosizeArr.FillZ(KMaxKeystrokeCount); |
|
2670 |
curDltPosizeArr.SetLength(KMaxKeystrokeCount); |
|
2671 |
||
2672 |
TInt index = 1; |
|
2673 |
delimiter.Append( KManualDLT ); |
|
2674 |
TRAP_IGNORE( ptiengine->GetPhoneticSpellingsL(*allSpell)); |
|
2675 |
TInt allCount = ptiengine->PhoneticSpellingCount(); |
|
2676 |
||
2677 |
||
2678 |
for( TInt i = 0; i < allCount; i++) |
|
2679 |
{ |
|
2680 |
||
2681 |
currentSpell.Set(allSpell->MdcaPoint(i)); |
|
2682 |
TInt dltIndex = 0; |
|
2683 |
curDltPosizeArr.FillZ(KMaxKeystrokeCount); |
|
2684 |
curDltPosizeArr.SetLength(KMaxKeystrokeCount); |
|
2685 |
TInt preIndex = 0; |
|
2686 |
for (TInt j = 0; j < currentSpell.Length(); j++) |
|
2687 |
{ |
|
2688 |
||
2689 |
if (currentSpell.Mid(j, 1).Compare(delimiter) == 0 ) |
|
2690 |
{ |
|
2691 |
curDltPosizeArr[dltIndex] = j - preIndex - 1; |
|
2692 |
preIndex = j; |
|
2693 |
dltIndex++; |
|
2694 |
} |
|
2695 |
else if ((j+1) == currentSpell.Length()) |
|
2696 |
{ |
|
2697 |
curDltPosizeArr[dltIndex] = j - preIndex; |
|
2698 |
} |
|
2699 |
||
2700 |
} |
|
2701 |
||
2702 |
for (TInt k = 0; k < KMaxKeystrokeCount; k++) |
|
2703 |
{ |
|
2704 |
||
2705 |
if (preDltPosizeArr[k] < curDltPosizeArr[k] ) |
|
2706 |
{ |
|
2707 |
preDltPosizeArr.Copy(curDltPosizeArr); |
|
2708 |
index = i + 1; |
|
2709 |
break; |
|
2710 |
} |
|
2711 |
else if (preDltPosizeArr[k] > curDltPosizeArr[k] ) |
|
2712 |
{ |
|
2713 |
break; |
|
2714 |
} |
|
2715 |
} |
|
2716 |
||
2717 |
} |
|
2718 |
||
2719 |
if (allSpell) |
|
2720 |
{ |
|
2721 |
delete allSpell; |
|
2722 |
} |
|
2723 |
ptiengine->SelectPhoneticSpelling( index ); |
|
2724 |
return ptiengine->GetPhoneticSpelling(index); |
|
2725 |
||
2726 |
} |
|
2727 |
// --------------------------------------------------------- |
|
2728 |
// TAknFepInputMiniQwertyPinyinPhraseBase::CheckSpellingAddKeyToPTIL |
|
2729 |
// Check the spelling after add key to the PTI. |
|
2730 |
// --------------------------------------------------------- |
|
2731 |
// |
|
2732 |
TInt TAknFepInputMiniQwertyPinyinPhraseBase::CheckSpellingAddKeyToPTIL( |
|
2733 |
const TDesC& aKeystroke ) |
|
2734 |
{ |
|
2735 |
CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
2736 |
MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
2737 |
MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
2738 |
||
2739 |
TBuf<1> delimiter; |
|
2740 |
TInt keyCode = 0; |
|
2741 |
TInt stringBeforeLength = 0; |
|
2742 |
TInt stringAfterLength = 0; |
|
2743 |
TInt delimiterIndex = 0; |
|
2744 |
delimiter.Append( KManualDLT ); |
|
2745 |
||
2746 |
GetKeystrokeCode( keyCode, aKeystroke ); |
|
2747 |
//get the string before append this keystroke |
|
2748 |
TPtrC ptr = getCurrentLeastDLTSpell(); |
|
2749 |
stringBeforeLength = ptr.Length(); |
|
2750 |
//get the string after append this keystroke |
|
2751 |
ptiengine->AppendKeyPress((TPtiKey)keyCode); |
|
2752 |
TPtrC ptr1 = getCurrentLeastDLTSpell(); |
|
2753 |
stringAfterLength = ptr1.Length(); |
|
2754 |
||
2755 |
if ( stringBeforeLength != stringAfterLength ) |
|
2756 |
{ |
|
2757 |
TPtrC ptr = getCurrentLeastDLTSpell(); |
|
2758 |
if ( KErrNotFound == ptr.Find( delimiter ) ) |
|
2759 |
{ |
|
2760 |
return 0; |
|
2761 |
} |
|
2762 |
else |
|
2763 |
{ |
|
2764 |
delimiterIndex = ptr.Length() - ptr.Find( delimiter ) - 1; |
|
2765 |
return delimiterIndex; |
|
2766 |
} |
|
2767 |
} |
|
2768 |
else |
|
2769 |
{ |
|
2770 |
return -1; |
|
2771 |
} |
|
2772 |
} |
|
2773 |
||
2774 |
// --------------------------------------------------------- |
|
2775 |
// TAknFepInputMiniQwertyPinyinPhraseBase::HandleKeyFromCandidateL |
|
2776 |
// Handle key from candidate. |
|
2777 |
// --------------------------------------------------------- |
|
2778 |
// |
|
2779 |
void TAknFepInputMiniQwertyPinyinPhraseBase::HandleKeyFromCandidateL( |
|
2780 |
TInt aKey, TKeyPressLength /*aLength*/) |
|
2781 |
{ |
|
2782 |
#ifdef RD_INTELLIGENT_TEXT_INPUT |
|
2783 |
// it may be one of the 'valid' numbers.. |
|
2784 |
TPtiKeyboardType keyboardtype = iOwner->FepMan()->KeyboardLayout(); |
|
2785 |
if (EPtiKeyboardQwerty4x10 == keyboardtype || EPtiKeyboardQwerty3x11 |
|
2786 |
== keyboardtype || EPtiKeyboardHalfQwerty == keyboardtype |
|
2787 |
|| EPtiKeyboardCustomQwerty == keyboardtype) |
|
2788 |
{ |
|
2789 |
MPtiLanguage *lang= NULL; |
|
2790 |
RArray <TPtiNumericKeyBinding> keybinding; |
|
2791 |
TBool validnumkey = EFalse; |
|
2792 |
CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
2793 |
||
2794 |
if( ptiengine != NULL ) |
|
2795 |
{ |
|
2796 |
lang = ptiengine->CurrentLanguage(); |
|
2797 |
} |
|
2798 |
if (ptiengine && lang) |
|
2799 |
{ |
|
2800 |
TRAP_IGNORE(ptiengine->GetNumericModeKeysForQwertyL(lang->LanguageCode(), keybinding, keyboardtype)); |
|
2801 |
TInt numericKeysCount = keybinding.Count(); |
|
2802 |
while (numericKeysCount--) |
|
2803 |
{ |
|
2804 |
TPtiNumericKeyBinding numKeyBind = |
|
2805 |
keybinding[numericKeysCount]; |
|
2806 |
if ( (numKeyBind.iChar >= 0x31 && numKeyBind.iChar <= 0x36) |
|
2807 |
&&(aKey == numKeyBind.iKey)) |
|
2808 |
{ |
|
2809 |
validnumkey = ETrue; |
|
2810 |
break; |
|
2811 |
} |
|
2812 |
} |
|
2813 |
} |
|
2814 |
keybinding.Reset(); |
|
2815 |
keybinding.Close(); |
|
2816 |
if ( !validnumkey) |
|
2817 |
{ |
|
2818 |
iOwner->FepMan()->PlaySound(EAvkonSIDErrorTone); |
|
2819 |
return; |
|
2820 |
} |
|
2821 |
} |
|
2822 |
#endif |
|
2823 |
MAknFepUICtrlCandidatePane* candidatePane = UIContainer()->CandidatePane(); |
|
2824 |
||
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2825 |
if ( aKey == EStdKeyDevice3 || aKey |
44 | 2826 |
== EStdKeyEnter) |
2827 |
{ |
|
2828 |
TPtrC text = candidatePane->CurrentPhraseCandidate(); |
|
2829 |
if (text.Length() ) |
|
2830 |
{ |
|
2831 |
if ( !CommitInlineEEPL(text) ) |
|
2832 |
{ |
|
2833 |
DoActionAfterCommit(); |
|
2834 |
} |
|
2835 |
else |
|
2836 |
{ |
|
2837 |
if (CheckFirstGroupStroke() ) |
|
2838 |
{ |
|
2839 |
RefreshUI(EFalse); |
|
2840 |
UIContainer()->CandidatePane()->SelectFirstPhrase(); |
|
2841 |
} |
|
2842 |
else |
|
2843 |
{ |
|
2844 |
UIContainer()->EditPaneWindow()->SetAutoChangeStateFlag(EAutoChangeStateFromCandidate); |
|
2845 |
iOwner->ChangeState(EMiniQwertyEdit); |
|
2846 |
} |
|
2847 |
} |
|
2848 |
} |
|
2849 |
} |
|
2850 |
} |
|
2851 |
||
2852 |
// --------------------------------------------------------- |
|
2853 |
// TAknFepInputMiniQwertyPinyinPhraseBase::CheckAllGroupStroke |
|
2854 |
// check the all group stroke of keystroke. |
|
2855 |
// --------------------------------------------------------- |
|
2856 |
// |
|
2857 |
TBool TAknFepInputMiniQwertyPinyinPhraseBase::CheckAllGroupStroke() |
|
2858 |
{ |
|
2859 |
CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
2860 |
MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
2861 |
MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
2862 |
CDesCArrayFlat* keystroke = editPane->KeystrokeArray(); |
|
2863 |
TInt phraseCount = editPane->PhraseArray()->Count(); |
|
2864 |
TInt keyCode = 0; |
|
2865 |
TInt stringBeforeLength = 0; |
|
2866 |
TInt stringAfterLength = 0; |
|
2867 |
TInt toneMarkCount = KInvalidToneMark; |
|
2868 |
||
2869 |
ClearPtiEngineKeystroke(); |
|
2870 |
||
2871 |
//If there is phrase on the entry pane then the all keystroke is invalid. |
|
2872 |
if ( phraseCount > 0 ) |
|
2873 |
{ |
|
2874 |
return EFalse; |
|
2875 |
} |
|
2876 |
||
2877 |
//If the first keystroke is delimiter or tone mark |
|
2878 |
//then all keystroke is invalid. |
|
2879 |
if ( ( keystroke->Count() == 0 ) |
|
2880 |
|| (CheckSpellingDLT(keystroke->MdcaPoint( 0 ) ) ) |
|
2881 |
|| (KInvalidToneMark != ToneMark(keystroke->MdcaPoint( 0 ) ) ) ) |
|
2882 |
{ |
|
2883 |
return EFalse; |
|
2884 |
} |
|
2885 |
||
2886 |
for (TInt i = 0; i < keystroke->Count(); ++i ) |
|
2887 |
{ |
|
2888 |
toneMarkCount = ToneMark(keystroke->MdcaPoint( i ) ); |
|
2889 |
if ( KInvalidToneMark != toneMarkCount ) |
|
2890 |
{ |
|
2891 |
if ( (CheckSpellingDLT(keystroke->MdcaPoint( i - 1 ) ) ) |
|
2892 |
|| (KInvalidToneMark != ToneMark(keystroke->MdcaPoint( i - 1 ) ) ) ) |
|
2893 |
{ |
|
2894 |
return EFalse; |
|
2895 |
} |
|
2896 |
for (TInt j =0; j < toneMarkCount; ++j) |
|
2897 |
{ |
|
2898 |
ptiengine->IncrementToneMark(ETrue); |
|
2899 |
TPtrC ptr1 = getCurrentLeastDLTSpell(); |
|
2900 |
if (ptr1.Length() > 0) |
|
2901 |
{ |
|
2902 |
if ( 0 == ptr1.Mid( ptr1.Length() - 1 ).Compare(keystroke->MdcaPoint( i ) ) ) |
|
2903 |
{ |
|
2904 |
break; |
|
2905 |
} |
|
2906 |
} |
|
2907 |
} |
|
2908 |
TPtrC ptr = getCurrentLeastDLTSpell(); |
|
2909 |
if ( 0 != ptr.Mid( ptr.Length() - 1, 1 ).Compare(keystroke->MdcaPoint( i ) ) ) |
|
2910 |
{ |
|
2911 |
return EFalse; |
|
2912 |
} |
|
2913 |
} |
|
2914 |
else |
|
2915 |
{ |
|
2916 |
if ( (CheckSpellingDLT(keystroke->MdcaPoint( i ) ) ) |
|
2917 |
&& (KInvalidToneMark != ToneMark(keystroke->MdcaPoint( i - 1 ) ) ) ) |
|
2918 |
{ |
|
2919 |
return EFalse; |
|
2920 |
} |
|
2921 |
GetKeystrokeCode(keyCode, keystroke->MdcaPoint(i) ); |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2922 |
|
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2923 |
// dltBeforeCount is the dlt count before append the key. |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2924 |
// dltAfterCount is the dlt count after append the key. |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2925 |
// In sogou core, after appending a new key, the spell length |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2926 |
// may be the same, but the dlt count will change. |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2927 |
// In this situation, the appended key is valid. |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2928 |
TInt dltBeforeCount = 0; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2929 |
TInt dltAfterCount = 0; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2930 |
TPtrC stringBefore = getCurrentLeastDLTSpell(); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2931 |
stringBeforeLength = stringBefore.Length(); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2932 |
for ( TInt k = 0; k < stringBefore.Length(); k++ ) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2933 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2934 |
if ( CheckSpellingDLT( stringBefore.Mid( k ))) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2935 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2936 |
dltBeforeCount++; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2937 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2938 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2939 |
|
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2940 |
// Append the key. |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2941 |
ptiengine->AppendKeyPress(( TPtiKey )keyCode ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2942 |
|
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2943 |
// Get the dlt count after appending the key. |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2944 |
TPtrC stringAfter = getCurrentLeastDLTSpell(); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2945 |
stringAfterLength = stringAfter.Length(); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2946 |
for ( TInt l = 0; l < stringAfter.Length(); l++ ) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2947 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2948 |
if ( CheckSpellingDLT( stringAfter.Mid( l ))) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2949 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2950 |
dltAfterCount++; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2951 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2952 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2953 |
|
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2954 |
// If the spell length is the same and the dlt count is |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2955 |
// the same, the keystroke is invalid |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2956 |
if (( stringBeforeLength == stringAfterLength ) && |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2957 |
( dltAfterCount == dltBeforeCount )) |
44 | 2958 |
{ |
2959 |
return EFalse; |
|
2960 |
} |
|
2961 |
} |
|
2962 |
} |
|
2963 |
||
2964 |
return ETrue; |
|
2965 |
} |
|
2966 |
||
2967 |
// --------------------------------------------------------- |
|
2968 |
// TAknFepInputMiniQwertyPinyinPhraseBase::DoActionAfterCommit |
|
2969 |
// Do action afer commit, change state to predictive or not. |
|
2970 |
// --------------------------------------------------------- |
|
2971 |
// |
|
2972 |
void TAknFepInputMiniQwertyPinyinPhraseBase::DoActionAfterCommit() |
|
2973 |
{ |
|
2974 |
TRAP_IGNORE( DoActionAfterCommitL() ); |
|
2975 |
} |
|
2976 |
||
2977 |
// --------------------------------------------------------- |
|
2978 |
// TAknFepInputMiniQwertyPinyinPhraseBase::DoActionAfterCommitL |
|
2979 |
// Do action afer commit, change state to predictive or not. |
|
2980 |
// --------------------------------------------------------- |
|
2981 |
// |
|
2982 |
void TAknFepInputMiniQwertyPinyinPhraseBase::DoActionAfterCommitL() |
|
2983 |
{ |
|
2984 |
MAknFepManagerUIInterface* fepMan = iOwner->FepMan(); |
|
2985 |
if (fepMan->IsFlagSet(CAknFepManager::EFlagEditorFull) ) |
|
2986 |
{ |
|
2987 |
UIContainer()->EditPaneWindow()->SetPhraseCreationFlag(EFalse); |
|
2988 |
fepMan->ClearFlag(CAknFepManager::EFlagEditorFull); |
|
2989 |
UIContainer()->EditPaneWindow()->SetPhraseCreationFlag(EFalse); |
|
2990 |
if (UIContainer()->EditPaneWindow()->KeystrokeArray()->Count() != 0) |
|
2991 |
{ |
|
2992 |
UIContainer()->EditPaneWindow()->ResetAllArray(); |
|
2993 |
UIContainer()->EditPaneWindow()->SetPhraseCreationFlag(EFalse); |
|
2994 |
CAknWarningNote* errnote = new( ELeave ) CAknWarningNote(); |
|
2995 |
errnote->SetTone(CAknNoteDialog::EWarningTone); |
|
2996 |
errnote->ExecuteLD(KMaxPhraseNote); |
|
2997 |
} |
|
2998 |
iOwner->FepMan()->TryCloseUiL(); |
|
2999 |
} |
|
3000 |
else |
|
3001 |
{ |
|
3002 |
if (UIContainer()->EditPaneWindow()->KeystrokeArray()->Count() != 0) |
|
3003 |
{ |
|
3004 |
UIContainer()->EditPaneWindow()->ResetAllArray(); |
|
3005 |
UIContainer()->EditPaneWindow()->SetPhraseCreationFlag(EFalse); |
|
3006 |
CAknWarningNote* errnote = new( ELeave ) CAknWarningNote(); |
|
3007 |
errnote->SetTone(CAknNoteDialog::EWarningTone); |
|
3008 |
errnote->ExecuteLD(KMaxPhraseNote); |
|
3009 |
} |
|
3010 |
else |
|
3011 |
{ |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
3012 |
// For sogou core, the predictive is not endless, so when there |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
3013 |
// is no predictive candidates, we should call TryCloseUiL(). |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
3014 |
TBool noCandidates = EFalse; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
3015 |
|
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
3016 |
TInt coreID = iOwner->PtiEngine()->HandleCommandL( EPtiCommandGetCoreID ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
3017 |
if ( TUid::Uid( coreID ) == KPtiSogouCoreUid ) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
3018 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
3019 |
// Get the predictive candidates. |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
3020 |
CDesCArrayFlat* phraseCandidates = new(ELeave) CDesCArrayFlat( 1 ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
3021 |
CleanupStack::PushL ( phraseCandidates ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
3022 |
phraseCandidates->Reset(); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
3023 |
iOwner->PtiEngine()->GetChinesePhraseCandidatesL( *phraseCandidates ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
3024 |
if ( phraseCandidates->Count() == 0 ) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
3025 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
3026 |
noCandidates = ETrue; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
3027 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
3028 |
CleanupStack::PopAndDestroy( phraseCandidates ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
3029 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
3030 |
|
44 | 3031 |
UIContainer()->EditPaneWindow()->ResetAllArray(); |
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
3032 |
if ( !UIContainer()->EditPaneWindow()->GetPhraseCreationFlag() && !noCandidates ) |
44 | 3033 |
{ |
3034 |
UIContainer()->EditPaneWindow()->SetPhraseCreationFlag(EFalse); |
|
3035 |
UIContainer()->EditPaneWindow()->SetChangeState(ETrue); |
|
3036 |
iOwner->ChangeState(EPredictiveCandidate); |
|
3037 |
} |
|
3038 |
else |
|
3039 |
{ |
|
3040 |
UIContainer()->EditPaneWindow()->SetPhraseCreationFlag(EFalse); |
|
3041 |
iOwner->FepMan()->TryCloseUiL(); |
|
3042 |
} |
|
3043 |
} |
|
3044 |
} |
|
3045 |
} |
|
3046 |
// --------------------------------------------------------------------------- |
|
3047 |
// TAknFepInputMiniQwertyPinyinPhraseBase::HandleCommandL |
|
3048 |
// Handling Command |
|
3049 |
// --------------------------------------------------------------------------- |
|
3050 |
// |
|
3051 |
void TAknFepInputMiniQwertyPinyinPhraseBase::HandleCommandL( TInt aCommandId ) |
|
3052 |
{ |
|
3053 |
switch ( aCommandId ) |
|
3054 |
{ |
|
3055 |
// Handle the event frome command. |
|
3056 |
case EAknSoftkeySelect: |
|
3057 |
//case (TUint16)EAknSoftkeySelect: //the Selected in soft CBA |
|
3058 |
HandleCommitL( ); |
|
3059 |
break; |
|
3060 |
default: |
|
3061 |
TAknFepInputStateChineseBase::HandleCommandL( aCommandId ); |
|
3062 |
break; |
|
3063 |
} |
|
3064 |
} |
|
3065 |
// End of file |