44
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-2004 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 TAknFepUiInputStateEntryHiraganaKanji methods.
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
|
|
24 |
|
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
// INCLUDE FILES
|
|
31 |
#include "AknFepUiInputStateEntryHiraganaKanji.h"
|
|
32 |
#include "AknFepUIManagerStateInterface.h" // MAknFepUIManagerStateInterface
|
|
33 |
#include "AknFepManagerUIInterface.h" // MAknFepManagerUIInterface
|
|
34 |
#include "AknFepGlobalEnums.h"
|
|
35 |
|
|
36 |
#include <PtiDefs.h> // keys
|
|
37 |
#include <PtiEngine.h>
|
|
38 |
#include <PtiCompositionDataIF.h> // MPtiEngineCompositionDataInterface
|
|
39 |
#include <aknfep.rsg>
|
|
40 |
|
|
41 |
// CONSTANTS
|
|
42 |
|
|
43 |
/**
|
|
44 |
* TAknFepUiInputStateEntryHiraganaKanji class.
|
|
45 |
*
|
|
46 |
*/
|
|
47 |
|
|
48 |
//============================ MEMBER FUNCTIONS ==============================
|
|
49 |
|
|
50 |
// ---------------------------------------------------------------------------
|
|
51 |
// TAknFepUiInputStateEntryHiraganaKanji::TAknFepUiInputStateEntryHiraganaKanji
|
|
52 |
// Constractor
|
|
53 |
// ---------------------------------------------------------------------------
|
|
54 |
//
|
|
55 |
|
|
56 |
TAknFepUiInputStateEntryHiraganaKanji::TAknFepUiInputStateEntryHiraganaKanji(
|
|
57 |
MAknFepUIManagerStateInterface* aOwner,
|
|
58 |
MAknFepUICtrlContainerJapanese* aUIContainer)
|
|
59 |
:TAknFepUiInputStateEntryJapaneseMultitap(aOwner, aUIContainer)
|
|
60 |
{
|
|
61 |
}
|
|
62 |
|
|
63 |
// ---------------------------------------------------------------------------
|
|
64 |
// TAknFepUiInputStateEntryHiraganaKanji::InitializeStateL
|
|
65 |
// Initialize State
|
|
66 |
// ---------------------------------------------------------------------------
|
|
67 |
//
|
|
68 |
void TAknFepUiInputStateEntryHiraganaKanji::InitializeStateL()
|
|
69 |
{
|
|
70 |
// Set on Underline visibility in inline editing
|
|
71 |
iOwner->SetInlineEditUnderlineVisibility(ETrue);
|
|
72 |
|
|
73 |
// Update of CBA
|
|
74 |
MAknFepManagerUIInterface* fepMan = iOwner->FepMan();
|
|
75 |
TInt newResource = R_AKNFEP_SOFTKEYS_PREDICT_OTHER_COMMIT;
|
|
76 |
if(!fepMan->IsAbleToChangePrediction())
|
|
77 |
{
|
|
78 |
newResource = R_AKNFEP_SOFTKEYS_EMPTY_OTHER_COMMIT;
|
|
79 |
}
|
|
80 |
|
|
81 |
fepMan->UpdateCbaL(newResource);
|
|
82 |
}
|
|
83 |
|
|
84 |
// ---------------------------------------------------------------------------
|
|
85 |
// TAknFepUiInputStateEntryHiraganaKanji::HandleNaviKeyL
|
|
86 |
// Handling Navigate keypress event
|
|
87 |
// ---------------------------------------------------------------------------
|
|
88 |
//
|
|
89 |
TBool TAknFepUiInputStateEntryHiraganaKanji::HandleNaviKeyL(TInt aKey,
|
|
90 |
TKeyPressLength /*aLength*/)
|
|
91 |
{
|
|
92 |
TBool ret = EFalse;
|
|
93 |
MAknFepManagerUIInterface* fepMan = iOwner->FepMan();
|
|
94 |
CPtiEngine* ptiEngine = iOwner->PtiEngine();
|
|
95 |
TPtiEngineCommand ptiCommand = EPtiCommandNone;
|
|
96 |
|
|
97 |
switch(aKey)
|
|
98 |
{
|
|
99 |
case EKeyLeftArrow:
|
|
100 |
case EStdKeyLeftArrow: /* 0x0e */
|
|
101 |
{
|
|
102 |
fepMan->SetInlineEditingCursorVisibilityL(ETrue);
|
|
103 |
ptiCommand = EPtiCommandUserActionLeft;
|
|
104 |
}
|
|
105 |
break;
|
|
106 |
case EKeyRightArrow:
|
|
107 |
case EStdKeyRightArrow: /* 0x0f */
|
|
108 |
{
|
|
109 |
fepMan->SetInlineEditingCursorVisibilityL(ETrue);
|
|
110 |
ptiCommand = EPtiCommandUserActionRight;
|
|
111 |
}
|
|
112 |
break;
|
|
113 |
case EKeyDownArrow:
|
|
114 |
case EStdKeyDownArrow: /* 0x11 */
|
|
115 |
case EStdKeySpace:
|
|
116 |
{
|
|
117 |
ptiCommand = EPtiCommandUserActionConvert;
|
|
118 |
}
|
|
119 |
break;
|
|
120 |
case EKeyUpArrow:
|
|
121 |
case EStdKeyUpArrow: /* 0x10 */
|
|
122 |
{
|
|
123 |
ptiCommand = EPtiCommandUserActionPrevious;
|
|
124 |
}
|
|
125 |
break;
|
|
126 |
default:
|
|
127 |
break;
|
|
128 |
}
|
|
129 |
ptiEngine->HandleCommandL(ptiCommand);
|
|
130 |
UpdateInlineEditingCharacterL();
|
|
131 |
const MPtiEngineCompositionDataInterface* data = ptiEngine->CompositionData();
|
|
132 |
TPtrC text = data->ConvertingString();
|
|
133 |
if (text.Length() > 0)
|
|
134 |
{
|
|
135 |
switch(aKey)
|
|
136 |
{
|
|
137 |
case EKeyDownArrow:
|
|
138 |
case EStdKeyDownArrow: /* 0x11 */
|
|
139 |
case EKeyUpArrow:
|
|
140 |
case EStdKeyUpArrow: /* 0x10 */
|
|
141 |
case EStdKeySpace:
|
|
142 |
{
|
|
143 |
iOwner->ChangeState(EConversion);
|
|
144 |
// Set OFF Cursor unvisibility
|
|
145 |
fepMan->SetInlineEditingCursorVisibilityL(EFalse);
|
|
146 |
}
|
|
147 |
break;
|
|
148 |
default:
|
|
149 |
break;
|
|
150 |
}
|
|
151 |
ret = ETrue;
|
|
152 |
}
|
|
153 |
|
|
154 |
return ret;
|
|
155 |
}
|
|
156 |
|
|
157 |
|
|
158 |
TBool TAknFepUiInputStateEntryHiraganaKanji::HandleNumericShortKeyL(TInt aKey)
|
|
159 |
{
|
|
160 |
CPtiEngine* ptiEngine = iOwner->PtiEngine();
|
|
161 |
const MPtiEngineCompositionDataInterface* data = ptiEngine->CompositionData();
|
|
162 |
TPtrC text = data->ConvertingString();
|
|
163 |
TBool ret = EFalse;
|
|
164 |
|
|
165 |
if (aKey == EStdKeySpace
|
|
166 |
&& text.Length() > 0)
|
|
167 |
{
|
|
168 |
ret = HandleNaviKeyL(aKey, EShortKeyPress);
|
|
169 |
}
|
|
170 |
else
|
|
171 |
{
|
|
172 |
ret = TAknFepUiInputStateEntryJapaneseMultitap::HandleNumericShortKeyL(aKey);
|
|
173 |
}
|
|
174 |
return ret;
|
|
175 |
}
|
|
176 |
|
|
177 |
// ---------------------------------------------------------------------------
|
|
178 |
// TAknFepUiInputStateEntryHiraganaKanji::HandleCommandL
|
|
179 |
// Handling Command
|
|
180 |
// ---------------------------------------------------------------------------
|
|
181 |
//
|
|
182 |
void TAknFepUiInputStateEntryHiraganaKanji::
|
|
183 |
HandleCommandL(TInt aCommandId)
|
|
184 |
{
|
|
185 |
switch (aCommandId)
|
|
186 |
{
|
|
187 |
case EAknFepSoftkeyOtherModes:
|
|
188 |
{
|
|
189 |
// Change the status to Retroactive input
|
|
190 |
iOwner->ChangeState(ECandidateRetroActive);
|
|
191 |
}
|
|
192 |
break;
|
|
193 |
case EAknFepSoftkeyPredictiveOn:
|
|
194 |
{
|
|
195 |
MAknFepManagerUIInterface* fepMan = iOwner->FepMan();
|
|
196 |
CPtiEngine* ptiEngine = iOwner->PtiEngine();
|
|
197 |
|
|
198 |
// Update of inline editing characters
|
|
199 |
const MPtiEngineCompositionDataInterface* data = ptiEngine->CompositionData();
|
|
200 |
TPtrC text = data->CompletedString();
|
|
201 |
TPtrC text2 = data->ConvertingString();
|
|
202 |
if (text.Length() >0)
|
|
203 |
{
|
|
204 |
iOwner->ChangeState(EMultiCompletion);
|
|
205 |
fepMan->CommitInlineEditL(text, text.Length());
|
|
206 |
if (fepMan->EditorHasFreeSpace())
|
|
207 |
{
|
|
208 |
iOwner->ChangeState(ENextWord);
|
|
209 |
}
|
|
210 |
else
|
|
211 |
{
|
|
212 |
CloseUI();
|
|
213 |
iOwner->ChangeState(EInitial);
|
|
214 |
}
|
|
215 |
}
|
|
216 |
else if (text2.Length() > 0)
|
|
217 |
{
|
|
218 |
// Change to ConversionState
|
|
219 |
iOwner->ChangeState(EPredictiveInput);
|
|
220 |
fepMan->UpdateInlineEditL(text2, text2.Length());
|
|
221 |
}
|
|
222 |
}
|
|
223 |
break;
|
|
224 |
default:
|
|
225 |
TAknFepUiInputStateEntryJapaneseMultitap::HandleCommandL(aCommandId);
|
|
226 |
break;
|
|
227 |
}
|
|
228 |
}
|
|
229 |
|
|
230 |
// End of file
|