|
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 TAknFepUiInputStateCompletionPredictiveHiraganaKanji methods. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 // INCLUDE FILES |
|
31 #include "AknFepUiInputStateCompletionPredictiveHiraganaKanji.h" |
|
32 #include "AknFepUIManagerStateInterface.h" // MAknFepUIManagerStateInterface |
|
33 #include "AknFepManagerUIInterface.h" // MAknFepManagerUIInterface |
|
34 #include "AknFepUICtrlCandidatePaneInterface.h" |
|
35 // MAknFepUICtrlCandidatePaneInterface |
|
36 #include "AknFepUICtrlContainerJapanese.h" |
|
37 #include "AknFepManager.h" |
|
38 #include "AknFepGlobalEnums.h" |
|
39 |
|
40 #include <PtiDefs.h> // keys |
|
41 #include <PtiEngine.h> |
|
42 #include <PtiCompositionDataIF.h> // MPtiEngineCompositionDataInterface |
|
43 |
|
44 /** |
|
45 * TAknFepUiInputStateCompletionPredictiveHiraganaKanji class. |
|
46 * |
|
47 */ |
|
48 //============================ MEMBER FUNCTIONS ============================== |
|
49 |
|
50 // --------------------------------------------------------------------------- |
|
51 // TAknFepUiInputStateCompletionPredictiveHiraganaKanji:: |
|
52 // TAknFepUiInputStateCompletionPredictiveHiraganaKanji |
|
53 // C++ default Constructor |
|
54 // --------------------------------------------------------------------------- |
|
55 // |
|
56 TAknFepUiInputStateCompletionPredictiveHiraganaKanji:: |
|
57 TAknFepUiInputStateCompletionPredictiveHiraganaKanji( |
|
58 MAknFepUIManagerStateInterface* aOwner, |
|
59 MAknFepUICtrlContainerJapanese* aUIContainer) |
|
60 :TAknFepUiInputStateCompletionHiraganaKanji(aOwner, aUIContainer) |
|
61 { |
|
62 } |
|
63 |
|
64 // --------------------------------------------------------------------------- |
|
65 // TAknFepUiInputStateCompletionPredictiveHiraganaKanji::HandleNumericShortKeyL |
|
66 // Handling short keypress events of the numeric and the star. |
|
67 // --------------------------------------------------------------------------- |
|
68 // |
|
69 TBool TAknFepUiInputStateCompletionPredictiveHiraganaKanji::HandleNumericShortKeyL(TInt aKey) |
|
70 { |
|
71 CPtiEngine* ptiEngine = iOwner->PtiEngine(); |
|
72 TBool ret = CommitInlineEditingCharacterL(); |
|
73 const MPtiEngineCompositionDataInterface* data = ptiEngine->CompositionData(); |
|
74 TPtrC text = data->ConvertingString(); |
|
75 if (text.Length() > 0) |
|
76 { |
|
77 iOwner->ChangeState(EInitial); |
|
78 iOwner->FepMan()->SimulateKeyEventL(aKey, ETrue); |
|
79 ret = ETrue; |
|
80 } |
|
81 else |
|
82 { |
|
83 iOwner->ChangeState(EInitial); |
|
84 if (iOwner->IsQwerty() && IsQwertyKey(aKey) && aKey != EStdKeySpace) |
|
85 { |
|
86 ret = EFalse; |
|
87 } |
|
88 } |
|
89 |
|
90 return ret; |
|
91 } |
|
92 |
|
93 // --------------------------------------------------------------------------- |
|
94 // TAknFepUiInputStateCompletionPredictiveHiraganaKanji::HandleNumericLongKeyL |
|
95 // Handling Numeric long keypress event |
|
96 // --------------------------------------------------------------------------- |
|
97 // |
|
98 TBool TAknFepUiInputStateCompletionPredictiveHiraganaKanji::HandleNumericLongKeyL(TInt aKey) |
|
99 { |
|
100 TBool ret = EFalse; |
|
101 |
|
102 ret = ProcessNumericLongKeyPressL(aKey); |
|
103 |
|
104 if (ret && iOwner->FepMan()->EditorHasFreeSpace()) |
|
105 { |
|
106 iOwner->ChangeState(ENextWord); |
|
107 } |
|
108 else |
|
109 { |
|
110 MAknFepUICtrlContainerJapanese* uicontainer = UIContainer(); |
|
111 MAknFepUICtrlCandidatePaneInterface* predictivePane = |
|
112 uicontainer->CandidatePane(MAknFepUICtrlContainerJapanese:: |
|
113 EJapanesePredictiveCandidatePane); |
|
114 // Closeing candidate pop-up list |
|
115 predictivePane->HideWindow(); |
|
116 iOwner->ChangeState(EInitial); |
|
117 ret = ETrue; |
|
118 } |
|
119 return ret; |
|
120 } |
|
121 |
|
122 // --------------------------------------------------------------------------- |
|
123 // TAknFepUiInputStateCompletionPredictiveHiraganaKanji::HandleAuxKeyL |
|
124 // Handling auxiliary keypress events including OK and Backspace |
|
125 // --------------------------------------------------------------------------- |
|
126 // |
|
127 TBool TAknFepUiInputStateCompletionPredictiveHiraganaKanji::HandleAuxKeyL(TInt aKey, |
|
128 TKeyPressLength /*aLength*/) |
|
129 { |
|
130 CPtiEngine* ptiEngine = iOwner->PtiEngine(); |
|
131 TBool ret = EFalse; |
|
132 |
|
133 if (aKey == EKeyOK |
|
134 || aKey == EStdKeyDevice3 /* 0xA7 */ |
|
135 || aKey == EStdKeyEnter |
|
136 || aKey == EStdKeyNkpEnter) |
|
137 { |
|
138 TInt index = UIContainer()->CandidatePane(MAknFepUICtrlContainerJapanese:: |
|
139 EJapanesePredictiveCandidatePane)->CurrentItemIndexOfCandidate(); |
|
140 if (index > -1) |
|
141 { |
|
142 ptiEngine->HandleCommandL(EPtiCommandUserActionCompleteCandidate, &index); |
|
143 } |
|
144 else |
|
145 { |
|
146 ptiEngine->HandleCommandL(EPtiCommandUserActionComplete); |
|
147 } |
|
148 |
|
149 UpdateInlineEditingCharacterL(); |
|
150 ret = ETrue; |
|
151 } |
|
152 return ret; |
|
153 } |
|
154 // End of file |