javauis/lcdui_akn/lcdui/src/CMIDEdwin.cpp
branchRCL_3
changeset 60 6c158198356e
parent 59 e5618cc85d74
equal deleted inserted replaced
59:e5618cc85d74 60:6c158198356e
   768 
   768 
   769         if (CEikEdwin::TextLength() < iMaxSize)
   769         if (CEikEdwin::TextLength() < iMaxSize)
   770         {
   770         {
   771             CEikEdwin::SetCursorPosL(cursorPos + 1, EFalse);
   771             CEikEdwin::SetCursorPosL(cursorPos + 1, EFalse);
   772         }
   772         }
   773         else if (cursorPos == (iMaxSize - 1) && cursorPos == textLength && scanCode==EStdKeyFullStop)
   773         else if (cursorPos == (iMaxSize - 1) && cursorPos == textLength &&
       
   774                  (scanCode == EStdKeyFullStop || scanCode == EStdKeyMinus))
   774         {
   775         {
   775             CEikEdwin::SetCursorPosL(iMaxSize, EFalse);
   776             CEikEdwin::SetCursorPosL(iMaxSize, EFalse);
   776         }
   777         }
   777     }
   778     }
   778     //Error tone playing case1:
   779     //Error tone playing case1:
   838                 return EKeyWasConsumed;
   839                 return EKeyWasConsumed;
   839             }
   840             }
   840         }
   841         }
   841     }
   842     }
   842 
   843 
   843     if (aType != EEventKey)
   844     if (aType != EEventKey && aKeyEvent.iScanCode != EStdKeyApplication0)
   844     {
   845     {
   845         UpdateTextCapacityIndicatorValueL();
   846         UpdateTextCapacityIndicatorValueL();
   846         return EKeyWasConsumed;
   847         return EKeyWasConsumed;
   847     }
   848     }
   848 
   849 
   849 
   850 
   850     TKeyResponse response = EKeyWasNotConsumed;
   851     TKeyResponse response = EKeyWasNotConsumed;
   851 
   852 
   852     //Error tone playing case2:
   853     // Error tone playing case2:
   853     //Play error tone if TextBox/TextField is read-only or maximum length has been reached.
   854     // Play error tone if TextBox/TextField is read-only or maximum length has been reached.
   854     //Here is handling of full keyboard keys(NOT 0...9) and all virtual keyboard keys.
   855     // Here is handling of full keyboard keys(NOT 0...9) and all virtual keyboard keys
   855     //(Note: Virtual keyboard sends only EEventKey type events, not up or down events)
   856     // (camera and menu key not included).
   856     //(Note: Error tone is played when there is no text to be replaced i.e. no text has been painted)
   857     // (Note: Virtual keyboard sends only EEventKey type events, not up or down events)
   857     if (!iEdwinUtils->IsNavigationKey(aKeyEvent) && !iEdwinUtils->IsHotKeyL(aKeyEvent, iCoeEnv) && !aKeyEvent.iCode == EKeyYes &&
   858     // (Note: Error tone is played when there is no text to be replaced i.e. no text has been painted)
   858             (!iKeyEventsPending || (scanCode < KKeyQwerty0  || scanCode > KKeyQwerty9)))
   859     if (!iEdwinUtils->IsNavigationKey(aKeyEvent) && !iEdwinUtils->IsHotKeyL(aKeyEvent, iCoeEnv) && aKeyEvent.iCode != EKeyYes &&
       
   860             (!iKeyEventsPending || (scanCode < KKeyQwerty0  || scanCode > KKeyQwerty9)) &&
       
   861             (aKeyEvent.iCode != EKeyApplication0 && scanCode != EStdKeyApplication0 &&
       
   862              aKeyEvent.iCode != EKeyApplication19 && scanCode != EStdKeyApplication19))
   859     {
   863     {
   860         if (IsReadOnly() || (TextLength() >= iMaxSize && aKeyEvent.iCode != EKeyBackspace))
   864         if (IsReadOnly() || (TextLength() >= iMaxSize && aKeyEvent.iCode != EKeyBackspace))
   861         {
   865         {
   862             //SelectionLength() > 0 if text has been selected/painted
   866             //SelectionLength() > 0 if text has been selected/painted
   863             if (SelectionLength() == 0)
   867             if (SelectionLength() == 0)
   920                 CPlainText* res = CEikEdwin::Text();
   924                 CPlainText* res = CEikEdwin::Text();
   921 
   925 
   922                 if (res && TChar(aKeyEvent.iCode) == TChar('-') &&
   926                 if (res && TChar(aKeyEvent.iCode) == TChar('-') &&
   923                         TextLength() < iMaxSize)
   927                         TextLength() < iMaxSize)
   924                 {
   928                 {
       
   929                     TInt textLength = TextLength();
   925                     res->InsertL(GetCaretPosition(), KMinusChar);
   930                     res->InsertL(GetCaretPosition(), KMinusChar);
   926                     HandleTextChangedL(); // notify editor about the text changes
   931                     HandleTextChangedL(); // notify editor about the text changes
   927                     CEikEdwin::ReportEdwinEventL(EEventTextUpdate);
   932                     CEikEdwin::ReportEdwinEventL(EEventTextUpdate);
       
   933                     TInt cursorPos = GetCaretPosition();
   928 
   934 
   929                     if (TextLength() < iMaxSize)
   935                     if (TextLength() < iMaxSize)
   930                     {
   936                     {
   931                         CEikEdwin::SetCursorPosL(GetCaretPosition() + 1, EFalse);
   937                         CEikEdwin::SetCursorPosL(GetCaretPosition() + 1, EFalse);
       
   938                     }
       
   939                     else if (cursorPos == (iMaxSize - 1) && cursorPos == textLength)
       
   940 
       
   941                     {
       
   942                         CEikEdwin::SetCursorPosL(iMaxSize, EFalse);
   932                     }
   943                     }
   933                 }
   944                 }
   934             }
   945             }
   935 
   946 
   936         }
   947         }