|
1 /* |
|
2 * Copyright (c) 2002-2006 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: Provides the TAknFepInputStateEntryWesternPredictiveJp methods. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 #include "AknFepUiInputStateEntryWesternPredictiveJp.h" |
|
30 #include "AknFepUIManagerStateInterface.h" //MAknFepUIManagerStateInterface |
|
31 #include "AknFepManagerUIInterface.h" //MAknFepManagerUIInterface |
|
32 #include "AknFepManager.h" |
|
33 #include "AknFepPanic.h" |
|
34 #include "AknFepCaseManager.h" |
|
35 |
|
36 #include <PtiEngine.h> //CPtiEngine |
|
37 #include <PtiDefs.h> //keys |
|
38 #include <featmgr.h> //FeatureManager |
|
39 #include <e32keys.h> |
|
40 #include <AknFep.rsg> |
|
41 |
|
42 TAknFepInputStateEntryWesternPredictiveJp:: |
|
43 TAknFepInputStateEntryWesternPredictiveJp(MAknFepUIManagerStateInterface* aOwner) |
|
44 :TAknFepInputStateEntryWesternPredictive(aOwner) |
|
45 { |
|
46 } |
|
47 |
|
48 // --------------------------------------------------------------------------- |
|
49 // Handle Star-key event |
|
50 // --------------------------------------------------------------------------- |
|
51 // |
|
52 TBool TAknFepInputStateEntryWesternPredictiveJp::HandleStarKeyL(TKeyPressLength aLength) |
|
53 { |
|
54 if (aLength == ELongKeyPress) |
|
55 { |
|
56 // Call the parent function |
|
57 return TAknFepInputStateEntryWesternPredictive::HandleStarKeyL(aLength); |
|
58 } |
|
59 |
|
60 // Check whether it is possible to change other cases. |
|
61 if (!iOwner->CaseMan()->IsAbleChangeCase()) |
|
62 { |
|
63 return ETrue; |
|
64 } |
|
65 |
|
66 // Change next case mode (Lower->Upper->Text->Lower) |
|
67 TInt oldCase = iOwner->CaseMan()->CurrentCase(); |
|
68 TInt newCase; |
|
69 switch (oldCase) |
|
70 { |
|
71 default: |
|
72 case EAknEditorLowerCase: |
|
73 newCase = EAknEditorUpperCase; |
|
74 break; |
|
75 case EAknEditorUpperCase: |
|
76 newCase = EAknEditorTextCase; |
|
77 break; |
|
78 case EAknEditorTextCase: |
|
79 newCase = EAknEditorLowerCase; |
|
80 break; |
|
81 } |
|
82 iOwner->CaseMan()->SetCurrentCase(newCase); |
|
83 newCase = iOwner->CaseMan()->CurrentCase(); |
|
84 if (oldCase != newCase) |
|
85 { |
|
86 MAknFepManagerUIInterface* fepMan = iOwner->FepMan(); |
|
87 CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
88 TPtiTextCase caseMode = ptiengine->Case(); |
|
89 TPtrC text = ptiengine->CurrentWord(); |
|
90 HBufC* newText = HBufC::NewLC(text.Length()); |
|
91 TPtr newPtr(newText->Des()); |
|
92 newPtr.Copy(text); |
|
93 switch (newCase) |
|
94 { |
|
95 default: |
|
96 case EAknEditorLowerCase: // For Japanese, T9 lower mode(abc) |
|
97 newPtr.LowerCase(); |
|
98 caseMode = EPtiCaseLower; |
|
99 break; |
|
100 case EAknEditorUpperCase: // For Japanese, T9 upper mode(ABC) |
|
101 newPtr.UpperCase(); |
|
102 caseMode = EPtiCaseUpper; |
|
103 break; |
|
104 case EAknEditorTextCase: // For Japanese, T9 capitalize mode(Abc) |
|
105 newPtr.Capitalize(); |
|
106 caseMode = (newPtr.Length() > 1)? |
|
107 EPtiCaseUpper : EPtiCaseLower; |
|
108 break; |
|
109 } |
|
110 fepMan->UpdateInlineEditL(newPtr, newPtr.Length()); |
|
111 ptiengine->SetCurrentWord(newPtr); |
|
112 ptiengine->SetCase(caseMode); |
|
113 CleanupStack::PopAndDestroy(newText); // newText |
|
114 } |
|
115 return ETrue; |
|
116 } |
|
117 |
|
118 // End of file |