|
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 CAknFepUIInputStateCandidateQwerty methods. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 #include "AknFepUIManagerStateInterface.h" //MAknFepUIManagerStateInterface |
|
31 #include "AknFepUiCtrlContainerChinese.h" |
|
32 #include "AknFepManagerUIInterface.h" //MAknFepManagerUIInterface |
|
33 #include "AknFepUICtrlCandidatePane.h" |
|
34 #include "AknFepUICtrlInputPane.h" |
|
35 #include "AknFepUiInputStateCandidateQwerty.h" |
|
36 |
|
37 #include "AknFepManager.h" //FepMan flag |
|
38 |
|
39 #include <PtiEngine.h> //CPtiEngine |
|
40 #include <e32keys.h> //keys |
|
41 |
|
42 TAknFepInputStateCandidateQwerty::TAknFepInputStateCandidateQwerty( |
|
43 MAknFepUIManagerStateInterface* aOwner, |
|
44 MAknFepUICtrlContainerChinese* aUIContainer) |
|
45 :TAknFepInputStateCandidateQwertyBase(aOwner, aUIContainer) |
|
46 { |
|
47 } |
|
48 |
|
49 TBool TAknFepInputStateCandidateQwerty::HandleKeyL(TInt aKey, TKeyPressLength /*aLength*/) |
|
50 { |
|
51 if(aKey == EStdKeyDevice1) |
|
52 { |
|
53 iOwner->FepMan()->TryCloseUiL(); |
|
54 } |
|
55 else if(!( HandleVerticalNavigation(aKey) || HandleHorizontalNavigation(aKey) )) |
|
56 { |
|
57 // it may be one of the 'valid' numbers.. |
|
58 TInt index = MapKeyToIndex(aKey); |
|
59 MAknFepUICtrlCandidatePane* candidatePane = UIContainer()->CandidatePane(); |
|
60 |
|
61 if(candidatePane->SelectIndex(index) || aKey == EStdKeyDevice3 || aKey == EStdKeyEnter) |
|
62 { |
|
63 TPtrC text = candidatePane->CurrentCandidate(); |
|
64 if(text.Length()) |
|
65 { |
|
66 MAknFepManagerUIInterface* fepMan = iOwner->FepMan(); |
|
67 fepMan->NewCharacterL(text); |
|
68 fepMan->CommitInlineEditL(); |
|
69 iOwner->PtiEngine()->SetPredictiveChineseChar(text); |
|
70 if (fepMan->IsFlagSet(CAknFepManager::EFlagEditorFull)) |
|
71 { |
|
72 fepMan->ClearFlag(CAknFepManager::EFlagEditorFull); |
|
73 iOwner->FepMan()->TryCloseUiL(); |
|
74 } |
|
75 else |
|
76 { |
|
77 iOwner->ChangeState(EPredictiveCandidate); |
|
78 } |
|
79 } |
|
80 else |
|
81 { |
|
82 // No candidates available. Back to Entry state. |
|
83 iOwner->ChangeState(EEntry); |
|
84 } |
|
85 } |
|
86 } |
|
87 return ETrue; |
|
88 } |
|
89 |
|
90 // --------------------------------------------------------------------------- |
|
91 // TAknFepInputStateCandidateQwerty::HandleCommandL |
|
92 // Handling Command |
|
93 // --------------------------------------------------------------------------- |
|
94 // |
|
95 void TAknFepInputStateCandidateQwerty::HandleCommandL( TInt aCommandId ) |
|
96 { |
|
97 TAknFepInputStateChineseBase::HandleCommandL( aCommandId ); |
|
98 } |
|
99 // End of file |