|
1 /* |
|
2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0"" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * Provides the TAknFepInputStateCandidateQwertyBase methods. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 #include "AknFepUiInputStateCandidateQwertyBase.h" |
|
31 #include "AknFepUICtrlCandidatePane.h" |
|
32 #include "AknFepUIManagerStateInterface.h" //MAknFepUIManagerStateInterface |
|
33 #include "AknFepManagerUIInterface.h" |
|
34 #include "AknFepManager.h" //FepMan flag |
|
35 |
|
36 #include <PtiEngine.h> //CPtiEngine |
|
37 |
|
38 TAknFepInputStateCandidateQwertyBase::TAknFepInputStateCandidateQwertyBase( |
|
39 MAknFepUIManagerStateInterface* aOwner, |
|
40 MAknFepUICtrlContainerChinese* aUIContainer) |
|
41 :TAknFepInputStateChineseBase(aOwner, aUIContainer) |
|
42 { |
|
43 } |
|
44 |
|
45 TBool TAknFepInputStateCandidateQwertyBase::HandleKeyL(TInt aKey, TKeyPressLength /*aLength*/) |
|
46 { |
|
47 if(aKey == EStdKeyDevice1) |
|
48 { |
|
49 iOwner->FepMan()->TryCloseUiL(); |
|
50 } |
|
51 else if(!( HandleVerticalNavigation(aKey) || HandleHorizontalNavigation(aKey) )) |
|
52 { |
|
53 // it may be one of the 'valid' numbers.. |
|
54 TInt index = MapKeyToIndex(aKey); |
|
55 MAknFepUICtrlCandidatePane* candidatePane = UIContainer()->CandidatePane(); |
|
56 |
|
57 if(candidatePane->SelectIndex(index) || aKey == EStdKeyDevice3 || aKey == EStdKeyEnter) |
|
58 { |
|
59 TPtrC text = candidatePane->CurrentCandidate(); |
|
60 if(text.Length()) |
|
61 { |
|
62 MAknFepManagerUIInterface* fepMan = iOwner->FepMan(); |
|
63 fepMan->NewCharacterL(text); |
|
64 fepMan->CommitInlineEditL(); |
|
65 if (fepMan->IsFlagSet(CAknFepManager::EFlagEditorFull)) |
|
66 { |
|
67 fepMan->ClearFlag(CAknFepManager::EFlagEditorFull); |
|
68 iOwner->FepMan()->TryCloseUiL(); |
|
69 } |
|
70 else |
|
71 { |
|
72 iOwner->ChangeState(EPredictiveInput); |
|
73 } |
|
74 } |
|
75 else |
|
76 { |
|
77 // No candidates available. Back to Entry state. |
|
78 iOwner->ChangeState(EEntry); |
|
79 } |
|
80 } |
|
81 } |
|
82 return ETrue; |
|
83 } |
|
84 |
|
85 TBool TAknFepInputStateCandidateQwertyBase::HandleHorizontalNavigation(TInt aKey) |
|
86 { |
|
87 MAknFepUICtrlCandidatePane* candidatePane = UIContainer()->CandidatePane(); |
|
88 CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
89 TBool response = EFalse; |
|
90 |
|
91 // Do navigation... |
|
92 if (aKey == EStdKeyLeftArrow) |
|
93 { |
|
94 if(!candidatePane->SelectPrev()) |
|
95 { |
|
96 ptiengine->PreviousCandidatePage(); |
|
97 candidatePane->SetCandidateBuffer(ptiengine->CandidatePage()); |
|
98 candidatePane->SelectLast(); |
|
99 } |
|
100 response = ETrue; |
|
101 } |
|
102 else if (aKey == EStdKeyRightArrow) |
|
103 { |
|
104 if(!candidatePane->SelectNext()) |
|
105 { |
|
106 ptiengine->NextCandidatePage(); |
|
107 candidatePane->SetCandidateBuffer(ptiengine->CandidatePage()); |
|
108 candidatePane->SelectFirst(); |
|
109 } |
|
110 response = ETrue; |
|
111 } |
|
112 return response; |
|
113 } |
|
114 |
|
115 TBool TAknFepInputStateCandidateQwertyBase::HandleVerticalNavigation(TInt aKey) |
|
116 { |
|
117 CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
118 |
|
119 if (aKey == EStdKeyDownArrow || aKey == EStdKeySpace) |
|
120 { |
|
121 ptiengine->NextCandidatePage(); |
|
122 } |
|
123 else if (aKey == EStdKeyUpArrow) |
|
124 { |
|
125 ptiengine->PreviousCandidatePage(); |
|
126 } |
|
127 else |
|
128 { |
|
129 return EFalse; |
|
130 } |
|
131 |
|
132 MAknFepUICtrlCandidatePane* candidatePane = UIContainer()->CandidatePane(); |
|
133 candidatePane->SelectFirst(); |
|
134 candidatePane->SetCandidateBuffer(ptiengine->CandidatePage()); |
|
135 return ETrue; |
|
136 } |
|
137 |
|
138 // --------------------------------------------------------------------------- |
|
139 // TAknFepInputStateCandidateQwertyBase::HandleCommandL |
|
140 // Handling Command |
|
141 // --------------------------------------------------------------------------- |
|
142 // |
|
143 void TAknFepInputStateCandidateQwertyBase::HandleCommandL( TInt aCommandId ) |
|
144 { |
|
145 TAknFepInputStateChineseBase::HandleCommandL( aCommandId ); |
|
146 } |
|
147 // End of file |