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