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 iQwertyMode = GetQwertyMode(); |
|
48 iKeyboard = GetKeyboard(); |
|
49 } |
|
50 |
|
51 // ----------------------------------------------------------------------------- |
|
52 // CPhoneQwertyModeMonitor::NewL |
|
53 // ----------------------------------------------------------------------------- |
|
54 // |
|
55 CPhoneQwertyModeMonitor* CPhoneQwertyModeMonitor::NewL() |
|
56 { |
|
57 CPhoneQwertyModeMonitor* self = |
|
58 new (ELeave) CPhoneQwertyModeMonitor(); |
|
59 |
|
60 CleanupStack::PushL( self ); |
|
61 self->ConstructL(); |
|
62 CleanupStack::Pop( self ); |
|
63 |
|
64 return self; |
|
65 } |
|
66 |
|
67 // Destructor |
|
68 CPhoneQwertyModeMonitor::~CPhoneQwertyModeMonitor() |
|
69 { |
|
70 iObserverArray.Reset(); |
|
71 } |
|
72 |
|
73 // ----------------------------------------------------------------------------- |
|
74 // CPhoneQwertyModeMonitor::AddObserverL |
|
75 // ----------------------------------------------------------------------------- |
|
76 // |
|
77 void CPhoneQwertyModeMonitor::AddObserverL( |
|
78 MPhoneQwertyModeObserver& aObserver ) |
|
79 { |
|
80 if ( iObserverArray.Find( &aObserver ) != KErrNone ) |
|
81 { |
|
82 User::LeaveIfError( iObserverArray.Append( &aObserver ) ); |
|
83 } |
|
84 } |
|
85 |
|
86 // ----------------------------------------------------------------------------- |
|
87 // CPhoneQwertyModeMonitor::RemoveObserver |
|
88 // ----------------------------------------------------------------------------- |
|
89 // |
|
90 void CPhoneQwertyModeMonitor::RemoveObserver( |
|
91 MPhoneQwertyModeObserver& aObserver ) |
|
92 { |
|
93 TInt index; |
|
94 if ( iObserverArray.FindInAddressOrder( &aObserver, index ) == KErrNone ) |
|
95 { |
|
96 iObserverArray.Remove( index ); |
|
97 } |
|
98 } |
|
99 |
|
100 // ----------------------------------------------------------- |
|
101 // CPhoneQwertyModeMonitor::HandlePropertyChangedL |
|
102 // ----------------------------------------------------------- |
|
103 // |
|
104 void CPhoneQwertyModeMonitor::HandlePropertyChangedL( |
|
105 const TUid& aCategory, |
|
106 const TUint aKey, |
|
107 const TInt aValue ) |
|
108 { |
|
109 __LOGMETHODSTARTEND(EPhoneControl, "CPhoneQwertyModeMonitor::HandlePropertyChangedL( ) "); |
|
110 if ( aCategory == KCRUidAvkon ) |
|
111 { |
|
112 if ( aKey == KAknQwertyInputModeActive ) |
|
113 { |
|
114 iQwertyMode = aValue; |
|
115 |
|
116 for ( TInt i = 0; i < iObserverArray.Count(); i++ ) |
|
117 { |
|
118 iObserverArray[ i ]->HandleQwertyModeChange( |
|
119 iQwertyMode ); |
|
120 } |
|
121 } |
|
122 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
123 else if ( aKey == KAknKeyBoardLayout ) |
|
124 { |
|
125 for ( TInt i = 0; i < iObserverArray.Count(); i++ ) |
|
126 { |
|
127 iKeyboard = aValue; |
|
128 iObserverArray[ i ]->HandleKeyboardLayoutChange(); |
|
129 } |
|
130 } |
|
131 #endif |
|
132 } |
|
133 } |
|
134 |
|
135 // ----------------------------------------------------------------------------- |
|
136 // CPhoneQwertyModeMonitor::QwertyMode |
|
137 // ----------------------------------------------------------------------------- |
|
138 // |
|
139 TInt CPhoneQwertyModeMonitor::QwertyMode() const |
|
140 { |
|
141 return iQwertyMode; |
|
142 } |
|
143 |
|
144 // ----------------------------------------------------------------------------- |
|
145 // CPhoneQwertyModeMonitor::Keyboard |
|
146 // ----------------------------------------------------------------------------- |
|
147 // |
|
148 TInt CPhoneQwertyModeMonitor::Keyboard() const |
|
149 { |
|
150 return iKeyboard; |
|
151 } |
|
152 |
|
153 // ----------------------------------------------------------------------------- |
|
154 // CPhoneQwertyModeMonitor::GetQwertyMode |
|
155 // ----------------------------------------------------------------------------- |
|
156 // |
|
157 TInt CPhoneQwertyModeMonitor::GetQwertyMode() const |
|
158 { |
|
159 // Get call state. |
|
160 /*TInt qwertyMode( CPhonePubSubProxy::Instance()->Value( |
|
161 KCRUidAvkon, |
|
162 KAknQwertyInputModeActive ) );*/ |
|
163 TInt qwertyMode(0); |
|
164 |
|
165 return qwertyMode; |
|
166 } |
|
167 |
|
168 // ----------------------------------------------------------------------------- |
|
169 // CPhoneQwertyModeMonitor::GetQwertyMode |
|
170 // ----------------------------------------------------------------------------- |
|
171 // |
|
172 TInt CPhoneQwertyModeMonitor::GetKeyboard() const |
|
173 { |
|
174 TInt keyboard(0); |
|
175 return keyboard; |
|
176 } |
|
177 |
|
178 // End of File |
|
179 |
|