textinput/ptienginev2/src/PtiEngineImpl.cpp
branchRCL_3
changeset 10 6defe5d1bd39
parent 0 eb1f2e154e89
child 12 4eb1ae11334f
child 23 f043c81198e3
--- a/textinput/ptienginev2/src/PtiEngineImpl.cpp	Mon Mar 15 12:42:02 2010 +0200
+++ b/textinput/ptienginev2/src/PtiEngineImpl.cpp	Wed Mar 31 22:08:20 2010 +0300
@@ -1722,7 +1722,12 @@
 	{
 	if (iCurrentLanguage || iInputMode == EPtiEngineNumeric)
 		{			
-		MPtiCore *core = CoreForInputMode( aMode );		
+	    
+		MPtiCore *core = NULL;
+		if( iCurrentLanguage != NULL )
+		    {
+		    core = CoreForInputMode( aMode );
+		    }
 		if (!core)
 			{
 			return KErrNoSuitableCore;
@@ -1924,6 +1929,12 @@
 //
 TInt CPtiEngineImpl::AddUserDictionaryEntry(MPtiUserDictionaryEntry& aEntry)
 	{
+    
+    if ( !iCurrentLanguage )
+        {
+        return KErrNoActiveLanguage;
+        }
+    
 	CPtiUserDictionary* dict = DefaultUserDictForCore(Core());
 
 	if (dict)
@@ -1931,11 +1942,6 @@
 		return Core()->AddUserDictionaryEntry(aEntry, dict);
 		}
 
-	if (!iCurrentLanguage)
-		{
-		return KErrNoActiveLanguage;
-		}
-
 	return KErrNotSupported;
 	}
 
@@ -1971,6 +1977,12 @@
 //
 TInt CPtiEngineImpl::RemoveEntryFromUserDictionary(MPtiUserDictionaryEntry& aEntry)
 	{
+    
+    if ( !iCurrentLanguage )
+        {
+        return KErrNoActiveLanguage;
+        }
+    
 	CPtiUserDictionary* dict = DefaultUserDictForCore(Core());
 
 	if (dict)
@@ -1978,11 +1990,6 @@
 		return Core()->RemoveUserDictionaryEntry(aEntry, dict);
 		}
 
-	if (!iCurrentLanguage)
-		{
-		return KErrNoActiveLanguage;
-		}
-
 	return KErrNotSupported;
 	}
 
@@ -2018,18 +2025,17 @@
 //
 TInt CPtiEngineImpl::NumberOfEntriesInUserDictionary()
 	{
+    
+    if ( !iCurrentLanguage )
+        {
+        return KErrNoActiveLanguage;
+        }
 	CPtiUserDictionary* dict = DefaultUserDictForCore(Core());
 	
 	if (dict)
 		{
 		return Core()->NumberOfEntriesInUserDictionary(dict);
 		}
-
-	if (!iCurrentLanguage)
-		{
-		return KErrNoActiveLanguage;
-		}
-
 	return KErrNotSupported;
 	}
 
@@ -2323,17 +2329,18 @@
 //
 TInt CPtiEngineImpl::GetUserDictionaryEntry(TInt aIndex, MPtiUserDictionaryEntry& aResult)
 	{
+    
+    if ( !iCurrentLanguage )
+        {
+        return KErrNoActiveLanguage;
+        }
+    
 	CPtiUserDictionary* dict = DefaultUserDictForCore(Core());
 
 	if (dict)
 		{
 		return Core()->GetUserDictionaryEntry(aIndex, aResult, dict);
 		}
-	
-	if (!iCurrentLanguage)
-		{
-		return KErrNoActiveLanguage;
-		}
 
 	return KErrNotSupported;
 	}
@@ -3112,7 +3119,11 @@
 			case EPtiEnginePredictive:	
 				 {
 				 CPtiKeyMappings* maps = static_cast<CPtiKeyMappings*>(iCurrentLanguage->GetKeymappings());
-				 maps->GetDataForKey(aKey, aResult, aCase);
+				 
+				 if( maps != NULL )
+				     {
+				     maps->GetDataForKey(aKey, aResult, aCase);
+				     }
 				 }
 				 break;
 		    // Predictive QWERTY (XT9) changes ---->
@@ -3128,7 +3139,10 @@
 			case EPtiEngineQwerty:
      			 {
 		     	 CPtiQwertyKeyMappings* maps = static_cast<CPtiQwertyKeyMappings*>(iCurrentLanguage->GetQwertyKeymappings());
-				 maps->GetDataForKey(aKey, aResult, aCase);
+				 if( maps != NULL )
+				     {
+		     	     maps->GetDataForKey(aKey, aResult, aCase);
+				     }
 				 }     			
 			     break;							
      		case EPtiEnginePinyinPhraseHalfQwerty:
@@ -3138,7 +3152,10 @@
 			case EPtiEngineHalfQwertyPredictive:
      			 {
 		     	 CPtiHalfQwertyKeyMappings* maps = static_cast<CPtiHalfQwertyKeyMappings*>(iCurrentLanguage->GetHalfQwertyKeymappings());
-				 maps->GetDataForKey(aKey, aResult, aCase);
+				 if( maps != NULL )
+				     {
+		     	     maps->GetDataForKey(aKey, aResult, aCase);
+				     }
 				 }     			
 			     break;							
 			default:
@@ -3826,7 +3843,12 @@
         CPtiQwertyKeyMappings* qmaps = static_cast<CPtiQwertyKeyMappings*>(lang->GetQwertyKeymappings());
         if (qmaps)
             {
-            CPtiKeyMapData* mapData = maps->KeyMapData();
+        
+            CPtiKeyMapData* mapData = NULL;
+            if( maps != NULL )
+                {
+                mapData = maps->KeyMapData();
+                }
             if (mapData)
                 {
                 if (mapData->KeyData(EPtiKeyboardQwerty4x12, tmpSize))