plugins/contacts/symbian/contactsmodel/cntplsql/src/cpplpredictivesearchtable.cpp
changeset 5 603d3f8b6302
parent 0 876b1a06bc25
--- a/plugins/contacts/symbian/contactsmodel/cntplsql/src/cpplpredictivesearchtable.cpp	Fri Sep 17 08:34:34 2010 +0300
+++ b/plugins/contacts/symbian/contactsmodel/cntplsql/src/cpplpredictivesearchtable.cpp	Mon Oct 04 01:37:06 2010 +0300
@@ -20,6 +20,8 @@
 #include "cpcskeymap.h"
 #include "cntitem.h"
 #include <QStringList>
+// This macro suppresses log writes
+//#define NO_PRED_SEARCH_LOGS
 #include "predictivesearchlog.h"
 
 
@@ -95,15 +97,19 @@
 Default implementation returns empty list.
 */
 QStringList CPplPredictiveSearchTableBase::GetTableSpecificFields(
-	const CContactItem& /*aItem*/,
-	TBool& aMandatoryFieldsPresent) const
+	const CContactItem& /*aItem*/) const
 	{
-	aMandatoryFieldsPresent = ETrue;
 	QStringList emptyList;
 	return emptyList;
 	}
 
 
+const CPcsKeyMap* CPplPredictiveSearchTableBase::KeyMap() const
+	{
+	return iKeyMap;
+	}
+
+
 HBufC* CPplPredictiveSearchTableBase::GetNextTableNameL(QList<QChar>& aTables) const
 	{
 	HBufC* tableName(NULL);
@@ -183,6 +189,9 @@
 // Insert a contact to predictive search tables.
 // Write contact's all tokens to each associate pred.search table.
 // E.g. if FN="11 22" LN="2 333", write "11","22","2" and "333" to tables 1, 2 and 3.
+//
+// Store also contacts that have a mail address beginning by an unknown character
+// as the contact can still be searched by first name or last name.
 void CPplPredictiveSearchTableBase::WriteToDbL(const CContactItem& aItem)
 	{
 	PRINT(_L("CPplPredictiveSearchTableBase::WriteToDbL"));
@@ -196,14 +205,9 @@
 	QStringList tokens;
 	QList<QChar> tables;
 	QT_TRYCATCH_LEAVING({
-		TBool mandatoryFieldsPresent(EFalse);
-		QStringList tableSpecificFields =
-			GetTableSpecificFields(aItem, mandatoryFieldsPresent);
-		if (mandatoryFieldsPresent)
-			{
-			tokens = GetTokens(tableSpecificFields, firstNameAsNbr, lastNameAsNbr);
-			tables = DetermineTables(tokens);
-			}
+		QStringList tableSpecificFields = GetTableSpecificFields(aItem);
+		tokens = GetTokens(tableSpecificFields, firstNameAsNbr, lastNameAsNbr);
+		tables = DetermineTables(tokens);
 		});
 
 	HBufC* tableName(NULL);
@@ -364,11 +368,7 @@
 	if (aString)
 		{
 		QString s((QChar*)aString->Ptr(), aString->Length());
-#if defined(USE_ORBIT_KEYMAP)
 		QStringList tokens = s.split(iKeyMap->Separator(), QString::SkipEmptyParts);
-#else
-		QStringList tokens = s.split(' ', QString::SkipEmptyParts);
-#endif
 
 		// Select tokens in the same order they are in original aString
 		for (TInt i = 0; i < tokens.count(); ++i)