fep/aknfep/src/AknFepUiInputStateInitialVietnameseMultitap.cpp
branchRCL_3
changeset 19 ac7e4d1d9209
parent 12 5e18d8c489d6
equal deleted inserted replaced
18:b1ea1642412e 19:ac7e4d1d9209
   126                 aChr.Append(bkChr);
   126                 aChr.Append(bkChr);
   127 
   127 
   128                 fepMan->NewCharacterL(aChr);
   128                 fepMan->NewCharacterL(aChr);
   129                 fepMan->CommitInlineEditL();
   129                 fepMan->CommitInlineEditL();
   130                 
   130                 
   131                	if (fepMan->EditSubmenuInUse() && fepMan->IsAbleToLaunchSCT())
   131                 if (fepMan->EditSubmenuInUse() && fepMan->IsAbleToLaunchSCT())
   132         		    {
   132                     {
   133         		    fepMan->LaunchSpecialCharacterTableL();
   133                     fepMan->LaunchSpecialCharacterTableL();
   134         		    return ETrue;
   134                     return ETrue;
   135         		    }                         
   135                     }                         
   136                 }
   136                 }
   137 			else if (fepMan->EditSubmenuInUse())
   137             else if (fepMan->EditSubmenuInUse())
   138 				{
   138                 {
   139 				aLength = ELongKeyPress;
   139                 aLength = ELongKeyPress;
   140 				}
   140                 }
   141             }
   141             }
   142         }
   142         }
   143     
   143     
   144     // Implementation for the Vietnamese back deletion
   144     // Implementation for the Vietnamese back deletion
   145     if (aKey == EKeyBackspace)
   145     if (aKey == EKeyBackspace)
   146         {
   146         {
       
   147         // Key looping should be cancelled as pressing backspace key
       
   148         toneMgr->StopKeyLooping();
       
   149     
   147         TBuf<2> newText;
   150         TBuf<2> newText;
   148         // Get the last character from the current editor
   151         // Get the last character from the current editor
   149         TText prevChar = fepMan->PreviousChar();
   152         TText prevChar = fepMan->PreviousChar();
   150         
   153         
   151         // Judge if the last character needs to be converted
   154         // Judge if the last character needs to be converted
   153             {
   156             {
   154             // Delete the prev character and send the new character to editor
   157             // Delete the prev character and send the new character to editor
   155             ((CAknFepManager*)fepMan)->RemovePreviousCharacterL();
   158             ((CAknFepManager*)fepMan)->RemovePreviousCharacterL();
   156             fepMan->NewCharacterL(newText);
   159             fepMan->NewCharacterL(newText);
   157             fepMan->CommitInlineEditL();
   160             fepMan->CommitInlineEditL();
   158 			// Stop looping for backspace operation
   161             // Stop looping for backspace operation
   159 			if( toneMgr->IsLooping() )
   162             if( toneMgr->IsLooping() )
   160 			    {
   163                 {
   161 				toneMgr->StopToneMarkLooping();
   164                 toneMgr->StopToneMarkLooping();
   162 				}
   165                 }
   163             return ETrue;
   166             return ETrue;
   164             }
   167             }
   165         else
   168         else
   166             {
   169             {
   167             if ( prevChar )
   170             if ( prevChar )
   175                 
   178                 
   176             bHandled = EFalse;
   179             bHandled = EFalse;
   177             }
   180             }
   178         }
   181         }
   179     
   182     
   180     if( toneMgr->IsKeyLooping( aKey ) )
   183     if( aLength == EShortKeyPress )
   181         {
   184         {
   182         if( toneMgr->ToneMarkIndex() !=  KErrNotFound )
   185         if( toneMgr->IsKeyLooping( aKey ) )
   183             {
   186             {
   184             // Get current tone mark
   187             if( toneMgr->ToneMarkIndex() !=  KErrNotFound )
   185             TText toneVowel;
   188                 {
   186             if( toneMgr->GetLoopingToneMarkVowel( toneVowel ) )
   189                 // Get current tone mark
   187                 {
   190                 TText toneVowel;
   188                 // remove two previous chars
   191                 if( toneMgr->GetLoopingToneMarkVowel( toneVowel ) )
   189                 ((CAknFepManager*)fepMan)->RemovePreviousCharacterL();
   192                     {
   190                 ((CAknFepManager*)fepMan)->RemovePreviousCharacterL();
   193                     // remove two previous chars
   191     
   194                     ((CAknFepManager*)fepMan)->RemovePreviousCharacterL();
   192                 TBuf<CAknFepManager::ESingleCharacter> aChr;
   195                     ((CAknFepManager*)fepMan)->RemovePreviousCharacterL();
   193                 aChr.Append(toneVowel);
   196         
   194                 
   197                     TBuf<CAknFepManager::ESingleCharacter> aChr;
   195                 // Update inline character(s)
   198                     aChr.Append(toneVowel);
   196                 fepMan->CancelInlineEdit();
   199                     
   197                 fepMan->NewCharacterL(aChr);
   200                     // Update inline character(s)
   198                 
   201                     fepMan->CancelInlineEdit();
   199                 toneMgr->SetLoopingCombined( ETrue );
   202                     fepMan->NewCharacterL(aChr);
   200                 bHandled = ETrue;
   203                     
   201                 }
   204                     toneMgr->SetLoopingCombined( ETrue );
   202             
   205                     bHandled = ETrue;
   203             // Reset the engine timer so that we can get timer expired message
   206                     }
   204             // We send the * key, and clear it in the next loop
   207                 
   205             ptiEng->ClearCurrentWord();
   208                 // Reset the engine timer so that we can get timer expired message
   206             ptiEng->AppendKeyPress((TPtiKey)EPtiKeyStar);
   209                 // We send the * key, and clear it in the next loop
       
   210                 ptiEng->ClearCurrentWord();
       
   211                 ptiEng->AppendKeyPress((TPtiKey)EPtiKeyStar);
       
   212                 }
       
   213             else
       
   214                 {
       
   215                 if( toneMgr->IsLoopingCombined() )
       
   216                     {
       
   217                     // remove tone mark
       
   218                     TBuf<2> newText;
       
   219                     // Get the last character from the current editor
       
   220                     TText prevChar = fepMan->PreviousChar();
       
   221                     
       
   222                     // Judge if the last character needs to be converted
       
   223                     if ( NeedsVietnameseBkDelSupport(prevChar, newText) )
       
   224                         {
       
   225                         // Delete the prev character and send the new character to editor
       
   226                         ((CAknFepManager*)fepMan)->RemovePreviousCharacterL();
       
   227                         fepMan->NewCharacterL(newText);
       
   228                         fepMan->CommitInlineEditL();
       
   229                         }
       
   230                 
       
   231                     toneMgr->SetLoopingCombined( EFalse );
       
   232                     }
       
   233                 }
   207             }
   234             }
   208         else
   235         else
   209             {
   236             {
   210             if( toneMgr->IsLoopingCombined() )
   237             // Key looping is not supported with Backspace key
   211                 {
   238             // Otherwise the process of deleting a2222 is wrong
   212                 // remove tone mark
   239             if ( aKey != EKeyBackspace )
   213                 TBuf<2> newText;
   240                 {
   214                 // Get the last character from the current editor
   241                 toneMgr->StartKeyLooping( aKey );
   215                 TText prevChar = fepMan->PreviousChar();
       
   216                 
       
   217                 // Judge if the last character needs to be converted
       
   218                 if ( NeedsVietnameseBkDelSupport(prevChar, newText) )
       
   219                     {
       
   220                     // Delete the prev character and send the new character to editor
       
   221                     ((CAknFepManager*)fepMan)->RemovePreviousCharacterL();
       
   222                     fepMan->NewCharacterL(newText);
       
   223                     fepMan->CommitInlineEditL();
       
   224                     }
       
   225             
       
   226                 toneMgr->SetLoopingCombined( EFalse );
       
   227                 }
   242                 }
   228             }
   243             }
   229         }
   244         }
   230     else
   245     else
   231         {
   246         {
   232         toneMgr->StartKeyLooping( aKey );
   247         // Key looping should be cancelled as long pressing key  
       
   248         // Otherwise a22 can not be inputted by press a, long press 2 and long press 2.
       
   249         toneMgr->StopKeyLooping();
   233         }
   250         }
   234     
   251     
   235     if(!bHandled && toneMgr->IsLooping())
   252     if(!bHandled && toneMgr->IsLooping())
   236     	{
   253         {
   237     	toneMgr->StopToneMarkLooping();
   254         toneMgr->StopToneMarkLooping();
   238     	}
   255         }
   239     
   256     
   240     return bHandled ? ETrue : TAknFepInputStateInitialMultitapBase::HandleKeyL(aKey, aLength);
   257     return bHandled ? ETrue : TAknFepInputStateInitialMultitapBase::HandleKeyL(aKey, aLength);
   241     }
   258     }
   242 
   259 
   243 void TAknFepInputStateInitialVietnameseMultitap::KeyTimerExpired()
   260 void TAknFepInputStateInitialVietnameseMultitap::KeyTimerExpired()