|
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: Qwerty Mode Monitor. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <bautils.h> |
|
21 #include <AvkonInternalCRKeys.h> |
|
22 #include <e32property.h> |
|
23 #include <PSVariables.h> |
|
24 #include <bldvariant.hrh> |
|
25 |
|
26 #include "cphoneqwertymodemonitor.h" |
|
27 #include "mphoneqwertymodeobserver.h" |
|
28 #include "phonelogger.h" |
|
29 #include "cphonepubsubproxy.h" |
|
30 |
|
31 |
|
32 // ============================ MEMBER FUNCTIONS =============================== |
|
33 |
|
34 // C++ constructor can NOT contain any code, that |
|
35 // might leave. |
|
36 // |
|
37 CPhoneQwertyModeMonitor::CPhoneQwertyModeMonitor() |
|
38 { |
|
39 } |
|
40 |
|
41 // --------------------------------------------------------- |
|
42 // CPhoneQwertyModeMonitor::ConstructL |
|
43 // --------------------------------------------------------- |
|
44 // |
|
45 void CPhoneQwertyModeMonitor::ConstructL() |
|
46 { |
|
47 // Current Call state. |
|
48 iQwertyMode = GetQwertyMode(); |
|
49 |
|
50 CPhonePubSubProxy::Instance()->NotifyChangeL( |
|
51 KCRUidAvkon, |
|
52 KAknQwertyInputModeActive, |
|
53 this ); |
|
54 |
|
55 iKeyboard = GetKeyboard(); |
|
56 |
|
57 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
58 CPhonePubSubProxy::Instance()->NotifyChangeL( |
|
59 KCRUidAvkon, |
|
60 KAknKeyBoardLayout, |
|
61 this ); |
|
62 #endif |
|
63 } |
|
64 |
|
65 // ----------------------------------------------------------------------------- |
|
66 // CPhoneQwertyModeMonitor::NewL |
|
67 // ----------------------------------------------------------------------------- |
|
68 // |
|
69 CPhoneQwertyModeMonitor* CPhoneQwertyModeMonitor::NewL() |
|
70 { |
|
71 CPhoneQwertyModeMonitor* self = |
|
72 new (ELeave) CPhoneQwertyModeMonitor(); |
|
73 |
|
74 CleanupStack::PushL( self ); |
|
75 self->ConstructL(); |
|
76 CleanupStack::Pop( self ); |
|
77 |
|
78 return self; |
|
79 } |
|
80 |
|
81 // Destructor |
|
82 CPhoneQwertyModeMonitor::~CPhoneQwertyModeMonitor() |
|
83 { |
|
84 iObserverArray.Reset(); |
|
85 } |
|
86 |
|
87 // ----------------------------------------------------------------------------- |
|
88 // CPhoneQwertyModeMonitor::AddObserverL |
|
89 // ----------------------------------------------------------------------------- |
|
90 // |
|
91 void CPhoneQwertyModeMonitor::AddObserverL( |
|
92 MPhoneQwertyModeObserver& aObserver ) |
|
93 { |
|
94 if ( iObserverArray.Find( &aObserver ) != KErrNone ) |
|
95 { |
|
96 User::LeaveIfError( iObserverArray.Append( &aObserver ) ); |
|
97 } |
|
98 } |
|
99 |
|
100 // ----------------------------------------------------------------------------- |
|
101 // CPhoneQwertyModeMonitor::RemoveObserver |
|
102 // ----------------------------------------------------------------------------- |
|
103 // |
|
104 void CPhoneQwertyModeMonitor::RemoveObserver( |
|
105 MPhoneQwertyModeObserver& aObserver ) |
|
106 { |
|
107 TInt index; |
|
108 if ( iObserverArray.FindInAddressOrder( &aObserver, index ) == KErrNone ) |
|
109 { |
|
110 iObserverArray.Remove( index ); |
|
111 } |
|
112 } |
|
113 |
|
114 // ----------------------------------------------------------- |
|
115 // CPhoneQwertyModeMonitor::HandlePropertyChangedL |
|
116 // ----------------------------------------------------------- |
|
117 // |
|
118 void CPhoneQwertyModeMonitor::HandlePropertyChangedL( |
|
119 const TUid& aCategory, |
|
120 const TUint aKey, |
|
121 const TInt aValue ) |
|
122 { |
|
123 __LOGMETHODSTARTEND(EPhoneControl, "CPhoneQwertyModeMonitor::HandlePropertyChangedL( ) "); |
|
124 if ( aCategory == KCRUidAvkon ) |
|
125 { |
|
126 if ( aKey == KAknQwertyInputModeActive ) |
|
127 { |
|
128 iQwertyMode = aValue; |
|
129 |
|
130 for ( TInt i = 0; i < iObserverArray.Count(); i++ ) |
|
131 { |
|
132 iObserverArray[ i ]->HandleQwertyModeChange( |
|
133 iQwertyMode ); |
|
134 } |
|
135 } |
|
136 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
137 else if ( aKey == KAknKeyBoardLayout ) |
|
138 { |
|
139 for ( TInt i = 0; i < iObserverArray.Count(); i++ ) |
|
140 { |
|
141 iKeyboard = aValue; |
|
142 iObserverArray[ i ]->HandleKeyboardLayoutChange(); |
|
143 } |
|
144 } |
|
145 #endif |
|
146 } |
|
147 } |
|
148 |
|
149 // ----------------------------------------------------------------------------- |
|
150 // CPhoneQwertyModeMonitor::QwertyMode |
|
151 // ----------------------------------------------------------------------------- |
|
152 // |
|
153 TInt CPhoneQwertyModeMonitor::QwertyMode() const |
|
154 { |
|
155 return iQwertyMode; |
|
156 } |
|
157 |
|
158 // ----------------------------------------------------------------------------- |
|
159 // CPhoneQwertyModeMonitor::Keyboard |
|
160 // ----------------------------------------------------------------------------- |
|
161 // |
|
162 TInt CPhoneQwertyModeMonitor::Keyboard() const |
|
163 { |
|
164 return iKeyboard; |
|
165 } |
|
166 |
|
167 // ----------------------------------------------------------------------------- |
|
168 // CPhoneQwertyModeMonitor::GetQwertyMode |
|
169 // ----------------------------------------------------------------------------- |
|
170 // |
|
171 TInt CPhoneQwertyModeMonitor::GetQwertyMode() const |
|
172 { |
|
173 // Get call state. |
|
174 TInt qwertyMode( CPhonePubSubProxy::Instance()->Value( |
|
175 KCRUidAvkon, |
|
176 KAknQwertyInputModeActive ) ); |
|
177 |
|
178 return qwertyMode; |
|
179 } |
|
180 |
|
181 // ----------------------------------------------------------------------------- |
|
182 // CPhoneQwertyModeMonitor::GetQwertyMode |
|
183 // ----------------------------------------------------------------------------- |
|
184 // |
|
185 TInt CPhoneQwertyModeMonitor::GetKeyboard() const |
|
186 { |
|
187 // Get call state. |
|
188 TInt keyboard( CPhonePubSubProxy::Instance()->Value( |
|
189 KCRUidAvkon, |
|
190 KAknKeyBoardLayout ) ); |
|
191 |
|
192 return keyboard; |
|
193 } |
|
194 |
|
195 // End of File |
|
196 |