javauis/lcdui_akn/lcdui/src/CMIDTextEditorEdwin.cpp
branchRCL_3
changeset 83 26b2b12093af
parent 71 d5e927d5853b
equal deleted inserted replaced
77:7cee158cb8cd 83:26b2b12093af
   155         // Try handling special characters.
   155         // Try handling special characters.
   156         response = HandleSpecialKeyEventsL(aKeyEvent, aType);
   156         response = HandleSpecialKeyEventsL(aKeyEvent, aType);
   157 
   157 
   158         // Not handled, try with CEikEdwin
   158         // Not handled, try with CEikEdwin
   159         // Consume down and up type of keyevents
   159         // Consume down and up type of keyevents
   160         if ((response == EKeyWasConsumed) ||
   160         if ((response == EKeyWasConsumed) || 
   161                 (aType != EEventKey && aKeyEvent.iScanCode !=
   161                 (aType != EEventKey && aKeyEvent.iScanCode != 
   162                  EStdKeyApplication0))
   162                 EStdKeyApplication0))
   163         {
   163         {
   164             response = EKeyWasConsumed;
   164             response = EKeyWasConsumed;
   165         }
   165         }
   166         else
   166         else
   167         {
   167         {
   176             HBufC* oldContent = GetTextInHBufL();
   176             HBufC* oldContent = GetTextInHBufL();
   177 
   177 
   178             CleanupStack::PushL(oldContent);
   178             CleanupStack::PushL(oldContent);
   179 
   179 
   180             response = CEikEdwin::OfferKeyEventL(aKeyEvent, aType);
   180             response = CEikEdwin::OfferKeyEventL(aKeyEvent, aType);
   181 
   181             
   182             if (response == EKeyWasConsumed)
   182             if (response == EKeyWasConsumed) {
   183             {
       
   184                 // Validate new content and undo if not valid.
   183                 // Validate new content and undo if not valid.
   185                 if (!iEdwinUtils.ConstraintsValidForText(
   184                 if (!iEdwinUtils.ConstraintsValidForText(
   186                             Read(), iConstraints, EFalse))
   185                             Read(), iConstraints, EFalse))
   187                 {
   186                 {
   188                     CEikEdwin::SetTextL(oldContent);
   187                     CEikEdwin::SetTextL(oldContent);
   191                     // Restore cursor's original position.
   190                     // Restore cursor's original position.
   192                     SetCursorPosL(iCursorPosForAction, EFalse);
   191                     SetCursorPosL(iCursorPosForAction, EFalse);
   193                 }
   192                 }
   194             }
   193             }
   195             else
   194             else
   196             {
   195             { 
   197                 // Consuming the up/down arrows, because edwin does not
   196                 // Consuming the up/down arrows, because edwin does not 
   198                 // consume them when using predictive text
   197                 // consume them if at first/last line. 
   199                 if (((aKeyEvent.iCode == EKeyUpArrow) ||
   198                 if ((aType == EEventKey) &&
   200                         (aKeyEvent.iCode == EKeyDownArrow)) ||
   199                         (((aKeyEvent.iCode == EKeyUpArrow) ||
   201                         ((aKeyEvent.iScanCode == EStdKeyUpArrow) ||
   200                           (aKeyEvent.iCode == EKeyDownArrow)) ||
   202                          (aKeyEvent.iScanCode == EStdKeyDownArrow)))
   201                          ((aKeyEvent.iScanCode == EStdKeyUpArrow) ||
       
   202                           (aKeyEvent.iScanCode == EStdKeyDownArrow))))
   203                 {
   203                 {
   204                     response = EKeyWasConsumed;
   204                     response = EKeyWasConsumed;
   205                 }
   205                 }
   206             }
   206             }
   207             CleanupStack::PopAndDestroy(oldContent);
   207             CleanupStack::PopAndDestroy(oldContent);