182 } |
182 } |
183 |
183 |
184 |
184 |
185 TBool CQwertyPredictiveSearchTable::IsValidChar(const QChar aChar) const |
185 TBool CQwertyPredictiveSearchTable::IsValidChar(const QChar aChar) const |
186 { |
186 { |
187 #if defined(USE_ORBIT_KEYMAP) |
|
188 return static_cast<CQwertyKeyMap*>(iKeyMap)->IsValidChar(aChar); |
187 return static_cast<CQwertyKeyMap*>(iKeyMap)->IsValidChar(aChar); |
189 #else |
|
190 const QChar PAD_CHAR = '!'; // This is a hack, must have same value as in cqwertykeymap.cpp |
|
191 return static_cast<CQwertyKeyMap*>(iKeyMap)->UseHardcodedKeyMap(aChar) != PAD_CHAR; |
|
192 #endif |
|
193 } |
188 } |
194 |
189 |
195 |
190 |
196 HBufC* CQwertyPredictiveSearchTable::TableNameL(const QChar aCh) const |
191 HBufC* CQwertyPredictiveSearchTable::TableNameL(const QChar aCh) const |
197 { |
192 { |
258 |
253 |
259 /** |
254 /** |
260 * Fetch up to 3 mail addresses |
255 * Fetch up to 3 mail addresses |
261 */ |
256 */ |
262 QStringList CQwertyPredictiveSearchTable::GetTableSpecificFields( |
257 QStringList CQwertyPredictiveSearchTable::GetTableSpecificFields( |
263 const CContactItem& aItem, |
258 const CContactItem& aItem) const |
264 TBool& aMandatoryFieldsPresent) const |
|
265 { |
259 { |
266 PRINT(_L("CQwertyPredictiveSearchTable::GetTableSpecificFields")); |
260 PRINT(_L("CQwertyPredictiveSearchTable::GetTableSpecificFields")); |
267 |
261 |
268 QStringList mailAddresses; |
262 QStringList mailAddresses; |
269 |
263 |
270 // Check that the contact item is a card, own card or ICC entry. |
264 // Check the contact item is a card, own card or ICC entry. |
271 const TUid KType = aItem.Type(); |
265 const TUid KType = aItem.Type(); |
272 if (KType != KUidContactCard && |
266 if (KType != KUidContactCard && |
273 KType != KUidContactOwnCard && |
267 KType != KUidContactOwnCard && |
274 KType != KUidContactICCEntry) |
268 KType != KUidContactICCEntry) |
275 { |
269 { |
276 aMandatoryFieldsPresent = EFalse; |
|
277 return mailAddresses; |
270 return mailAddresses; |
278 } |
271 } |
279 |
272 |
280 TInt storedAddressCount(0); |
273 TInt storedAddressCount(0); |
281 for (TInt i = aItem.CardFields().Count(); |
274 for (TInt i = aItem.CardFields().Count(); |
299 const TInt KLogLength = 40; |
292 const TInt KLogLength = 40; |
300 TBuf<KLogLength> log(address.left(KLogLength).utf16()); |
293 TBuf<KLogLength> log(address.left(KLogLength).utf16()); |
301 PRINT1(_L("prefix removed, mail='%S'"), &log); |
294 PRINT1(_L("prefix removed, mail='%S'"), &log); |
302 #endif |
295 #endif |
303 } |
296 } |
304 mailAddresses.append(iKeyMap->GetMappedString(address)); |
297 // Ignore mail addresses that begin with unmapped character |
305 ++storedAddressCount; |
298 QString mapped = iKeyMap->GetMappedString(address); |
|
299 if (mapped.length() > 0 && IsValidChar(mapped[0])) |
|
300 { |
|
301 mailAddresses.append(mapped); |
|
302 ++storedAddressCount; |
|
303 } |
|
304 #if defined(WRITE_PRED_SEARCH_LOGS) |
|
305 else |
|
306 { |
|
307 PRINT(_L("mail begins with unmapped char, ignore mail")); |
|
308 } |
|
309 #endif |
306 } |
310 } |
307 } |
311 } |
308 PRINT1(_L("CQwertyPredictiveSearchTable::GetTableSpecificFields found %d mail addrs"), |
312 PRINT1(_L("CQwertyPredictiveSearchTable::GetTableSpecificFields found %d mail addrs"), |
309 mailAddresses.count()); |
313 mailAddresses.count()); |
310 aMandatoryFieldsPresent = (mailAddresses.count() > 0); |
|
311 return mailAddresses; |
314 return mailAddresses; |
312 } |
315 } |
313 |
316 |
314 |
317 |
315 /** |
318 /** |