|
1 /* |
|
2 * Copyright (c) 2002-2009 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: Input mode observer class implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "emailtrace.h" |
|
19 #include "cesmrinputmodeobserver.h" |
|
20 |
|
21 #include "cesmrclslistshandler.h" |
|
22 |
|
23 #include <e32cmn.h> // TUid |
|
24 #include <AknFepInternalCRKeys.h> // KCRUidAknFep, KAknFepPredTxtFlag |
|
25 #include <centralrepository.h> // CRepository |
|
26 |
|
27 #include <CPcsDefs.h> // PCS TKeyboardModes enum |
|
28 #include <eikenv.h> |
|
29 |
|
30 // Unnamed namespace for local definitions |
|
31 namespace{ |
|
32 |
|
33 _LIT( KErrorMessage, "Input mode observer: wrong callback method."); |
|
34 |
|
35 }//namespace |
|
36 |
|
37 // ======== MEMBER FUNCTIONS ======== |
|
38 |
|
39 // ----------------------------------------------------------------------------- |
|
40 // CESMRInputModeObserver::NewL |
|
41 // Two-phased constructor. |
|
42 // ----------------------------------------------------------------------------- |
|
43 // |
|
44 CESMRInputModeObserver* CESMRInputModeObserver::NewL( CRepository& aCr, CESMRClsListsHandler& aListHandler ) |
|
45 { |
|
46 FUNC_LOG; |
|
47 CESMRInputModeObserver* self = new ( ELeave ) CESMRInputModeObserver( aCr, aListHandler ); |
|
48 CleanupStack::PushL( self ); |
|
49 self->ConstructL(); |
|
50 CleanupStack::Pop( self ); |
|
51 return self; |
|
52 } |
|
53 |
|
54 // ----------------------------------------------------------------------------- |
|
55 // CESMRInputModeObserver::~CESMRInputModeObserver |
|
56 // Destructor. |
|
57 // ----------------------------------------------------------------------------- |
|
58 // |
|
59 CESMRInputModeObserver::~CESMRInputModeObserver() |
|
60 { |
|
61 FUNC_LOG; |
|
62 if( iCenRepNotifyWrapper ) |
|
63 { |
|
64 iCenRepNotifyWrapper->StopListening(); |
|
65 delete iCenRepNotifyWrapper; |
|
66 } |
|
67 } |
|
68 |
|
69 // ----------------------------------------------------------------------------- |
|
70 // CESMRInputModeObserver::CESMRInputModeObserver |
|
71 // Constructor. |
|
72 // ----------------------------------------------------------------------------- |
|
73 // |
|
74 CESMRInputModeObserver::CESMRInputModeObserver( CRepository& aCr, CESMRClsListsHandler& aListHandler ) : |
|
75 iAkvkFepCenRep( aCr ), iClsListHandler( aListHandler ) |
|
76 { |
|
77 FUNC_LOG; |
|
78 // Nothing |
|
79 } |
|
80 |
|
81 // ----------------------------------------------------------------------------- |
|
82 // CESMRInputModeObserver::ConstructL |
|
83 // Symbian 2nd phase constructor. |
|
84 // ----------------------------------------------------------------------------- |
|
85 // |
|
86 void CESMRInputModeObserver::ConstructL() |
|
87 { |
|
88 FUNC_LOG; |
|
89 iCenRepNotifyWrapper = CCenRepNotifyHandler::NewL( *this, iAkvkFepCenRep, |
|
90 CCenRepNotifyHandler::EIntKey, KAknFepPredTxtFlag ); |
|
91 iCenRepNotifyWrapper->StartListeningL(); |
|
92 } |
|
93 |
|
94 // callback methods for CenRepNotifyHandler |
|
95 void CESMRInputModeObserver::HandleNotifyInt( TUint32 aId, TInt aNewValue ) |
|
96 { |
|
97 FUNC_LOG; |
|
98 // set new input mode for matchers through list handler |
|
99 if( aId == KAknFepPredTxtFlag ) |
|
100 { |
|
101 TKeyboardModes inputMode = EQwerty; |
|
102 if( aNewValue ) |
|
103 { |
|
104 inputMode = EItut; |
|
105 } |
|
106 |
|
107 TRAPD( error, iClsListHandler.InputModeChangedL( inputMode ) ); |
|
108 if ( error != KErrNone ) |
|
109 { |
|
110 CEikonEnv::Static()-> // codescanner::eikonenvstatic |
|
111 HandleError(error); |
|
112 } |
|
113 } |
|
114 } |
|
115 |
|
116 // ----------------------------------------------------------------------------- |
|
117 // CESMRInputModeObserver::HandleNotifyReal |
|
118 // ----------------------------------------------------------------------------- |
|
119 // |
|
120 void CESMRInputModeObserver::HandleNotifyReal( TUint32 /*aId*/, TReal /*aNewValue*/ ) |
|
121 { |
|
122 FUNC_LOG; |
|
123 User::Panic( KErrorMessage, KErrNotSupported ); |
|
124 } |
|
125 |
|
126 // ----------------------------------------------------------------------------- |
|
127 // CESMRInputModeObserver::HandleNotifyString |
|
128 // ----------------------------------------------------------------------------- |
|
129 // |
|
130 void CESMRInputModeObserver::HandleNotifyString( TUint32 /*aId*/, const TDesC16& /*aNewValue*/ ) |
|
131 { |
|
132 FUNC_LOG; |
|
133 User::Panic( KErrorMessage, KErrNotSupported ); |
|
134 } |
|
135 |
|
136 // ----------------------------------------------------------------------------- |
|
137 // CESMRInputModeObserver::HandleNotifyBinary |
|
138 // ----------------------------------------------------------------------------- |
|
139 // |
|
140 void CESMRInputModeObserver::HandleNotifyBinary( TUint32 /*id*/, const TDesC8& /*aNewValue*/ ) |
|
141 { |
|
142 FUNC_LOG; |
|
143 User::Panic( KErrorMessage, KErrNotSupported ); |
|
144 } |
|
145 |
|
146 // ----------------------------------------------------------------------------- |
|
147 // CESMRInputModeObserver::HandleNotifyGeneric |
|
148 // ----------------------------------------------------------------------------- |
|
149 // |
|
150 void CESMRInputModeObserver::HandleNotifyGeneric( TUint32 /*aId*/ ) |
|
151 { |
|
152 FUNC_LOG; |
|
153 User::Panic( KErrorMessage, KErrNotSupported ); |
|
154 } |
|
155 |
|
156 // ----------------------------------------------------------------------------- |
|
157 // CESMRInputModeObserver::HandleNotifyError |
|
158 // ----------------------------------------------------------------------------- |
|
159 // |
|
160 void CESMRInputModeObserver::HandleNotifyError( TUint32 /*aId*/, TInt aError, CCenRepNotifyHandler* /*aHandler*/ ) |
|
161 { |
|
162 FUNC_LOG; |
|
163 User::Panic( KErrorMessage, aError ); |
|
164 } |
|
165 |
|
166 // End of file |
|
167 |