fep/aknfep/src/aknfepuiinputminiqwertypinyinphrasebase.cpp
branchRCL_3
changeset 22 bd83ceabce89
parent 21 ecbabf52600f
equal deleted inserted replaced
21:ecbabf52600f 22:bd83ceabce89
  1305         uiContainer->ShowVerticalScrollArrows(EFalse);
  1305         uiContainer->ShowVerticalScrollArrows(EFalse);
  1306         uiContainer->SetControlInVisible( EFalse );
  1306         uiContainer->SetControlInVisible( EFalse );
  1307         }
  1307         }
  1308     }
  1308     }
  1309 
  1309 
       
  1310 //-------------------------------------------------------------------------------
       
  1311 // Purpose: to adjust the scancode to make pinyin works
       
  1312 // Pinyin symbol inheritantly accepts A-Z, any input out of this range will make it crash.
       
  1313 // Add this function to turn some alienated scancode to A-Z.
       
  1314 //
       
  1315 //---------------------------------------------------------------------------
       
  1316 //
       
  1317 void TAknFepInputMiniQwertyPinyinPhraseBase::MapKey(TInt& aKey)
       
  1318     {    
       
  1319     if(iOwner && iOwner->PtiEngine())
       
  1320         {
       
  1321         iOwner->PtiEngine()->SetInputMode(EPtiEnginePinyinPhraseQwerty);
       
  1322         TBuf<KMaxName> upperdata;
       
  1323         iOwner->PtiEngine()->MappingDataForKey((TPtiKey)aKey, upperdata, EPtiCaseUpper);
       
  1324         if(upperdata.Length() > 0)
       
  1325             {
       
  1326             aKey = upperdata[0];
       
  1327             }
       
  1328         }
       
  1329     }
  1310 // ---------------------------------------------------------------------------
  1330 // ---------------------------------------------------------------------------
  1311 // TAknFepInputMiniQwertyPinyinPhraseBase::GetShowKeystroke
  1331 // TAknFepInputMiniQwertyPinyinPhraseBase::GetShowKeystroke
  1312 //Handle horizontal navigation.
  1332 //Handle horizontal navigation.
  1313 // ---------------------------------------------------------------------------
  1333 // ---------------------------------------------------------------------------
  1314 //
  1334 //
  1315 void TAknFepInputMiniQwertyPinyinPhraseBase::GetShowKeystroke(TInt aKey,
  1335 void TAknFepInputMiniQwertyPinyinPhraseBase::GetShowKeystroke(TInt aKey,
  1316     TDes& aKeystroke)
  1336     TDes& aKeystroke)
  1317     {
  1337     {
       
  1338     TInt key = aKey;
       
  1339     MapKey(key);   
  1318     TInt count = sizeof(StrokeMap )/sizeof(StrokeMap[0] );
  1340     TInt count = sizeof(StrokeMap )/sizeof(StrokeMap[0] );
  1319     for (TInt i = 0; i < count; i++)
  1341     for (TInt i = 0; i < count; i++)
  1320         {
  1342         {
  1321         if (aKey == StrokeMap[i].iKeyCode)
  1343         if (key == StrokeMap[i].iKeyCode)
  1322             {
  1344             {
  1323             aKeystroke.Append(StrokeMap[i].iValue);
  1345             aKeystroke.Append(StrokeMap[i].iValue);
  1324             break;
  1346             break;
  1325             }
  1347             }
  1326         }
  1348         }
  1677         {
  1699         {
  1678         return EFalse;
  1700         return EFalse;
  1679         }
  1701         }
  1680 
  1702 
  1681     GetShowKeystroke(aKey, keystroke);
  1703     GetShowKeystroke(aKey, keystroke);
       
  1704 	
       
  1705 	//Add this condition to avoid crash in case keystroke is empty.
       
  1706     if(keystroke.Length() == 0)
       
  1707         {
       
  1708         return EFalse;
       
  1709         }
  1682     if ( index >= keystrokeArray->Count() )
  1710     if ( index >= keystrokeArray->Count() )
  1683         {
  1711         {
  1684         keystrokeArray->AppendL(keystroke);
  1712         keystrokeArray->AppendL(keystroke);
  1685         editPane->SetCursorIndexOfKeystroke(keystrokeArray->Count() );
  1713         editPane->SetCursorIndexOfKeystroke(keystrokeArray->Count() );
  1686         }
  1714         }