132 User::Panic(_L("CQwertyKeyMap::ArrayIndexToMappedChar"), |
132 User::Panic(_L("CQwertyKeyMap::ArrayIndexToMappedChar"), |
133 KErrOverflow)); |
133 KErrOverflow)); |
134 return iKeyNames.value(static_cast<TKeyId>(aArrayIndex), PAD_CHAR); |
134 return iKeyNames.value(static_cast<TKeyId>(aArrayIndex), PAD_CHAR); |
135 } |
135 } |
136 |
136 |
137 #if !defined(USE_ORBIT_KEYMAP) |
|
138 // ---------------------------------------------------------------------------- |
|
139 // CQwertyKeyMap::UseHardcodedKeyMap |
|
140 // ---------------------------------------------------------------------------- |
|
141 const QChar CQwertyKeyMap::UseHardcodedKeyMap(const QChar input) const |
|
142 { |
|
143 if (input >= 'a' && input <= 'z') |
|
144 { |
|
145 return input; |
|
146 } |
|
147 if (input >= 'A' && input <= 'Z') |
|
148 { |
|
149 return input.toLower(); // Return lowercase letter |
|
150 } |
|
151 if (input == KEY_COLON_NAME || |
|
152 input == KEY_DOT_NAME || |
|
153 input == KEY_DASH_NAME || |
|
154 input == KEY_AT_NAME || |
|
155 input == KEY_QUOTE_NAME || |
|
156 input == KEY_QUESTION_MARK_NAME) |
|
157 { |
|
158 return input; |
|
159 } |
|
160 |
|
161 // TODO: add rest of the keys |
|
162 |
|
163 #if defined(THAI_KEYMAP) |
|
164 // TODO: add Thai key map |
|
165 #endif |
|
166 |
|
167 // Other (unknown) chars |
|
168 return PAD_CHAR; |
|
169 } |
|
170 #endif // #if !defined(USE_ORBIT_KEYMAP) |
|
171 |
|
172 // ---------------------------------------------------------------------------- |
137 // ---------------------------------------------------------------------------- |
173 // CQwertyKeyMap::ComputeValue |
138 // CQwertyKeyMap::ComputeValue |
174 // ---------------------------------------------------------------------------- |
139 // ---------------------------------------------------------------------------- |
175 TInt CQwertyKeyMap::ComputeValue(QString aString, |
140 TInt CQwertyKeyMap::ComputeValue(QString aString, |
176 TBool aUpperLimit, |
141 TBool aUpperLimit, |
213 PRINT2(_L("CQwertyKeyMap::ComputeValue result=0x%lx (%ld decimal)"), value, value); |
178 PRINT2(_L("CQwertyKeyMap::ComputeValue result=0x%lx (%ld decimal)"), value, value); |
214 aValue = QString::number(value); // Convert to decimal value |
179 aValue = QString::number(value); // Convert to decimal value |
215 return KErrNone; |
180 return KErrNone; |
216 } |
181 } |
217 |
182 |
218 #if defined(USE_ORBIT_KEYMAP) |
|
219 // ---------------------------------------------------------------------------- |
183 // ---------------------------------------------------------------------------- |
220 // CQwertyKeyMap::MapKeyNameToValue |
184 // CQwertyKeyMap::MapKeyNameToValue |
221 // ---------------------------------------------------------------------------- |
185 // ---------------------------------------------------------------------------- |
222 bool CQwertyKeyMap::IsValidChar(const QChar aChar) const |
186 bool CQwertyKeyMap::IsValidChar(const QChar aChar) const |
223 { |
187 { |
224 return iKeyValues.contains(aChar); |
188 return iKeyValues.contains(aChar); |
225 } |
189 } |
226 #endif // #if defined(USE_ORBIT_KEYMAP) |
|
227 |
190 |
228 // ---------------------------------------------------------------------------- |
191 // ---------------------------------------------------------------------------- |
229 // CQwertyKeyMap::MapKeyNameToValue |
192 // CQwertyKeyMap::MapKeyNameToValue |
230 // Does the reverse of ArrayIndexToMappedChar() |
193 // Does the reverse of ArrayIndexToMappedChar() |
231 // ---------------------------------------------------------------------------- |
194 // ---------------------------------------------------------------------------- |
254 // that uses iKeyNames, so construct it first |
217 // that uses iKeyNames, so construct it first |
255 TInt err(KErrNone); |
218 TInt err(KErrNone); |
256 QT_TRYCATCH_ERROR(err, ConstructKeyNameMap()); |
219 QT_TRYCATCH_ERROR(err, ConstructKeyNameMap()); |
257 User::LeaveIfError(err); |
220 User::LeaveIfError(err); |
258 |
221 |
259 #if defined(USE_ORBIT_KEYMAP) |
|
260 CPcsKeyMap::ConstructL(HbKeyboardVirtualQwerty); |
222 CPcsKeyMap::ConstructL(HbKeyboardVirtualQwerty); |
261 #else |
|
262 CPcsKeyMap::ConstructL(); |
|
263 #endif |
|
264 |
223 |
265 PRINT(_L("End CQwertyKeyMap::ConstructL")); |
224 PRINT(_L("End CQwertyKeyMap::ConstructL")); |
266 } |
225 } |
267 |
226 |
268 // ---------------------------------------------------------------------------- |
227 // ---------------------------------------------------------------------------- |