|
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: Input mode observer class implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include "emailtrace.h" |
|
21 #include <e32cmn.h> // TUid |
|
22 #include <AknFepInternalCRKeys.h> // KCRUidAknFep, KAknFepPredTxtFlag |
|
23 #include <centralrepository.h> // CRepository |
|
24 #include "FSEmailBuildFlags.h" |
|
25 #include "FreestyleEmailUiInputModeObserver.h" // CFSEmailUiInputModeObserver |
|
26 #include "FreestyleEmailUiCLSListsHandler.h" // CFSEmailUiClsListsHandler |
|
27 |
|
28 #include <CPcsDefs.h> // PCS TKeyboardModes enum |
|
29 |
|
30 _LIT( KErrorMessage, "Input mode observer: wrong callback method."); |
|
31 |
|
32 // ============================ MEMBER FUNCTIONS =============================== |
|
33 |
|
34 // ----------------------------------------------------------------------------- |
|
35 // CFSEmailUiInputModeObserver::NewL |
|
36 // Two-phased constructor. |
|
37 // ----------------------------------------------------------------------------- |
|
38 // |
|
39 CFSEmailUiInputModeObserver* CFSEmailUiInputModeObserver::NewL( CRepository& aCr, CFSEmailUiClsListsHandler& aListHandler ) |
|
40 { |
|
41 FUNC_LOG; |
|
42 CFSEmailUiInputModeObserver* self = new ( ELeave ) CFSEmailUiInputModeObserver( aCr, aListHandler ); |
|
43 CleanupStack::PushL( self ); |
|
44 self->ConstructL(); |
|
45 CleanupStack::Pop( self ); |
|
46 return self; |
|
47 } |
|
48 |
|
49 // ----------------------------------------------------------------------------- |
|
50 // CFSEmailUiInputModeObserver::~CFSEmailUiInputModeObserver |
|
51 // Destructor. |
|
52 // ----------------------------------------------------------------------------- |
|
53 // |
|
54 CFSEmailUiInputModeObserver::~CFSEmailUiInputModeObserver() |
|
55 { |
|
56 FUNC_LOG; |
|
57 if( iCenRepNotifyWrapper ) |
|
58 { |
|
59 iCenRepNotifyWrapper->StopListening(); |
|
60 delete iCenRepNotifyWrapper; |
|
61 } |
|
62 } |
|
63 |
|
64 // ----------------------------------------------------------------------------- |
|
65 // CFSEmailUiInputModeObserver::CFSEmailUiInputModeObserver |
|
66 // Constructor. |
|
67 // ----------------------------------------------------------------------------- |
|
68 // |
|
69 CFSEmailUiInputModeObserver::CFSEmailUiInputModeObserver( CRepository& aCr, CFSEmailUiClsListsHandler& aListHandler ) : |
|
70 iAkvkFepCenRep( aCr ), iClsListHandler( aListHandler ) |
|
71 { |
|
72 FUNC_LOG; |
|
73 // Nothing |
|
74 } |
|
75 |
|
76 |
|
77 // ----------------------------------------------------------------------------- |
|
78 // CFSEmailUiInputModeObserver::ConstructL |
|
79 // Symbian 2nd phase constructor. |
|
80 // ----------------------------------------------------------------------------- |
|
81 // |
|
82 void CFSEmailUiInputModeObserver::ConstructL() |
|
83 { |
|
84 FUNC_LOG; |
|
85 iCenRepNotifyWrapper = CCenRepNotifyHandler::NewL( *this, iAkvkFepCenRep, |
|
86 CCenRepNotifyHandler::EIntKey, KAknFepPredTxtFlag ); |
|
87 iCenRepNotifyWrapper->StartListeningL(); |
|
88 } |
|
89 |
|
90 // callback methods for CenRepNotifyHandler |
|
91 void CFSEmailUiInputModeObserver::HandleNotifyInt( |
|
92 TUint32 aId, TInt aNewValue ) |
|
93 { |
|
94 FUNC_LOG; |
|
95 // set new input mode for matchers through list handler |
|
96 if ( aId == KAknFepPredTxtFlag ) |
|
97 { |
|
98 TKeyboardModes inputMode = EQwerty; |
|
99 if ( aNewValue ) |
|
100 { |
|
101 inputMode = EItut; |
|
102 } |
|
103 |
|
104 TRAP_IGNORE( iClsListHandler.InputModeChangedL( inputMode ) ); |
|
105 } |
|
106 } |
|
107 void CFSEmailUiInputModeObserver::HandleNotifyReal( TUint32 /*aId*/, TReal /*aNewValue*/ ) |
|
108 { |
|
109 FUNC_LOG; |
|
110 User::Panic( KErrorMessage, KErrNotSupported ); // replace error message |
|
111 } |
|
112 void CFSEmailUiInputModeObserver::HandleNotifyString( TUint32 /*aId*/, const TDesC16& /*aNewValue*/ ) |
|
113 { |
|
114 FUNC_LOG; |
|
115 User::Panic( KErrorMessage, KErrNotSupported ); // replace error message |
|
116 } |
|
117 void CFSEmailUiInputModeObserver::HandleNotifyBinary( TUint32 /*id*/, const TDesC8& /*aNewValue*/ ) |
|
118 { |
|
119 FUNC_LOG; |
|
120 User::Panic( KErrorMessage, KErrNotSupported ); // replace error message |
|
121 } |
|
122 void CFSEmailUiInputModeObserver::HandleNotifyGeneric( TUint32 /*aId*/ ) |
|
123 { |
|
124 FUNC_LOG; |
|
125 User::Panic( KErrorMessage, KErrNotSupported ); // replace error message |
|
126 } |
|
127 void CFSEmailUiInputModeObserver::HandleNotifyError( TUint32 /*aId*/, TInt aError, CCenRepNotifyHandler* /*aHandler*/ ) |
|
128 { |
|
129 FUNC_LOG; |
|
130 User::Panic( KErrorMessage, aError ); // replace error message |
|
131 } |
|
132 |
|
133 |
|
134 |
|
135 // End of file |
|
136 |